If you are embedding data that has >'s and <'s, then you prolly wanna use the CDATA directive/option/thing within your xml to denote, "this is data of the XML document, not part of the XML structure".
If that's beyond your control, you can always create a SAX parser that does just what you want.
Or you can write some XSLT that transforms the content nested data into what I described above.
Bart: God, Schmod. I want my monkey-man.
| [reply] |
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<xsl:output cdata-section-elements="content"/>
<xsl:template match="/">
<page>
<xsl:attribute name="id"><xsl:value-of select="page/@id" /
+>
</xsl:attribute>
<content>
<xsl:apply-templates />
</content>
</page>
</xsl:template>
</xsl:stylesheet>
/J\ | [reply] [d/l] |
I'll retort with a joke.
In three places across the country, there fires break out in three bedrooms. The fires aren't large yet, but the smoke wakes up the people inside those rooms. In them, slept a chemist, a physicist and a computer scientist (or mathematician, works both ways).
The chemist wakes up, measures the fire's dimensions and heat, grabs a large container, measures the water exactly and puts out the fire with a fairly even distribution of water, not wasting a drop.
The physicist wakes up, grabs a container, fills it as quickly as he can, douses the fire and it's out.
The computer scientist wakes up, sees the fire, declares it an already solved problem and goes back to sleep.
Lesson learned? I'm lazy :) (Or the other excuse is, I know it's possible, but there were too many hurdles to go through: finding my xslt book, getting an xslt parser installed etc.. ) Doesn't make it right. bad monk, i know.
Bart: God, Schmod. I want my monkey-man.
| [reply] |