[jdom-interest] Solved: Creating mixedContent

Paul Lawton paul at wirestation.co.uk
Wed Aug 23 10:54:39 PDT 2000


A colleague has figured a work around:

We have now got it to work by using the DOMBuilder (instead of SAXBuilder)
and passing in a pre-parsed w3c.dom.document created from my string data.
It seems that the SAXBuilder.build()method isn't doing a correct/good job of
parsing the data.  Is this a bug in the SAXBuilder?

Paul

> I have the following XML string extracted from the database
>
> String elementData = "<data>mixed stuff with comments...<!-- a comment
> here --> after comment now content cs here - <cs id="50" /> and more text
> blah etc</data>";
>
> and I'm trying to create a Jdom document so that I can access the element
> using the following:
>
>       SAXBuilder builder = new SAXBuilder();
>       org.jdom.Document subDocument = builder.build ( new
> StringBufferInputStream( elementData ) ) ;
>       org.jdom.Element subRootElement = subDocument.getRootElement();
>
>     subRootElement.hasMixedContent() returns false and getMixedContent
> returns a list size of zero.
>
> It seems like the SAXBuilder build method doesn't evaluate mixedContent
> properly - or maybe I'm doing something wrong.
>
> How can I create a document from a mixedContent XML string and get access
to
> the mixedContent?
>
> Paul
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list