[jdom-interest] CDATA sections?
kevinr at valicert.com
Fri Jun 2 14:53:23 PDT 2000
For well-formed XML, you could get away with this. But for many
applications (such as digital signatures or anything that uses
a DTD/Schema), you need to do validation. JDOM will parse an HTML block
into a tree as XML (without validation). It won't give you the HTML as a
string (which is what was desired in my example).
> If they are well-formed XML, can you not make that element
> holding these fragments as taking 'any'? No point in wrapping them
> with a CDATA. (Then again, I'm not especially good at DTDs...)
> For your use-case
> <b>some well-formed, but <i>fairly ignored</i> xml-ish stuff</b>
> If the stuff within <MyFragment> is well-formed, then jdom
> can still parse it in absence of a dtd/schema, and give you
> a tree.
> To output it as SAX events, take <MyFragment>, wrap in a
> Document, and output it. (Or, use the currently non-existent
> But I also might be making an over-assumption that you have
> well-formed XML as your fragments of HTML/WML.
> But if they are well-formed, I don't think you need a CDATA.
> > It might be informative to conduct a quick inventory of
> > users' XML data. How often do CDATA sections occur? If
> > they are prevalent, as I suspect they are, then it tends to
> > put CDATA on the 80 side of the 80/20 razor.
> I personally avoid them, since they can't hold absolutely
> any set of bytes (that pesky end-of-CDATA marker keeps you
> from holding CDATA-containing XML in a CDATA section, without
> some crufy escapage).
> fwiw, if I find myself thinking 'hey, I need to use a CDATA',
> I'll typically punt, and use a reference/link to yet-another
> resource. But I'm also dealing with binary data, and like
> my bytes MIME wrapped.
> To control your jdom-interest membership:
More information about the jdom-interest