[jdom-interest] Double-linked vs Single-linked code submission

Brad Morgan Brad.Morgan at e-pubcorp.com
Thu Nov 30 09:43:07 PST 2000


I hope that James Strachan's code submission doesn't get lost in all the
discussions.

I think it has merit on its own because of the added value of the
double-linking.  I think this added value out weighs the added memory
required to implement it and I like to see the base JDOM have this
capability.

I liked the part about no user code changes required.

Brad Morgan
e-Publishing Corp.

Email: Brad.Morgan at e-pubcorp.com
Phone: (719)593-7377 x35
Fax: (719)593-2996

e-Publishing Corp. is a BroadVision company
URL: http://www.e-pubcorp.com

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Allen, Aristotle B
(Ari)
Sent: Thursday, November 30, 2000 9:45 AM
To: 'jdom-interest at jdom.org'
Subject: [jdom-interest] More Exceptions


When I try to build a validating sax parser I get an exception thrown and
I'm not sure why
Can anyone help me with this one?  I really like JDOM much better than my
other options, but I'm running low on time.

my code:
  SAXBuilder builder = new SAXBuilder(debug);
  Document doc = builder.build(bais);  <-- my exception is thrown here
  Element root = doc.getRootElement();
  String option = root.getChild("ACTION").getAttribute("option").getValue();
<--when I don't validate I get an exception here

Can JDOM handle attributes at this point?  Would I be better off using a
DOMAdapter?

my dtd looks like this:
<!ELEMENT REQUEST ( TIMESTAMP, ACTION, DATABLOCK ) >
  <!ELEMENT TIMESTAMP ( #PCDATA ) >
  <!ELEMENT ACTION ( #PCDATA ) >
  <!ATTLIST ACTION option NMTOKEN #REQUIRED >
  <!ELEMENT DATABLOCK ( PARTID ) >
    <!ELEMENT PARTID ( PACK_ID, OPERATOR, TESTSET, STATUS, QTY, CODE,
METAL_PACK ) >
    <!ATTLIST PARTID name NMTOKEN #REQUIRED >
      <!ELEMENT PACK_ID ( #PCDATA ) >
      <!ELEMENT OPERATOR ( #PCDATA ) >
      <!ELEMENT TESTSET ( #PCDATA ) >
      <!ELEMENT STATUS ( #PCDATA ) >
      <!ELEMENT QTY ( #PCDATA ) >
      <!ELEMENT CODE ( #PCDATA ) >
      <!ELEMENT METAL_PACK ( #PCDATA ) >

and my input stream consists of this:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE xml SYSTEM
"http://mrc3k.micro.lucent.com/~aballen/CreatePack-w.dtd">

  <REQUEST>
    <TIMESTAMP>2000/10/07 15:14:09</TIMESTAMP>
    <ACTION option="w">CreatePack</ACTION>
    <DATABLOCK>
      <PARTID name="EX1234">
        <PACK_ID>EX1234</PACK_ID>
        <OPERATOR>AA</OPERATOR>
        <TESTSET>ab16355</TESTSET>
        <STATUS>PASS/AB</STATUS>
        <QTY>50</QTY>
        <CODE>361</CODE>
        <METAL_PACK>12345678</METAL_PACK>
      </PARTID>
    </DATABLOCK>
  </REQUEST>



org.jdom.JDOMExceptionMessage: Document root element "REQUEST", must match
DOCTYPE root "xml".: Error on line 1: Document root element "REQUEST", must
match DOCTYPE root "xml".org.jdom.JDOMException: Document root element
"REQUEST", must match DOCTYPE root "xml".: Error on line 1: Document root
element "REQUEST", must match DOCTYPE root "xml".
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:315)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:337)
	at
com.lucent.mrc.opto.dataserver.modules.CreatePack.doTrans(CreatePack.java:75
)
	at
com.lucent.mrc.opto.dataserver.modules.CreatePack.execute(CreatePack.java:56
)
	at
com.lucent.mrc.opto.dataserver.ThreadedHandler._$2476(ThreadedHandler.java:8
4)
	at
com.lucent.mrc.opto.dataserver.ThreadedHandler.run(ThreadedHandler.java:61)
Root cause: org.jdom.JDOMException: Error on line 1: Document root element
"REQUEST", must match DOCTYPE root "xml".
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:316)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:337)
	at
com.lucent.mrc.opto.dataserver.modules.CreatePack.doTrans(CreatePack.java:75
)
	at
com.lucent.mrc.opto.dataserver.modules.CreatePack.execute(CreatePack.java:56
)
	at
com.lucent.mrc.opto.dataserver.ThreadedHandler._$2476(ThreadedHandler.java:8
4)
	at
com.lucent.mrc.opto.dataserver.ThreadedHandler.run(ThreadedHandler.java:61)

Aristotle B. Allen
Software Engineer
Computer Integrated Manufacturing
Manufacturing Realization Center
Optoelectronics
m i c r o e l e c t r o n i c s   g r o u p
Lucent Technologies O
 Bell Labs Innovations

* aballen at lucent.com
* 610.391.3845(phone)
* 610.391.3845 (fax)


_______________________________________________
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