Shouldn't:
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
docBuilderFactory.setValidating(false);
be:
docBuilderFactory.setValidating(false);
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
???
Paul Franz
----- Original Message -----
From: "Roger Lacroix" <[EMAIL PROTECTED]>
To: "jdjlist" <[EMAIL PROTECTED]>
Sent: Thursday, October 30, 2003 12:18 PM
Subject: [jdjlist] XML Question
> All:
>
> I have the following problem:
>
> I am trying to do a quick tree-view (JTree) display of a XML message. I
read
> the message from the queue, parse it, create nodes and display the tree.
>
> If the XML does NOT reference a DTD (<!DOCTYPE ...) everything works just
fine.
> But if the XML does reference a DTD then it throws an error
> (org.xml.sax.SAXParseException: Relative URI "xxxxxxx.dtd"; can not be
resolved
> without a base URI.).
>
> So, I thought, "oh, it is trying to validate the XML with the DTD" - but I
do
> NOT have the DTD locally. So, I tried to turn validating off with
setValidating
> (false) but I still get the error.
>
> Here is a code snippet:
>
> DocumentBuilderFactory docBuilderFactory =
DocumentBuilderFactory.newInstance
> ();
> DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
>
> docBuilderFactory.setValidating(false);
>
> StringReader stringreader = new StringReader(buffer.toString());
> InputSource in = new InputSource(stringreader);
>
> Document doc = docBuilder.parse(in);
>
> Element root = doc.getDocumentElement();
> root.normalize();
>
> DefaultMutableTreeNode top = createTreeNode(root);
>
> m_model.setRoot(top);
> m_tree.treeDidChange();
>
>
> What can I do to stop the parser from attemping to validate against the
DTD?
> (Because I don't have a local copy of the DTD.)
>
> Any help would be appreciated.
>
> Regards,
> Roger Lacroix
>
>
> ---
> You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
> http://www.sys-con.com/fusetalk
> To unsubscribe from all mailing lists, click:
>
http://sys-con.com/[EMAIL PROTECTED]
on.com
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk
To unsubscribe from all mailing lists, click:
http://sys-con.com/[EMAIL PROTECTED]