[jdom-interest] Problems Creating a Document

Hunter Hillegas timebomb at west.net
Thu Nov 29 00:04:58 PST 2001


Hello. I am somewhat new to JDOM. I have used it several times for small
projects but now I am trying to use it in a J2EE project and I'm having some
trouble...

Basically I am getting this exception:

org.jdom.JDOMException: Error on line 1: Document root element is missing.

This is how I'm setting up my JDOM session:

InputStream in = urlCon.getInputStream();
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(in);
Element docRoot = doc.getRootElement(); //get the root

I have verified that the InputStream does seem to have access to valid XML
that looks like this:

<?xml version="1.0"?>
<RatingServiceSelectionResponse>
  <Response>
    <TransactionReference>
      <CustomerContext>Rating and Service</CustomerContext>
      <XpciVersion>1.0001</XpciVersion>
    </TransactionReference>
    <ResponseStatusCode>1</ResponseStatusCode>
    <ResponseStatusDescription>Success</ResponseStatusDescription>
  </Response>
  <RatedShipment>
    <Service>
      <Code>01</Code>
    </Service>
    <BillingWeight>
      <UnitOfMeasurement>
        <Code>LBS</Code>
      </UnitOfMeasurement>
      <Weight>2.0</Weight>
    </BillingWeight>
... There is a lot more...

I'm trying to use this to communicate with UPS to get shipping info...

So, I have pretty much no idea how to debug this... Any suggestions are
appreciated.

Hunter




More information about the jdom-interest mailing list