Re: PostgreSQL 8.3 XML parser seems not to recognize the DOCTYPE element in XML files

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: "Lawrence Oluyede" <l(dot)oluyede(at)gmail(dot)com>, "Belbin, Peter" <PETER(dot)BELBIN(at)mcleodusa(dot)com>
Subject: Re: PostgreSQL 8.3 XML parser seems not to recognize the DOCTYPE element in XML files
Date: 2008-08-12 09:40:31
Message-ID: 200808121240.32797.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Am Thursday, 7. February 2008 schrieb Lawrence Oluyede:
> PostgreSQL 8.3 instead doesn't allow the insertion of XML with doctype
> in its new native data type returning this error message:
>
> """
> ERROR: invalid XML content
> DETAIL: Entity: line 2: parser error : StartTag: invalid element name
> <!DOCTYPE foo>
> ^

It turns out that this behavior is entirely correct. It depends on the XML
option. If you set the XML option to DOCUMENT, you can parse documents
including DOCTYPE declarations. If you set the XML option to CONTENT, then
what you can parse is defined by the production

XMLDecl? content

which does not allow for a DOCTYPE.

The default XML option is CONTENT, which explains the behavior.

Now, the supercorrect way to parse XML values would be using the XMLPARSE()
function, which requires you to specify the XML option inline. That way,
everything works.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joao Ferreira gmail 2008-08-12 10:34:13 Re: big database with very small dump !?
Previous Message MuraliPD@GMail 2008-08-12 09:38:12 Need help returning record set from a dynamic sql query

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Wanner 2008-08-12 09:43:22 Re: WIP: New Page API
Previous Message Zdenek Kotala 2008-08-12 09:38:16 Re: WIP: New Page API