[jdom-interest] Embedded DTDs

Adrian Sutton A.Sutton at sqi.gu.edu.au
Mon Jan 14 00:10:15 PST 2002


Hi all,
I'm very new to XML (but quite experienced with Java) and am currently
converting an application over to using XML through JDOM with pretty much
any data stored within the application stored as a JDOM Element (usually by
extending the class) so that it can work in a standalone or client-server
fashion.  Because of this, XML is used both when communicating with the
server and when saving to a file.

The problem I am having is that if I save the data out to a file and specify
a URL for the DTD, internet access is required to be able to open the file.
Referring to the DTD on the local system won't work either because the file
needs to be able to both be moved around the file system and shared between
computers.  The best solution I can come up with is to embed the DTD into
the XML as I believe is possible according to the XML spec.  This, however,
doesn't seem to be possible using JDOM.  Any suggestions?  I like the
validation aspects of DTDs so would like to continue using one.

Thanks in advance,

Adrian Sutton

**************************************************************
Email: A.Sutton at sqi.gu.edu.au            Ph: 3411 4361
History teaches us that men and nations behave wisely
once they have exhausted all other alternatives.
 -- Abba Eban
**************************************************************
----- Original Message -----
From: <jdom-interest-admin at jdom.org>
To: <jdom-interest at jdom.org>
Sent: Monday, January 14, 2002 5:38 PM
Subject: jdom-interest digest, Vol 1 #815 - 3 msgs


