[jdom-interest] Embedded DTD

Stratton, Jason jstratton at telegea.com
Wed Oct 25 12:18:46 PDT 2000


Hi all,
I have an XML string that I use JDOM to parse with Xerces' SAX parser.
Without doing anything else to it, I generate an XML string from the JDOM
document.

The original XML string had an embedded DTD. The output XML string is
stripped of the embedded DTD and all of the XML element values.

If I remove the embedded DTD, the generated XML string has all of the
element values, as expected.

The design decision to use the embedded DTD was not mine and it is possible
that I can convince the powers to use an external DTD, but I would like to
understand what is going on.

Is this a Xerces thing or a JDOM thing? Is it a bug? Any ideas on how I
should proceed?

Thank you.
Jason Stratton
jstratton at telegea.com

PS: Here is the XML:

Input:
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE SHIPREQUESTDOC [
<!ELEMENT SHIPREQUESTDOC (TRANSACTION+)>
<!ELEMENT TRANSACTION (CUSTOMERID,ORDERID, SHIPINFO, ORDERINFO+,
RESPONSELIST*)>
<!ATTLIST TRANSACTION ID ID #REQUIRED>
<!ELEMENT CUSTOMERID (#PCDATA)>
<!ELEMENT ORDERID (#PCDATA)>
<!ELEMENT SHIPINFO
(FIRSTNAME,LASTNAME,ADDRESSONE,ADDRESSTWO,CITY,STATE,ZIP,SHIPMETHOD)>
<!ELEMENT FIRSTNAME (#PCDATA)>
<!ELEMENT LASTNAME (#PCDATA)>
<!ELEMENT ADDRESSONE (#PCDATA)>
<!ELEMENT ADDRESSTWO (#PCDATA)>
<!ELEMENT CITY (#PCDATA)>
<!ELEMENT STATE (#PCDATA)>
<!ELEMENT ZIP (#PCDATA)>
<!ELEMENT SHIPMETHOD (#PCDATA)>
<!ELEMENT ORDERINFO ( ORDERID, PRODUCTID, AMOUNT )>
<!ELEMENT PRODUCTID (#PCDATA)>
<!ELEMENT AMOUNT (#PCDATA)>
<!ELEMENT RESPONSELIST (RESPONSE*)>
<!ELEMENT RESPONSE (TRANSACTIONID,RETURNCODE,RETURNMESSAGE,CONTROLID)>
<!ELEMENT TRANSACTIONID (#PCDATA)>
<!ELEMENT RETURNCODE (#PCDATA)>
<!ELEMENT RETURNMESSAGE (#PCDATA)>
<!ELEMENT CONTROLID (#PCDATA)>]>
<SHIPREQUESTDOC>
 <TRANSACTION ID="138">
  <CUSTOMERID>TELEGEA</CUSTOMERID>
  <ORDERID>OrderID</ORDERID>
  <SHIPINFO>
   <FIRSTNAME>FirstName</FIRSTNAME>
   <LASTNAME>LastName</LASTNAME>
   <ADDRESSONE>Address1</ADDRESSONE>
   <ADDRESSTWO>Address2</ADDRESSTWO>
   <CITY>City</CITY>
   <STATE>State</STATE>
   <ZIP>Zip</ZIP>
   <SHIPMETHOD>ShipMethod</SHIPMETHOD>
  </SHIPINFO>
  <ORDERINFO>
   <ORDERID>ProductID</ORDERID>
   <PRODUCTID>ProductOrderID</PRODUCTID>
   <AMOUNT>ProductAmount</AMOUNT>
  </ORDERINFO>
  <ORDERINFO>
   <ORDERID>PrepaidID</ORDERID>
   <PRODUCTID>PrepaidOrderID</PRODUCTID>
   <AMOUNT>PrepaidAmount</AMOUNT>
  </ORDERINFO>
 </TRANSACTION>
</SHIPREQUESTDOC>


Output:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SHIPREQUESTDOC>



<SHIPREQUESTDOC>
<TRANSACTION ID="138">
<CUSTOMERID />
<ORDERID />
<SHIPINFO>
<FIRSTNAME />
<LASTNAME />
<ADDRESSONE />
<ADDRESSTWO />
<CITY />
<STATE />
<ZIP />
<SHIPMETHOD />
</SHIPINFO>
<ORDERINFO>
<ORDERID />
<PRODUCTID />
<AMOUNT />
</ORDERINFO>
<ORDERINFO>
<ORDERID />
<PRODUCTID />
<AMOUNT />
</ORDERINFO>
</TRANSACTION>
</SHIPREQUESTDOC>



More information about the jdom-interest mailing list