Problems parsing when Properties.dtd.properties

K

Kent Lichty

Hi all...

My question is quite simple, but is proving very frustrating. I am
using JDOM to do some simple parsing on an XML file. The code is shown
below:

SAXBuilder builder = new SAXBuilder(false);
Document doc = builder.build(propertiesFile);
Element root = doc.getRootElement();
List children = root.getChildren();
Iterator iterator = children.iterator();
while (iterator.hasNext()) {
.... etc



Here is the entire XML file I am trying to parse:

------- BEGIN XML FILE
-------------------------------------------------------

<?xml version="1.0"?>
<!--
<!DOCTYPE Properties SYSTEM "Properties.dtd.properties">
-->

<Properties>

<section name="start">
<property name="user" type="string" value="CVT_JTG"/>
<property name="password" type="string" value="PW"/>
</section>

<section name="system">
<property name="name" value="walrsys"/>
<property name="application" type="string" value="sqlserver"/>
<!--local or rmi -->
<property name="server" value="local"/>
<!--host machine for the out queue manager-->
<property name="host" value="local"/>
</section>

</Properties>

-------- END XML FILE
---------------------------------------------------------

The problem is the "Properties.dtd.properties" line in the XML that I
have commented out. If I don't comment this out, then my code throws
an IOException on the "builder.build(propertiesFile)" line. This XML
file comes from another vendor and they didn't provide this file. I
know that I could create a "dummy" Properties.dtd.properties file and
this would work, but that seems lame. I was hoping that the value of
"false" in the SAXBuilder constructor would cause it to skip this kind
of validation, but it seems to make no difference.

Has anybody else encountered this error and figured out a better way
to fix it? I really don't want to have to modify the xml file.

Thanks in advance, and feel free to E-mail me directly if you have any
suggestions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top