[jdom-interest] Problems Creating a Document

Godbey, David DAVID.J.GODBEY at saic.com
Thu Nov 29 05:12:35 PST 2001


Hunter,
I saw this error message just yesterday. I fixed it by adding on the output
stream side 
resObj.setContentType("text/xml; encoding=UTF-8"); where resObj is
instantiated from the HttpServletResponse class. I hope this helps.
Dave

-----Original Message-----
From: Hunter Hillegas [mailto:timebomb at west.net]
Sent: Thursday, November 29, 2001 3:05 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Problems Creating a Document


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

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list