[xml] attribute value processing

Date view Thread view Subject view Author view

From: Havoc Pennington (hp@redhat.com)
Date: Fri Jan 21 2000 - 15:39:24 EST


Hi,

I have a standalone document (used in the GConf backend) and want to
store an arbitrary string. So the string could be just "foo" or it
could itself be a large XML document.

Right now I'm using an attribute for this. When I have a multiline
string libxml seems to reduce all whitespace to 1 space and strip
leading/trailing space, as explained in the spec:

"If the declared value is not CDATA, then the XML processor must
further process the normalized attribute value by discarding any
leading and trailing space (#x20) characters, and by replacing
sequences of space (#x20) characters by a single space (#x20)
character."

However in this case there's no DTD so the value is not declared,
right? The spec also says:

"All attributes for which no declaration has been read should be
treated by a non-validating parser as if declared CDATA."

So:
 - should it work to set arbitrary strings as attribute values?
 - if not what's the best way to store a string that can contain literally
   _anything_

Thanks,
Havoc

----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:58 EDT