Problems parsing when Properties.dtd.properties

Discussion in 'Java' started by Kent Lichty, Apr 16, 2004.

  1. Kent Lichty

    Kent Lichty Guest

    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.
     
    Kent Lichty, Apr 16, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amit Sharma

    Parsing DTD from XML in Java

    Amit Sharma, Jan 12, 2004, in forum: Java
    Replies:
    1
    Views:
    521
    Manish Hatwalne
    Jan 12, 2004
  2. Mark McKay
    Replies:
    0
    Views:
    1,121
    Mark McKay
    Sep 22, 2004
  3. Joseph Tilian
    Replies:
    0
    Views:
    362
    Joseph Tilian
    Dec 21, 2004
  4. Ronald Fischer
    Replies:
    4
    Views:
    1,772
    Ronald Fischer
    Mar 17, 2005
  5. test
    Replies:
    2
    Views:
    2,089
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page