commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Incze Lajos <in...@mail.matav.hu>
Subject Re: [Jelly] Proposal new xml tag xml:entity
Date Mon, 03 Feb 2003 22:26:08 GMT
> AFAIK enabling the capture of internal DOCTYPEs (which is disabled by
> default) should fix this. e.g. see the extra line I've added...
> 
> 
> >  SAXReader xmlReader = new SAXReader();
> 
> xmlReader.setIncludeInternalDTDDeclarations(true);
> 

I was aware of this, but in fact, I know nothing of the XML documents entering
the pipeline. As I see, it is certainly a bug to read a well-formed XML
document into a DOM4J document model, to make something, to output it,
and to get a result stream not being well-formed. (Partially, my purpose was
to get rid of these SGMLish entities and get bare UTF8. I think that
parsed entities should be replaced on output and if unparsed entities
are present the writer should output the internal subset.)

OTOH I was using dom4j through jelly:xml in a mavenized project. And 
the equivalent of the dom4j code framgment mentioned was something like this:

a.xml:
-
CTYPE a [
<!ENTITY x "y">
]>
<a>&x;</a>
-

part of maven.xml:
-
  <goal name="emnl:test">
    <x:parse var="doc" xml="a.xml"/>
    <echo><x:copyOf select="$doc"/></echo>
  </goal>
-

and this a piece of the output:

-
emnl:test:
    [echo] <?xml version="1.0" encoding="UTF-8"?>
<a>&x;y</a>
BUILD SUCCESSFUL
Total time:  13 seconds
-

/My workaround at the moment is something like this:

-
  <goal name="emnl:test">
    <x:transform var="doc" xslt="identity.xsl" xml="a.xml"/>
    <echo><x:copyOf select="$doc"/></echo>
  </goal>
-

where the identity.xsl is an identity xsl trasformation, and the output is

-
emnl:test:
    [echo] <?xml version="1.0" encoding="UTF-8"?>
<a>y</a>
BUILD SUCCESSFUL
-

as expected. I may be wrong on all of this, but e.g. JDOM behaves this way

            SAXBuilder xmlReader = new SAXBuilder();
            doc = xmlReader.build("a.xml");
            XMLOutputter xmlWriter = new XMLOutputter();
            xmlWriter.output(doc, System.out);

prints the resolved entity, i.e. "y" instead of "&x;"./

Sorry for the long post.

incze

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message