Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


embedding xml in xml as string

From: shaun roe <shaun.roe@-------.-->
To: NULL
Date: 11/2/2005 1:46:00 PM
I have an xml  format for creating a database; lets say a fragment looks 
like this:

<insertValue type="int">7</insert>
<insertValue type="string">Hello everyone</insert>


now I have a document I am transforming into this format using XSLT:

<nDwarves>7</nDwarves>
<snowWhiteSays>Hello everyone</snowWhiteSays>
<groupReply><possibleReplies replyTo="greeting">hello</possibleReplies>
<possibleReplies replyTo="workSignal">hi ho, hi ho</possibleReplies>
</groupReply>


My problem is that I want to put the entire contents of the <groupReply> 
node into a string, escaping the "<" and ">", so that I have an 
insertValue node containing the string which is essentially a bit of 
escaped xml.

Unfortunately, <xsl:copy-of... > doesnt have an option to escape the xml 
characters, so far as I can see. Is there another way?


background:
why do this?
I am using the Xerces2.3 parser to get the text content of the 
<insertValue> nodes, then I upload it. If I have straight xml inside 
this node, then getTextContent simply returns the collapsed text content 
of all the child elements ­ with no element names etc, when what I want 
is the actual xml fragment to insert in my database as a string. I hope 
to get around this by escaping the xml, so it really looks like just 
another string.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent