You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by ok <18...@novagate.com> on 2000/08/10 23:29:39 UTC

including

I have a large XML document that I want to split up into separate smaller files
then just have one main file which essentially "includes" all the others ones.
Just like server sides includes on a webserver.

Such that the parser will properly read the one XML file and in-turn get all
the included ones as well. 

Is this possible?

Re: including

Posted by ok <18...@novagate.com>.
thanks I pull it from CVS, and regarding item #2, yep , dumb point! ;)

On Fri, 11 Aug 2000, you wrote:
> ok wrote:
> > 
> > great! that works, thanks.
> > 
> > Here are 2 additional questions.
> > 
> > 1. <!ENTITY part1 SYSTEM "part1.xml">
> > 
> >    Lets say part1.xml is located relative to the main XML file "including" it.
> > 
> >    For instance, I have a servlet which parses /home/root.xml
> >     root.xml "includes" /home/root/dir1/part1.xml
> >    I have noticed that the parser wants a full path to it.
> 
> The piece of code in the parser that handles this had a few bugs. I
> checked in a couple of days ago a new version which fixes them. You
> should try with the latest version from CVS.
> You should be able to use relative paths anywhere you want. Just keep in
> mind that they have to be relative to where the entity is defined. Not
> where it is used.
> 
> > 2. I noticed the parser does not like recusive entity references.
> 
> Indeed, it doesn't. What else would you expect?
> -- 
> Arnaud  Le Hors - IBM Cupertino, XML Technology Group
> 
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

Re: including

Posted by Arnaud Le Hors <le...@us.ibm.com>.
ok wrote:
> 
> great! that works, thanks.
> 
> Here are 2 additional questions.
> 
> 1. <!ENTITY part1 SYSTEM "part1.xml">
> 
>    Lets say part1.xml is located relative to the main XML file "including" it.
> 
>    For instance, I have a servlet which parses /home/root.xml
>     root.xml "includes" /home/root/dir1/part1.xml
>    I have noticed that the parser wants a full path to it.

The piece of code in the parser that handles this had a few bugs. I
checked in a couple of days ago a new version which fixes them. You
should try with the latest version from CVS.
You should be able to use relative paths anywhere you want. Just keep in
mind that they have to be relative to where the entity is defined. Not
where it is used.

> 2. I noticed the parser does not like recusive entity references.

Indeed, it doesn't. What else would you expect?
-- 
Arnaud  Le Hors - IBM Cupertino, XML Technology Group

Re: including

Posted by "Thomas B. Passin" <tp...@mitretek.org>.
Aside from recursive references, remember that using an entity this way
simply inserts the replacement text defined for the entity.  You aren't
allowed to have another DOCTYPE declaration in the body of an xml
document, so your example wouldn't work right even if the entites in the
included fragment were declared with different names.

If you have to include parts of another complete XML document (with an
included DOCTYPE declaration), you can use the method I mentioned
earlier using xslt.

Tom Passin

"ok" <18...@novagate.com> wrote -

> ...
> 2. I noticed the parser does not like recusive entity references. For
example,
> if part1.xml below had this is it:


On Fri, 11 Aug 2000, you wrote:
> Here is an example using the internal subset:
>
> <?xml version="1.0" ?>
> <!DOCTYPE foo [
> <!ENTITY part1 SYSTEM "part1.xml">
> <!ENTITY part2 SYSTEM "part2.xml">
> ]>
> <foo>
> &part1;
> &part2;
> </foo>
> --



Re: including

Posted by ok <18...@novagate.com>.
great! that works, thanks.

Here are 2 additional questions.

1. <!ENTITY part1 SYSTEM "part1.xml">
   
   Lets say part1.xml is located relative to the main XML file "including" it. 
    
   For instance, I have a servlet which parses /home/root.xml 
    root.xml "includes" /home/root/dir1/part1.xml 
   I have noticed that the parser wants a full path to it. 

2. I noticed the parser does not like recusive entity references. For example,
if part1.xml below had this is it:


