Re: XPATH evaluation - Mailing list pgsql-hackers

From Radosław Smogura
Subject Re: XPATH evaluation
Date
Msg-id 201106171655.07407.rsmogura@softperience.eu
Whole thread Raw
In response to Re: XPATH evaluation  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: XPATH evaluation
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> Friday 17 of June 2011 15:47:04
> On 06/17/2011 05:41 AM, Florian Pflug wrote:
> > On Jun17, 2011, at 11:09 , Radosław Smogura wrote:
> >> 1.
> >> SELECT (XPATH('/root/*', '<root xmlns:o="http://olacle.com/db"
> >> xmlns:p="http://postgresql.org/db"><o:db><a><b></b></a></o:db><p:db></p
> >> :db></root>')); Produces:
> >> "{"<o:db>
> >>
> >>   <a>
> >>
> >>     <b/>
> >>
> >>   </a>
> >>
> >> </o:db>",<p:db/>}"
> >> In above<b></b>  was reduced to<b/>  this is different infoset then
> >> input, and those notations are differently interpreted e.g. by XML
> >> Binding&  WebServices. The 1st one will may be mapped to empty string,
> >> and 2nd one to to null.
> >
> > Oh, joy :-(
>
> I thought these were basically supposed to be the same.
>
> The XML Information Set for example specifically excludes:
>
>     The difference between the two forms of an empty element: |<foo/> |
>     and |<foo></foo>|.||||
>
>
> See <http://www.w3.org/TR/2004/REC-xml-infoset-20040204/> Appendix D.
> Note that this implies that <foo></foo> does not have content of an
> empty string, but that it has no content.
>
>
> cheers
>
> andrew

Indeed, Infoset Spec, and XML Canonization Spec treats <foo></foo> same, as
<foo/> - my wrong, but XML canonization preservs whitespaces, if I remember
well, I think there is example.

In any case if I will store image in XML (I've seen this), preservation of
white spaces and new lines is important.

Regards,
Radek.


pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Boolean operators without commutators vs. ALL/ANY
Next
From: Jaime Casanova
Date:
Subject: Re: [v9.2] Start new timeline for PITR