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 '<' when it's not used as a markup delimiter. If humans have to look at the markup, you might want to represent '>' as '>' for symmetry. Note that ampersands must also be escaped. A spec-compliant XML processor will take care of this for you. -----Original Message----- From: Leif Goodwin [mailto:[email protected]] Sent: Tue 11/17/2009 11:10 AM To: [email protected] Subject: How to have an attribute which contains XML We have blocks of XML which represents dialog templates. Here is an example with 2 buttons and one number edit control: <dialogex caption="Activity" charset="1" cx="522" cy="348" decplaces="5" field="activity" fontname="MS Shell Dlg" italic="0" major_version="1" minor_version="0" ptsize="8" resid="130" style="DS_SETFONT|DS_MODALFRAME|DS_FIXEDSYS|WS_POPUP|WS_CAPTION|WS_SYSMENU" type="DIALOGEX" weight="400" x="0" y="0"> <pushbutton caption="OK" cx="63" cy="15" resid="IDOK" style="WS_TABSTOP" x="453" y="7"/> <pushbutton caption="Cancel" cx="63" cy="15" resid="IDCANCEL" style="WS_TABSTOP" x="453" y="28"/> <editnumber cx="100" cy="12" decplaces="3" field="no_CSP" formula=".//activity/@LCSP - .//activity/@FCSP + 1" numeric="int" resid="218" style="ES_AUTOHSCROLL|ES_READONLY|WS_BORDER|WS_TABSTOP" x="84" y="297"/> </dialogex> You can see that the <editnumber> element has an attribute called "formula" which contains an XQuery expression. This works fine until the XQuery expression contains something like the following: "<data>.//activity/@status</data>" The problem is that Xerces does not like an attribute value that contains the '<' and '>' characters. When I try to parse the <dialogex> element with a formula attribute containing the above XQuery expression, it goes wobbly, and fails. Does anyone know a way around this? (Of course I could pre-parse the formula string, and replace all '<' characters with "@@lt" for example, and similarly for '<', and hope that our formula never needs to contain "@@lt" and "@@gt". But I'd rather find a more elegant method.) -- View this message in context: http://old.nabble.com/How-to-have-an-attribute-which-contains-XML-tp26392607p26392607.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]
