You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Neal Ward <Ne...@openwave.com> on 2001/03/03 10:38:02 UTC

Entity inclusion and Xerces

I have a DTD which includes a line of this format:

<!ENTITY % DTD_TO_INCLUDE SYSTEM "OtherDTD.dtd">
%DTD_TO_INCLUDE;

This line is intended to read a second DTD into the first and expand it.

When I parse a document against the first DTD using Xerces it throws an
error at the above line saying:

"Recursive entity expansion".

Does anyone know if Xerces supports this type of entity inclusion and,
if so, do I need to set any parameters to make it parse properly?

Any help would be appreciated.

Thanks,
    Neal Ward





Re: Entity inclusion and Xerces

Posted by Radovan CHYTRACEK <Ra...@cern.ch>.
Neal Ward wrote:
> 
> Radovan,
>     Thanks for the response. Unfortunately one of our requirements would be
> that we always expose just one DTD name to outside customers but are able to
> extend the internal DTDs we use without change to the external interface. I
> believe your suggestion is a good one but may not be suitable for what we
> need. Did you adopt this approach because you had a similar problem with
> Xerces?
Hi Neal,

      that was because of an user requirement where our users were allowed
to define their own entities and user tags inside the internal DTD subset.
However it's hard to maintain this if one wants to use the same entities
across multiple XML data files, so the users asked for a possibility to do
it a la C/C++ include directives.
The way I proposed to you allowed this and that's how they do it now.

Radovan

Re: Entity inclusion and Xerces

Posted by Neal Ward <Ne...@openwave.com>.
Radovan,
    Thanks for the response. Unfortunately one of our requirements would be
that we always expose just one DTD name to outside customers but are able to
extend the internal DTDs we use without change to the external interface. I
believe your suggestion is a good one but may not be suitable for what we
need. Did you adopt this approach because you had a similar problem with
Xerces?

Thanks,
    Neal

Radovan CHYTRACEK wrote:

> Neal Ward wrote:
> >
> > OK then. Here is an example of the problem I am having:
> >
> > The file firstDTD.dtd contains the following DTD:
> >
> > <!ENTITY % SECONDDTD SYSTEM "secondDTD.dtd">
> > %SECONDDTD;
> >
> > <!ELEMENT root_element (element1, element2)>
> >
> > <!ELEMENT element1 EMPTY>
> > <!ATTLIST element1 value1 CDATA #REQUIRED>
> >
> > This first DTD includes the following DTD in the file secondDTD.dtd
> >
> > <!ELEMENT element2 EMPTY>
> > <!ATTLIST element2 value2 CDATA #REQUIRED>
> >
> > When the following input is parsed:
> >
> > <?xml version = "1.0" ?> <!DOCTYPE root_element SYSTEM "firstDTD.dtd">
> > <root_element>
> >     <element1 value1="Hello"></element1>
> >     <element2 value2="Goodbye"></element2>
> > </root_element
> >
> > the Xerces parser produces the error "Recursive entity expansion" (I
> > believe it is at line 2 of the first DTD)
> >
> > I can't see where any duplicate expansion is occurring. Can anyone else?
> Hi,
>
>          what about the following approach. Instead of including in the
> first DTD,
> you include the second DTD in the internal DTD subset as:
>
> <?xml version = "1.0" ?> <!DOCTYPE root_element SYSTEM "firstDTD.dtd" [
> <!ENTITY % SECONDDTD SYSTEM "secondDTD.dtd">
> %SECONDDTD;
> ]>
> <root_element>
>   <element1 value1="Hello"></element1>
>   <element2 value2="Goodbye"></element2>
> </root_element
>
> This approach worked for me with Xerces-C 1.3.0.
>
> Radovan
>
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

--
Neal Ward (Neal.Ward@Openwave.com)
Phone:  +44 (0) 28-90416333
Fax:    +44 (0) 28-90416201

Openwave Systems Inc, Charles House,
103-111 Donegall St, Belfast, BT1 2FJ,
Northern Ireland.





Re: Entity inclusion and Xerces

Posted by Radovan CHYTRACEK <Ra...@cern.ch>.
Neal Ward wrote:
> 
> OK then. Here is an example of the problem I am having:
> 
> The file firstDTD.dtd contains the following DTD:
> 
> <!ENTITY % SECONDDTD SYSTEM "secondDTD.dtd">
> %SECONDDTD;
> 
> <!ELEMENT root_element (element1, element2)>
> 
> <!ELEMENT element1 EMPTY>
> <!ATTLIST element1 value1 CDATA #REQUIRED>
> 
> This first DTD includes the following DTD in the file secondDTD.dtd
> 
> <!ELEMENT element2 EMPTY>
> <!ATTLIST element2 value2 CDATA #REQUIRED>
> 
> When the following input is parsed:
> 
> <?xml version = "1.0" ?> <!DOCTYPE root_element SYSTEM "firstDTD.dtd">
> <root_element>
>     <element1 value1="Hello"></element1>
>     <element2 value2="Goodbye"></element2>
> </root_element
> 
> the Xerces parser produces the error "Recursive entity expansion" (I
> believe it is at line 2 of the first DTD)
> 
> I can't see where any duplicate expansion is occurring. Can anyone else?
Hi,

         what about the following approach. Instead of including in the