On Fri, 11 Aug 2000, you wrote:
> Here is an example using the internal subset:
> 
> <?xml version="1.0" ?>
> <!DOCTYPE foo [
> <!ENTITY part1 SYSTEM "part1.xml">
> <!ENTITY part2 SYSTEM "part2.xml">
> ]>
> <foo>
> &part1;
> &part2;
> </foo>
> -- 
> Arnaud  Le Hors - IBM Cupertino, XML Technology Group
> 
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

Re: including

Posted by ok <18...@novagate.com>.
great! that works, thanks.

Here are 2 additional questions.

1. <!ENTITY part1 SYSTEM "part1.xml">
   
   Lets say part1.xml is located relative to the main XML file "including" it. 
    
   For instance, I have a servlet which parses /home/root.xml 
    root.xml "includes" /home/root/dir1/part1.xml 
   I have noticed that the parser wants a full path to it. 

2. I noticed the parser does not like recusive entity references. For example,
if part1.xml below had this is it:

<!DOCTYPE foo [
<!ENTITY part1_sub SYSTEM "part1_sub.xml">
]>

It chokes on this.



On Fri, 11 Aug 2000, you wrote:
> Here is an example using the internal subset:
> 
> <?xml version="1.0" ?>
> <!DOCTYPE foo [
> <!ENTITY part1 SYSTEM "part1.xml">
> <!ENTITY part2 SYSTEM "part2.xml">
> ]>
> <foo>
> &part1;
> &part2;
> </foo>
> -- 
> Arnaud  Le Hors - IBM Cupertino, XML Technology Group
> 
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

Re: including

Posted by "Thomas B. Passin" <tp...@mitretek.org>.
Peter Levine asked about CDATA sections in xslt output.

Yes, you tell the xsl:output method that certain elements should be
output as CDATA.  From the XSLT Rec:

"<!-- Category: top-level-element -->
<xsl:output
  method = "xml" | "html" | "text" | qname-but-not-ncname
  version = nmtoken
  encoding = string
  omit-xml-declaration = "yes" | "no"
  standalone = "yes" | "no"
  doctype-public = string
  doctype-system = string
  cdata-section-elements = qnames
  indent = "yes" | "no"
  media-type = string />
...
cdata-section-elements specifies a list of the names of elements whose
text node children should be output using CDATA sections"


> I would like to create an XML file via XSLT that contains within it
> elements that I can copy from a source XML file (which describe a PDF
> files) as as well as the PDF file itself (as PDF). Among other
problems
> I'm having trouble inserting a literal <![CDATA[... ]]> tag in this
new
> XML file. Is what I attempting possible?
>



Re: including

Posted by Peter Levine <pl...@intraware.com>.
Hi,

I would like to create an XML file via XSLT that contains within it
elements that I can copy from a source XML file (which describe a PDF
files) as as well as the PDF file itself (as PDF). Among other problems
I'm having trouble inserting a literal <![CDATA[... ]]> tag in this new
XML file. Is what I attempting possible?

Any help much appreciated.
Thanks,
Pete

Arnaud Le Hors wrote:

> Here is an example using the internal subset:
>
> <?xml version="1.0" ?>
> <!DOCTYPE foo [
> <!ENTITY part1 SYSTEM "part1.xml">
> <!ENTITY part2 SYSTEM "part2.xml">
> ]>
> <foo>
> &part1;
> &part2;
> </foo>
> --
> Arnaud  Le Hors - IBM Cupertino, XML Technology Group
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

--
Peter Levine
Senior Software Engineer
plevine@intraware.com http://www.intraware.com
phone: (510) 597-4955

Intraware...Control Your Technology



Re: XMLSerializer

Posted by Joe Sabu <Jo...@dothill.com>.
Hello,
    I found org.apache.xerces.dom.DocumentTypeImpl.setInternalSubset, which
