You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Andrew Welch <AW...@piper-group.com> on 2003/05/08 16:14:35 UTC

transform xml with unreachable dtd

Hi,

I am trying to transform an xml file with a doctype that references a dtd that wont be available at the point of transform.  Is it possible to still transform the xml?

<?xml version="1.0" ?>
<!DOCTYPE foo
  SYSTEM "ini.dtd">
<foo>
</foo>

Currently I get the error: 

java.io.FileNotFoundException: T:\omi transform\ini.dtd (The system cannot find the file specified)
java.io.FileNotFoundException: T:\omi transform\ini.dtd (The system cannot find the file specified)
        at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
        at org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2870)
        at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1167)
        ....

I have tried using 

xf.setFeature("http://xml.org/sax/features/external-parameter-entities",false);

where xf is the XMLFilter, but crimson doesnt support this feature.  After reading around Ive kind of got the impression that the DTD must be available if it is specified otherwise the transform should fail (as the xml needs it resolve entities etc).

How can I get the xml to parse without the dtd being available?

cheers
andrew

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.470 / Virus Database: 268 - Release Date: 08/04/2003
 

Re: transform xml with unreachable dtd

Posted by Liviu Casapu <li...@savvion.com>.

Hi Andrew,

I've had the same problem not a long time ago. One way to work around it
is to use a DOM/SAXSource instead of a regular StreamSource. This way,
Xalan does not invoke the XML parser automatically, because you do it
beforehand. Depending on your needs, you can specify an alternate DTD (or 
the same one but from a different location), or elect not to use one
during parsing.

Hope it helps,
Liviu

> 
> Hi,
> 
> I am trying to transform an xml file with a doctype that references a dtd that wont be available at the point of transform.  Is it possible to still transform the xml?
> 
> <?xml version="1.0" ?>
> <!DOCTYPE foo
>   SYSTEM "ini.dtd">
> <foo>
> </foo>
> 
> Currently I get the error: 
> 
> java.io.FileNotFoundException: T:\omi transform\ini.dtd (The system cannot find the file specified)
> java.io.FileNotFoundException: T:\omi transform\ini.dtd (The system cannot find the file specified)
>         at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
>         at org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2870)
>         at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1167)
>         ....
> 
> I have tried using 
> 
> xf.setFeature("http://xml.org/sax/features/external-parameter-entities",false);
> 
> where xf is the XMLFilter, but crimson doesnt support this feature.  After reading around Ive kind of got the impression that the DTD must be available if it is specified otherwise the transform should fail (as the xml needs it resolve entities etc).
> 
> How can I get the xml to parse without the dtd being available?
> 
> cheers
> andrew
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.470 / Virus Database: 268 - Release Date: 08/04/2003
>  
>