<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2314.1000" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Hi There,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>This is my first posting to XML-Dev. Great mailing
list. I have been using the IBM XML4J Parser (v2.0.9) class for just a short
while. The client has requested that we inline the DTD's instead of making them
external.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I resorted to the following sample
code,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Parser p
= new Parser(getDefaultDTDPath(), this,
null);<BR> DTD aDTD = null
;<BR> try
{<BR>
BufferedReader b = new BufferedReader(new FileReader("SampleDTD.dtd"))
;<BR> aDTD =
p.readDTDStream(b)
;<BR>
b.close() ;<BR> } catch (IOException
ex) { }<BR></FONT><FONT face=Arial
size=2>
aDTD.setName("CustomerDataResponse")
;<BR> StringWriter aWriter = new
StringWriter();<BR> try
{<BR>
aDTD.print(aWriter) ;<BR> } catch
(IOException ex) {}<BR>
System.out.println(aWriter.toString()) ;<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Used on the following XML file (with inline
DTD),</FONT></DIV><FONT size=2>
<P align=left><FONT face=Arial><?xml version="1.0"
encoding="UTF-8"?><BR><!DOCTYPE CustomerDataResponse [<BR><!ELEMENT
CustomerDataResponse (pass|fail)><BR><!ATTLIST CustomerDataResponse
accountNumber CDATA #REQUIRED><BR><!ELEMENT pass
(question*)><BR><!ELEMENT question (#PCDATA)><BR><!ATTLIST question
questionId ID
#REQUIRED<BR>
answers CDATA #IMPLIED><BR><!ELEMENT fail (reason)><BR><!ELEMENT
reason (#PCDATA)><BR>]><BR></FONT></P></FONT><FONT size=2></FONT>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Produces the results,</FONT></DIV>
<DIV><FONT face=Arial size=2>
<P align=left><FONT face=Arial><!DOCTYPE CustomerDataResponse
[<BR><!ATTLIST CustomerDataResponse accountNumber CDATA
#REQUIRED><BR><!ELEMENT pass (question*)><BR><!ELEMENT question
(#PCDATA)><BR><!ATTLIST question questionId ID
#REQUIRED<BR>
answers CDATA #IMPLIED><BR><!ELEMENT fail (reason)><BR><!ELEMENT
reason (#PCDATA)><BR>]><BR></FONT></P></FONT></DIV>
<DIV><FONT face=Arial size=2>Note that there is no line,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><!ELEMENT CustomerDataResponse
(pass|fail)></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Which totally invalidates the DTD.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Now the interesting thing is that if I duplicate
this line in the original DTD, i.e.,</FONT></DIV>
<DIV><FONT face=Arial size=2>
<P align=left><FONT face=Arial><?xml version="1.0"
encoding="UTF-8"?><BR><!DOCTYPE CustomerDataResponse [<BR><!ELEMENT
CustomerDataResponse (pass|fail)><BR><!ELEMENT CustomerDataResponse
(pass|fail)><BR><!ATTLIST CustomerDataResponse accountNumber CDATA
#REQUIRED><BR><!ELEMENT pass (question*)><BR><!ELEMENT question
(#PCDATA)><BR><!ATTLIST question questionId ID
#REQUIRED<BR>
answers CDATA #IMPLIED><BR><!ELEMENT fail (reason)><BR><!ELEMENT
reason (#PCDATA)><BR>]><BR></FONT></P></FONT></DIV>
<DIV><FONT face=Arial size=2>It produces the desired results!! </FONT><FONT
face=Arial size=2>Anyone found similiar results? I can't think of anything that
I'm doing wrong.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2> </DIV></FONT>
<DIV><FONT face=Arial size=2>Carl Schei<BR>Catapult Technology, Inc.<BR>(630)
515-3670 phone<BR><A
href="mailto:carl@catapultt.com">carl@catapultt.com</A><BR><A
href="http://www.catapultt.com/">http://www.catapultt.com/</A><BR></FONT></DIV></BODY></HTML>