might do the trick. But it is tagged as  NON-DOM. Now, what is the future of
a NON-DOM implementation like that? Will it disappear in the future
releases? Is there anything standard that I can do to get this
accomplished?I would think it is a very common requirement for any
application that uses XML as a inter-process data transfer mechanism to be
able to introduce internal DTD subset into the XML data stream. Any ideas?

Thanks
Joe Sabu
----- Original Message -----
From: "Joe Sabu" <Jo...@dothill.com>
To: <ge...@xml.apache.org>
Sent: Wednesday, August 23, 2000 10:23 AM
Subject: XMLSerializer


Hello,

    How do I include a internal DTD subset in the XML stream I generate
using XMLSerializer? I'm attempting to generate a DOM tree in memory, from
scratch,  and then send it over to another process as an XML stream. I would
like the receiver to do validation on the  stream, but does not want every
receiver to have a copy of the DTD file; hence I prefer to include the
grammar in the XML stream itself.

    Preferably, the server can accept a DTD file ame, and should be able to
dump its contents as the internal DTD into the serialized stream. Any ideas?

Thanks
Joe Sabu


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org




XMLSerializer

Posted by Joe Sabu <Jo...@dothill.com>.
Hello,

    How do I include a internal DTD subset in the XML stream I generate
using XMLSerializer? I'm attempting to generate a DOM tree in memory, from
scratch,  and then send it over to another process as an XML stream. I would
like the receiver to do validation on the  stream, but does not want every
receiver to have a copy of the DTD file; hence I prefer to include the
grammar in the XML stream itself.

    Preferably, the server can accept a DTD file ame, and should be able to
dump its contents as the internal DTD into the serialized stream. Any ideas?

Thanks
Joe Sabu


Re: including

Posted by Arnaud Le Hors <le...@us.ibm.com>.
Here is an example using the internal subset:

<?xml version="1.0" ?>
<!DOCTYPE foo [
<!ENTITY part1 SYSTEM "part1.xml">
<!ENTITY part2 SYSTEM "part2.xml">
]>
<foo>
&part1;
&part2;
</foo>
-- 
Arnaud  Le Hors - IBM Cupertino, XML Technology Group

Re: including

Posted by ok <18...@novagate.com>.
can someone send me a short example of this?

On Fri, 11 Aug 2000, you wrote:
> "Thomas B. Passin" wrote:
> > 1) Declare an entity for each subdocument in the DTD for the 
> > main one. Then insert those entities into the main document at 
> > the right locations.  The parser will bring in the subdocuments.
> 
> I like this method because you can still process the document
> using SAX without needing to construct the entire tree. This
> is especially crucial as the number and size of the included
> documents gets larger.
> 
> -- 
> Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org
> 
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

Re: including

Posted by Andy Clark <an...@apache.org>.
"Thomas B. Passin" wrote:
> 1) Declare an entity for each subdocument in the DTD for the 
> main one. Then insert those entities into the main document at 
> the right locations.  The parser will bring in the subdocuments.

I like this method because you can still process the document
using SAX without needing to construct the entire tree. This
is especially crucial as the number and size of the included
documents gets larger.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

Re: including

Posted by "Thomas B. Passin" <tp...@mitretek.org>.
There are several approaches that aren't too hard,  just using xml
itself.

1) Declare an entity for each subdocument in the DTD for the main one.
Then insert those entities into the main document at the right
locations.  The parser will bring in the subdocuments.

2) Write an xsl stylesheet that uses the document() function to bring in
the subdocuments.  The stylesheet can take care of inserting them in the
right places.  If you do it this way, you can write a configuration xml
file that the stylesheet can use to know which subdocuments to use.

Tom Passin

----- Original Message -----
From: "ok" <18...@novagate.com>
To: <ge...@xml.apache.org>
Sent: Thursday, August 10, 2000 5:29 PM
Subject: including


I have a large XML document that I want to split up into separate
smaller files
then just have one main file which essentially "includes" all the others
ones.
Just like server sides includes on a webserver.

Such that the parser will properly read the one XML file and in-turn get
all
the included ones as well.

Is this possible?