[jdom-interest] Creating mixedContent

Paul Lawton paul at wirestation.co.uk
Wed Aug 23 09:02:33 PDT 2000


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




More information about the jdom-interest mailing list