Re: PostgreSQL 8.3 XML parser seems not to recognize the DOCTYPE element in XML files - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: PostgreSQL 8.3 XML parser seems not to recognize the DOCTYPE element in XML files
Date
Msg-id 200808121240.32797.peter_e@gmx.net
Whole thread Raw
In response to PostgreSQL 8.3 XML parser seems not to recognize the DOCTYPE element in XML files  ("Lawrence Oluyede" <l.oluyede@gmail.com>)
List pgsql-general
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.

pgsql-general by date:

Previous
From: "MuraliPD@GMail"
Date:
Subject: Need help returning record set from a dynamic sql query
Next
From: Joao Ferreira gmail
Date:
Subject: Re: big database with very small dump !?