Thanks for the help. I must have made a mistake in my code. I re-ran the
program with the added option and got an error that it could not find
the file. I am running Eclipse and decided to put the DTD file in my
project directory and it worked.

thanks again for the help,

Damon

> -----Original Message-----
> From: Yana Kadiyska [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 06, 2005 11:32 AM
> To: [email protected]
> Subject: RE: Reading entity information from a DTD within the XMLBean
> 
> 
> I am running from IntelliJ, just because I have that setup 
> with all the
> libraries and handy. Here is the test that I ran:
> 
> public void testDTD()throws Exception{
>         String xml= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"
> standalone=\"no\"?>\n" +
>             "<!-- This is a comment after the first line-->" +
> 
>             " <!DOCTYPE csf-inputs SYSTEM \"foo.dtd\">\n" +
>             "<inputs>\n" +
>             "\t<id>&marketing_grp;</id>\n" +
>             "\t<address>342 Carlton Way</address>\n" +
>             "\n" +
>             "</inputs>";
>         XmlOptions opts = new XmlOptions();
>         opts.setLoadUseDefaultResolver();
>         XmlObject o= XmlObject.Factory.parse(xml, opts);
>         System.out.println(o.xmlText());
>     }
> 
> foo.dtd looks is a one-line file: <!ENTITY marketing_grp 
> "Donald Duck.">
> and is located in the directory where the test is run from (i.e. the
> intelliJ project directory)...But as I said, even if you have the file
> in the wrong place, the resolver should be complaining that it can't
> find the file...So it's a little weird that it's not.
> 
> Can you try getting the binary version of 2.0.0 (i.e. not the 
> beta) and
> see if that helps? If not, I'll get it and see if I can figure out
> what's happening for you -- I don't remember anyone fixing a 
> bug related
> to this so I'm really not sure why it doesn't work with your 
> version...
> 
> --Yana
> 
> 
> -----Original Message-----
> From: Jones, Damon [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, October 06, 2005 11:12 AM
> To: [email protected]
> Subject: RE: Reading entity information from a DTD within the XMLBean
> 
> I am using xmlbeans-2.0.0-beta1 (yes, I definitely need to upgrade). I
> could have the DTD file in the wrong directory. Right now it is in the
> same directory as the file that I am trying to open. The code for
> XMLBeans is in a different directory. How did you setup your test?
> 
> thanks,
> Damon
> 
> > -----Original Message-----
> > From: Yana Kadiyska [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, October 06, 2005 11:00 AM
> > To: [email protected]
> > Subject: RE: Reading entity information from a DTD within 
> the XMLBean
> > 
> > 
> > What version of XmlBeans are you using -- I ran your 
> example with the
> > latest version of the source from SVN and after setting the 
> > options like
> > you do, I get 1 of 2 results:
> > 
> > 1. The entity is resolved/expanded and all is well
> > 2. I get an error message that my_definitions.dtd is not 
> > found if I have
> > the file in the wrong directory.
> > 
> > But in either case, the resolver appears to at least be trying to
> > resolve the external DTD.
> > 
> > I would like to look further into why you're running into this issue
> > 
> > (Oh, the reason that it works when you have the entity 
> declared at the
> > start at the XML is that in that case there are no external 
> > enities/dtds
> > to be resolved...But you shouldn't have to change all of your
> > documents).
> > 
> > -Yana
> > 
> > -----Original Message-----
> > From: Jones, Damon [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, October 06, 2005 9:33 AM
> > To: [email protected]
> > Subject: RE: Reading entity information from a DTD within 
> the XMLBean
> > 
> > Thanks for your recommendations, but I am still having issues.
> > 
> > I tried setting the option: setLoadUseDefaultResolver()
> > 
> > --------------------------------------------
> > XmlOptions opts = new XmlOptions();
> > opts.setLoadUseDefaultResolver();
> > InputsDocument inputDoc = null;
> > try{
> >     inputDoc = InputsDocument.Factory.parse(file,opts);
> > }
> > ....
> > --------------------------------------------
> > 
> > and I still get the same error. I did read something about an
> > EntityResolver, but I don't quite understand the concept 
> and have not
> > found a good example of using them in XMLBeans.
> > 
> > I noticed when I change the XML to the following, it works:
> > 
> > ------------------------------------------------
> > <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> > <!-- This is a comment after the first line-->
> > <!DOCTYPE csf-inputs[
> >          <!ENTITY marketing_grp "My Marketing Group Inc.">
> > ]>
> > 
> > <inputs>
> >     <id>&marketing_grp;</id>
> >     <address>342 Carlton Way</address>
> >  
> > </inputs>
> > ------------------------------------------------
> > But I cannot change all of the XML documents that I have since the
> > entity value will change. I need to have access to the entity
> > descriptions in a separate local file.
> > 
> > Anymore ideas would be much appreciated.
> > 
> > Damon
> > 
> > > -----Original Message-----
> > > From: Yana Kadiyska [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, October 05, 2005 5:01 PM
> > > To: [email protected]
> > > Subject: RE: Reading entity information from a DTD within 
> > the XMLBean
> > > 
> > > 
> > > Try setting this option: setLoadUseDefaultResolver()
> > > 
> > > -----Original Message-----
> > > From: Jones, Damon [mailto:[EMAIL PROTECTED] 
> > > Sent: Wednesday, October 05, 2005 3:25 PM
> > > To: [email protected]
> > > Subject: Reading entity information from a DTD within the XMLBean
> > > 
> > > Hi,
> > > 
> > > I have XML documents which contain entities. The 
> definitions for the
> > > entities are within a DTD file that is in the same directory 
> > > as the XML
> > > file. When I try to read the following XML into my XMLBean:
> > > 
> > > --------------------------------------------------------------
> > > ----------
> > > -----------------------------------
> > > <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> > > <!-- This is a comment after the first line-->
> > > <!DOCTYPE csf-inputs SYSTEM "my_definitions.dtd">
> > > 
> > > <inputs>
> > >   <id>&marketing_grp;</id>
> > >   <address>342 Carlton Way</address>
> > > 
> > > </inputs>
> > > --------------------------------------------------------------
> > > ----------
> > > -----------------------------------
> > > 
> > > I get the following error:
> > > 
> > > 
> > > org.apache.xmlbeans.XmlException: d:\data\user101\My
> > > Documents\inputs_orig.xml:7: error: Reference to undefined entity:
> > > marketing_grp
> > >   at
> > > org.apache.xmlbeans.impl.newstore2.Locale$SaxLoader.load(Local
> > > e.java:278
> > > 8)
> > >   at
> > > org.apache.xmlbeans.impl.newstore2.Locale.parseToXmlObject(Loc
> > > ale.java:1
> > > 101)
> > >   at
> > > org.apache.xmlbeans.impl.newstore2.Locale.parseToXmlObject(Loc
> > > ale.java:1
> > > 094)
> > >   at
> > > org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(Sch
> > > emaTypeLoa
> > > derBase.java:334)
> > >   at
> > > org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(Sch
> > > emaTypeLoa
> > > derBase.java:241)
> > > 
> > > Am I referencing the DTD file in the wrong manner? Is there a 
> > > better way
> > > to do this.
> > > 
> > > thanks,
> > > Damon
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to