> Send jdom-interest mailing list submissions to
> jdom-interest at jdom.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.denveronline.net/mailman/listinfo/jdom-interest
> or, via email, send a message with subject or body 'help' to
> jdom-interest-request at jdom.org
>
> You can reach the person managing the list at
> jdom-interest-admin at jdom.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of jdom-interest digest..."
>
>
> Today's Topics:
>
>    1. Re: Beta 8 (Paul Libbrecht)
>    2. Help! SAXParserFactory causing Security exception in Microsoft Java
VM (Jake Latham)
>    3. Reading XML with JDOM problem (Patrick Hogarty)
>
> --__--__--
>
> Message: 1
> Date: Thu, 10 Jan 2002 21:38:48 +0100
> Subject: Re: [jdom-interest] Beta 8
> Cc: jdom-interest at jdom.org
> To: phil at triloggroup.com
> From: Paul Libbrecht <paul at ags.uni-sb.de>
>
> Dare I suggest either of the following:
>
> -> document access to jdom-wip and encourage folks discussing this
> -> make a release candidate (or beta-beta) so that everyone can enjoy
> this and precisely test...
>
> I'd be more than interested on testing such but never really dare keep
> working with jdom-wip...
>
> Paul
>
>
>
> On Mercredi, janvier 9, 2002, at 05:04 , phil at triloggroup.com wrote:
>
> > I read that Beta 8 is scheduled before the 14th of January.
> >
> > I'm really afraid about that because we currently invested on JDOM and
> > I also convainced some partners to do the same
> > choice. Unfortunatly, we now need to change a lot of things because of
> > Text. And these changes are not trivial to find
> > because they are maily made of instanceof statements and casts. So, it
> > won't be detected by the compiler.
> > I'm sure than many other compagnies invested on JDOM and have to deal
> > with the same situation. This is also true for all
> > the peripheral tool, like Jaxen...
> >
> > I know that we were working with a beta but, PLEASE, do not publish
> > that or I think you'll kill the product, by
> > thwarting all the early adopters and tool providers.
> >
> > Phil.
> > Trilog Group Software.
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-
> > interest/youraddr at yourhost.com
> >
>
>
> --__--__--
>
> Message: 2
> Reply-To: "Jake Latham" <mrjones at holly.colostate.edu>
> From: "Jake Latham" <mrjones at holly.colostate.edu>
> To: <jdom-interest at jdom.org>
> Date: Thu, 10 Jan 2002 14:59:15 -0700
> Subject: [jdom-interest] Help! SAXParserFactory causing Security exception
in Microsoft Java VM
>
> Hiya all, I'm really hoping you can offer me a hand with this problem.
>
> I'm having a problem with SAXParserFactory causing a security exception in
> Microsoft Internet Explorer, using JDOM b7.
>
> here is the error string it spits out:
>
>
String...com.ms.security.SecurityExceptionEx[javax/xml/parsers/SAXParserFact
> ory.newInstance]: Unable to access system property:
> javax.xml.parsers.SAXParserFactory
>  at com/ms/security/permissions/PropertyPermission.check
> (PropertyPermission.java)
>  at com/ms/security/PolicyEngine.shallowCheck (PolicyEngine.java)
>  at com/ms/security/PolicyEngine.checkCallersPermission
(PolicyEngine.java)
>  at com/ms/security/StandardSecurityManager.chk
> (StandardSecurityManager.java)
>  at com/ms/security/StandardSecurityManager.checkPropertyAccess
> (StandardSecurityManager.java)
>  at java/lang/System.getProperty (System.java)
>  at javax/xml/parsers/SAXParserFactory.newInstance
> (SAXParserFactory.java:139)
>  at java/lang/reflect/Method.invoke (Method.java)
>  at org/jdom/input/SAXBuilder.createParser (SAXBuilder.java)
>  at org/jdom/input/SAXBuilder.build (SAXBuilder.java)
>  at org/jdom/input/SAXBuilder.build (SAXBuilder.java)
>  at aim/AIMPanel.parseXML (AIMPanel.java:673)
>  at aim/AIMPanel.serverCall (AIMPanel.java:486)
>  at aim/LogicalAIM.<init> (LogicalAIM.java:62)
>  at aim/AIMPanel.customInitialize (AIMPanel.java:1595)
>  at shout3d/Shout3DPanel.n (Shout3DPanel.java)
>  at shout3d/Shout3DPanel.run (Shout3DPanel.java)
>  at java/lang/Thread.run (Thread.java)
>
> Using Microsoft's 5.0.0.3802 VM, this error results in a NullPointer
> Exception further down, causing the app to quit.
>
> in 5.0.0.3310, it reports the error but continues to run.
>
> in 5.0.0.3234, no errors are reported at all.
>
> Do you guys have any idea what's going on and why, and what I might be
able
> to do to correct this?
>
> Any help is greatly appreciated...
>
> -J
>
>
> --__--__--
>
> Message: 3
> From: "Patrick Hogarty" <hogartyp at aldercapital.com>
> To: <jdom-interest at jdom.org>
> Date: Fri, 11 Jan 2002 11:22:57 -0000
> Subject: [jdom-interest] Reading XML with JDOM problem
>
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0038_01C19A92.520904B0
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Hello,
>
> I have an xml doc eg:
> - <report>
> - <sub_report>
>   <date required=3D"Yes">Friday, January 11, 2002(0830)</date>=20
>   <heading>Report BLAH</heading>=20
> - <sub_heading>
>   <sub_heading_name>Customer</sub_heading_name>=20
>   </sub_heading>
> - <sub_heading>
>   <sub_heading_name>Number</sub_heading_name>=20
>   </sub_heading>
> - <sub_heading>
>   <sub_heading_name>Counterparty</sub_heading_name>=20
>   </sub_heading>
> - <data_row>
>   <data>BLAH</data>=20
>   <data>100</data>=20
>   <data>AAA Ltd.</data>=20
>   </data_row>
> - <data_row>
> ...
>   </data_row>
> </sub_report>
> <sub_report>
> ...
> </sub_report>
> ...
> </report>
>
> So each report has a sub_report. The problem I am getting is that when I =
> use Jdom to extract the data from the xml doc, it looks at the first =
> sub_report it meets and proceeds to parse though it. Once finished it =
> comes out, sees "sub_report" again and parses the same sub_report it =
> just came from again, and not going on to the next one!
>
> I realise I could make matters easier by labeling the sub_report like =
> such, sub_report1, sub_report2, sub_report3... but for other reasons =
> (XSLT hic-cups) I would rather keep it the way it is.
>
> If anyone has used Jdom extensively and perhaps has an answer to making =
> it skip over roots it has done before with the same name then please let =
> me know.
>
> Thanks in advance!
>
> Regards
>
> Patrick
>
> ------=_NextPart_000_0038_01C19A92.520904B0
> Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content=3D"text/html; charset=3Diso-8859-1" =
> http-equiv=3DContent-Type>
> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>I have an xml doc eg:<BR>- =
> &lt;report&gt;<BR>-=20
> &lt;sub_report&gt;<BR>&nbsp; &lt;date required=3D"Yes"&gt;Friday, =
> January 11,=20
> 2002(0830)&lt;/date&gt; <BR>&nbsp; &lt;heading&gt;Report =
> BLAH&lt;/heading&gt;=20
> <BR>- &lt;sub_heading&gt;<BR>&nbsp;=20
> &lt;sub_heading_name&gt;Customer&lt;/sub_heading_name&gt; <BR>&nbsp;=20
> &lt;/sub_heading&gt;<BR>- &lt;sub_heading&gt;<BR>&nbsp;=20
> &lt;sub_heading_name&gt;Number&lt;/sub_heading_name&gt; <BR>&nbsp;=20
> &lt;/sub_heading&gt;<BR>- &lt;sub_heading&gt;<BR>&nbsp;=20
> &lt;sub_heading_name&gt;Counterparty&lt;/sub_heading_name&gt; <BR>&nbsp; =
>
> &lt;/sub_heading&gt;<BR>- &lt;data_row&gt;<BR>&nbsp;=20
> &lt;data&gt;BLAH&lt;/data&gt; <BR>&nbsp; &lt;data&gt;100&lt;/data&gt; =
> <BR>&nbsp;=20
> &lt;data&gt;AAA Ltd.&lt;/data&gt; <BR>&nbsp; &lt;/data_row&gt;<BR>-=20
> &lt;data_row&gt;<BR>...<BR>&nbsp;=20
> &lt;/data_row&gt;<BR>&lt;/sub_report&gt;<BR>&lt;sub_report&gt;<BR>...<BR>=
> &lt;/sub_report&gt;<BR>...<BR>&lt;/report&gt;</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>So each report has a sub_report. The =
> problem I am=20
> getting is that when I use Jdom to extract the data from the xml doc, it =
> looks=20
> at the first sub_report it meets and proceeds to parse though it. Once =
> finished=20
> it comes out, sees "sub_report" again and parses the same sub_report it =
> just=20
> came from again, and not going on to the next one!</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>I realise I could make matters easier =
> by labeling=20
> the sub_report like such, sub_report1, sub_report2, sub_report3... but =
> for other=20
> reasons (XSLT hic-cups) I would rather keep it the way it =
> is.</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>If anyone has used Jdom extensively and =
> perhaps has=20
> an answer to making it skip over roots it has done before with the same =
> name=20
> then please let me know.</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>Thanks in advance!</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>Regards</FONT></DIV>
> <DIV>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>Patrick</FONT></DIV></BODY></HTML>
>
> ------=_NextPart_000_0038_01C19A92.520904B0--
>
>
>
>
> --__--__--
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>
> End of jdom-interest Digest
>





More information about the jdom-interest mailing list