first DTD,
you include the second DTD in the internal DTD subset as:

<?xml version = "1.0" ?> <!DOCTYPE root_element SYSTEM "firstDTD.dtd" [
<!ENTITY % SECONDDTD SYSTEM "secondDTD.dtd">
%SECONDDTD;
]>
<root_element>
  <element1 value1="Hello"></element1>
  <element2 value2="Goodbye"></element2>
</root_element

This approach worked for me with Xerces-C 1.3.0.

Radovan

Re: Entity inclusion and Xerces

Posted by Neal Ward <Ne...@openwave.com>.
OK then. Here is an example of the problem I am having:

The file firstDTD.dtd contains the following DTD:

<!ENTITY % SECONDDTD SYSTEM "secondDTD.dtd">
%SECONDDTD;

<!ELEMENT root_element (element1, element2)>

<!ELEMENT element1 EMPTY>
<!ATTLIST element1 value1 CDATA #REQUIRED>

This first DTD includes the following DTD in the file secondDTD.dtd

<!ELEMENT element2 EMPTY>
<!ATTLIST element2 value2 CDATA #REQUIRED>

When the following input is parsed:

<?xml version = "1.0" ?> <!DOCTYPE root_element SYSTEM "firstDTD.dtd">
<root_element>
    <element1 value1="Hello"></element1>
    <element2 value2="Goodbye"></element2>
</root_element

the Xerces parser produces the error "Recursive entity expansion" (I believe it
is at line 2 of the first DTD)

I can't see where any duplicate expansion is occurring. Can anyone else?

Neal


Dean Roddey wrote:

> It means exactly what it says, that you've included an entity which includes
> itself, somewhere down the line. So, somewhere in your set of DTDs, one of
> them is either directly including itself, or includes something which
> includes the parent, or some such thing.
>
> --------------------------
> Dean Roddey
> The CIDLib C++ Frameworks
> Charmed Quark Software
> droddey@charmedquark.com
> http://www.charmedquark.com
>
> "I'm not sure how I feel about ambivalence"
>
> ----- Original Message -----
> From: "Neal Ward" <Ne...@openwave.com>
> To: <xe...@xml.apache.org>
> Sent: Saturday, March 03, 2001 1:38 AM
> Subject: Entity inclusion and Xerces
>
> > I have a DTD which includes a line of this format:
> >
> > <!ENTITY % DTD_TO_INCLUDE SYSTEM "OtherDTD.dtd">
> > %DTD_TO_INCLUDE;
> >
> > This line is intended to read a second DTD into the first and expand it.
> >
> > When I parse a document against the first DTD using Xerces it throws an
> > error at the above line saying:
> >
> > "Recursive entity expansion".
> >
> > Does anyone know if Xerces supports this type of entity inclusion and,
> > if so, do I need to set any parameters to make it parse properly?
> >
> > Any help would be appreciated.
> >
> > Thanks,
> >     Neal Ward
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



Re: Entity inclusion and Xerces

Posted by Dean Roddey <dr...@charmedquark.com>.
It means exactly what it says, that you've included an entity which includes
itself, somewhere down the line. So, somewhere in your set of DTDs, one of
them is either directly including itself, or includes something which
includes the parent, or some such thing.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"I'm not sure how I feel about ambivalence"


----- Original Message -----
From: "Neal Ward" <Ne...@openwave.com>
To: <xe...@xml.apache.org>
Sent: Saturday, March 03, 2001 1:38 AM
Subject: Entity inclusion and Xerces


> I have a DTD which includes a line of this format:
>
> <!ENTITY % DTD_TO_INCLUDE SYSTEM "OtherDTD.dtd">
> %DTD_TO_INCLUDE;
>
> This line is intended to read a second DTD into the first and expand it.
>
> When I parse a document against the first DTD using Xerces it throws an
> error at the above line saying:
>
> "Recursive entity expansion".
>
> Does anyone know if Xerces supports this type of entity inclusion and,
> if so, do I need to set any parameters to make it parse properly?
>
> Any help would be appreciated.
>
> Thanks,
>     Neal Ward
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>