Yes, that is exactly what we do. I use the setAttribute method on DOMElement
instance passing name as "formula" and value as
"<data>.//activity/@status</data>". Then I serialise the DOMDocument to a
string. When I examine the string, I see that Xerces has replaced each '<'
with "&lt;" which is correct. But it leaves each '>' as is. Then when I try
to serialise the string into a DOM document, the result is nonsense, as I
think the '>' characters are interpreted as close element markers. I tried
replacing each '>' with "&gt;" in the string before passing it to
setAttribute, but that did not work, as it replces the '&' with "&amp;".



Are you saying that the document may be serialized with an element like the
following?

  <editnumber formula="<data>.//activity/@status</data>">

If so, the serialization is invalid.  See
http://www.w3.org/TR/2006/REC-xml-20060816/#syntax.  '<' must be represented
as a numeric character reference or '&lt;' when it's not used as a markup
delimiter.  If humans have to look at the markup, you might want to
represent '>' as '&gt;' for symmetry.  Note that ampersands must also be
escaped.  A spec-compliant XML processor will take care of this for you.


-- 
View this message in context: 
http://old.nabble.com/How-to-have-an-attribute-which-contains-XML-tp26392607p26405545.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to