[jdom-interest] FW: JDOM

Dan Warburton warb at tgf.tc.faa.gov
Thu Oct 12 13:05:39 PDT 2000


We just got the cvs version this morning. When processing the attached xml
file
with the sample java code, we get null for <AcesRecord> content.

We applied this patch to SAXBuilder.java , that gives us the content, but
don't
know enough about the system to know if this is the "right thing" to do.

What do you think?



orion{warb}-> diff  SAXBuilder.java   SAXBuilder.java.save
3,8d2
<  *****************************< NOTICE >*******************************
<  This file has been modified by Jim Mauroff,ACT-510 0n 10/12/2000.
<  In the SaxHandler class the method characters has been modified.
<  See characters for details.
<  **********************************************************************
<
666,670c660
<             }
<         }
<           // the following else was taken out of the above
<           // 'else if' inorder to get the content of the elements.
<         else {
---
>             } else {
672a663
>             }
orion{warb}->

-----Original Message-----
From: jimm at faatcrl.tc.faa.gov [mailto:jimm at faatcrl.tc.faa.gov]On Behalf
Of Jim Mauroff
Sent: Thursday, October 12, 2000 4:52 PM
To: warb at tgf.tc.faa.gov
Subject: JDOM



-------------- next part --------------
import org.jdom.input.SAXBuilder;
import org.jdom.*;

import java.io.*;
import java.util.*;

public class SaxTest
{
  public static void main ( String[] args )
  {
    try
    {
      SAXBuilder saxBuilder = new SAXBuilder( true );
      Document document = saxBuilder.build ( new File ( "acesRecords.xml" ) );
      Element root = document.getRootElement();
      java.util.List list = root.getChildren();
      Iterator iterator = list.iterator();
      while ( iterator.hasNext() )
      {
        Element nextElement = (Element) iterator.next();
        System.out.println ( nextElement.toString() );
        System.out.println ( nextElement.getTextTrim() ); 
      }
    }
    catch ( JDOMException jdome )
    {
      System.err.println ( jdome.getMessage() );
    }
  }
}
-------------- next part --------------
<?xml version='1.0' ?>

<!-- Definition of a Aces Record -->

<!DOCTYPE AcesRecords [
<!ELEMENT AcesRecords (AcesRecordName+) >
<!ELEMENT AcesRecordName (#PCDATA)>
<!ATTLIST AcesRecordName
        default CDATA #IMPLIED> ]>

<!-- The Aces Records -->

  <AcesRecords>
    <AcesRecordName default="true">
      STEREOG
    </AcesRecordName>
    <AcesRecordName >
      PARAM
    </AcesRecordName>
    <AcesRecordName >
       LDN
    </AcesRecordName>
    <AcesRecordName >
       SUBFX
    </AcesRecordName>
    <AcesRecordName default="true"> 
       NODE
    </AcesRecordName>
    <AcesRecordName >
       BLINE
    </AcesRecordName>
    <AcesRecordName >
       SLINE
    </AcesRecordName>
    <AcesRecordName default="true">
       FPA
    </AcesRecordName>
    <AcesRecordName >
       DYSELEV
    </AcesRecordName>
    <AcesRecordName >
       PARTS
    </AcesRecordName>
    <AcesRecordName default="true">
       ARPT
    </AcesRecordName>
    <AcesRecordName default="true">
       STARTE
    </AcesRecordName>
  </AcesRecords>    


More information about the jdom-interest mailing list