xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin Goei <edwi...@sun.com>
Subject Re: JAXP/Crimson Document question
Date Mon, 16 Apr 2001 22:26:08 GMT

Kate Lapan wrote:
> I'm trying to create a document from an xml string.  I modified the example
> code that comes with crimson, but for some reason, the document is null even
> though the input source is fine.  Below is my code.
> -----------------------------------------------------------------------
> // Step 1: create a DocumentBuilderFactory
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> // Step 2: create a DocumentBuilder
> DocumentBuilder db = dbf.newDocumentBuilder();
> // Step 3: parse the input file to get a Document object
> InputSource input = new InputSource(new StringReader(requestText));
> Document requestDom = db.parse(input);
> -----------------------------------------------------------------------
> Does anyone know how to make the above work properly?

The above code should work.  Of course, you need to wrap the code in a
try/catch block.  So you are saying that "requestDom" is null?  This
should not happen.  Unfortunately, I don't have any ideas.  What version
of Crimson are you using?  You could try your app with Xerces.

BTW, newer apps will want to turn on namespace processing, so you need
to add dbf.setNamespaceAware(true) before creating a new


In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message