You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Mark E. Palandri" <mp...@lspeed.com> on 2003/03/12 00:02:55 UTC

Parameter Entity Bug???

I'm new to the list, so if this problem has been fixed, then sorry to waste
your time.

I am using Java Xerces 2.3.0.

I have been using the org.apache.xerces.parsers.XMLDocumentParser class to
parse XML documents for storage into an XML repository. To get a better idea
of how this class calls the event methods, I extended it and just had the
event methods generate logging output. Everything was working fine until I
sent my parameter entity test document through and ran into what I believe
is a bug.

The problem appears in the non-normalized text of an internal parameter
entity declaration (pe2) that contains a parameter entity reference (to
pe1). I expected the non-normalized text to merely contain the reference,
but it has both the reference and the referenced entity's text, one after
another. The text value is correct; It only contains the referenced entity's
text and no entity reference.

If this isn't a problem, then how do I go about getting the entity reference
but not the referenced entity's text in the non-normalized text? Is there
some feature that affects this?

I have minimized the test case and it is as follows:

bug.xml
-------------------------------------------------
<!DOCTYPE AAA SYSTEM "bug.dtd">
<AAA/>
-------------------------------------------------

bug.dtd
-------------------------------------------------
<!ELEMENT AAA EMPTY>
<!ENTITY % pe1 "This is the value of pe1">
<!ENTITY % pe2 "This entity, paramEnt2, references paramEnt1:
[%paramEnt1;]">
-------------------------------------------------

output
-------------------------------------------------
XMLScanner: startDocument
XMLScanner:   locator:
XMLScanner:     publicId: null
XMLScanner:     literal systemId: file:///C:/Sample%20Files/xml/bug.xml
XMLScanner:     expanded systemId: file:///C:/Sample%20Files/xml/bug.xml
XMLScanner:     base systemId: file:///C:/Sample%20Files/xml/bug.xml
XMLScanner:     line: 1
XMLScanner:     column: 1
XMLScanner:   encoding: [UTF-8]
XMLScanner: doctypeDecl
XMLScanner:   rootElement: [foo]
XMLScanner:   publicId: [null]
XMLScanner:   systemId: [bug.dtd]
XMLScanner: startDTD
XMLScanner:   locator:
XMLScanner:     publicId: null
XMLScanner:     literal systemId: bug.dtd
XMLScanner:     expanded systemId: file:///C:/Sample%20Files/xml/bug.dtd
XMLScanner:     base systemId: file:///C:/Sample%20Files/xml/bug.dtd
XMLScanner:     line: 1
XMLScanner:     column: 1
XMLScanner: startExternalSubset
XMLScanner:   identifier:
XMLScanner:     publicId: null
XMLScanner:     literal systemId: bug.dtd
XMLScanner:     expanded systemId: file:///C:/Sample%20Files/xml/bug.dtd
XMLScanner:     base systemId: file:///C:/Sample%20Files/xml/bug.xml
XMLScanner: startContentModel
XMLScanner:   elementName = [foo]
XMLScanner: empty
XMLScanner: endContentModel
XMLScanner: elementDecl
XMLScanner:   contentModel: [EMPTY]
XMLScanner: internalEntityDecl
XMLScanner:   name: [%pe1]
XMLScanner:   text: [This is the value of pe1]
XMLScanner:   nonNormalizedText: [This is the value of pe1]
XMLScanner: internalEntityDecl
XMLScanner:   name: [%pe2]
XMLScanner:   text: [Entity pe2 references pe1: [This is the value of pe1]]
XMLScanner:   nonNormalizedText: [Entity pe2 references pe1: [%pe1;This is
the value of pe1]]
XMLScanner: endExternalSubset
XMLScanner: endDTD
XMLScanner: emptyElement
XMLScanner: startElement
XMLScanner:   element: [foo]
XMLScanner:   attributes:
XMLScanner: endElement
XMLScanner:   element: [foo]
XMLScanner: endDocument
-------------------------------------------------

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org