Nicolas Barbier <nicolas.barb...@gmail.com> Friday 17 of June 2011 17:29:57
> 2011/6/17, Andrew Dunstan <and...@dunslane.net>:
> > On 06/17/2011 10:55 AM, Radosław Smogura wrote:
> >> 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.
> > 
> > If you store images you should encode them anyway, in base64 or hex.
> 
> Whitespace that is not at certain obviously irrelevant places (such as
> right after "<", between attributes, outside of the whole document,
> etc), and that is not defined to be irrelevant by some schema (if the
> parser is schema-aware), is relevant. You cannot just muck around with
> it and consider that correct.
> 
> > More generally, data that needs that sort of preservation should
> > possibly be in CDATA nodes.
> 
> CDATA sections are just syntactic sugar (a form of escaping):
> 
> <URL:http://www.w3.org/TR/xml-infoset/#omitted>
> 
> "Appendix D: What is not in the Information Set
> [..]
> 19. The boundaries of CDATA marked sections."
> 
> Therefore, there is not such thing as a "CDATA node" that would be
> different from "just text" (Infoset-wise).
> 
> Note that that does not mean that binary data is never supposed to be
> altered or that all binary data is to be accepted: e.g., whether
> newlines are represented using "\n", "\r", or "\r\n" is irrelevant;
> also, binary data that is not valid according to the used encoding
> must of course not be accepted.
> 
> Nicolas

I would like to send patch to remove formatting. How to deal with collapsing 
blank nodes I don't know.

Regards,
Radek
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 702b9e3..07464fb 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -3262,7 +3262,7 @@ xml_xmlnodetoxmltype(xmlNodePtr cur)
 		buf = xmlBufferCreate();
 		PG_TRY();
 		{
-			xmlNodeDump(buf, NULL, cur, 0, 1);
+			xmlNodeDump(buf, NULL, cur, 0, 0);
 			result = xmlBuffer_to_xmltype(buf);
 		}
 		PG_CATCH();
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to