xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Michael Abato <mrabato AT earthlink.net>
- To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] XOM and Catalogs
- Date: Tue, 22 Mar 2005 09:05:56 -0500
I'd meant to send in this bug report on this topic, but got distracted. Starting with XOM 1.1d5, compatibility with the apache commons resolver is broken.
// TestResolver.java
import nu.xom.Builder;
import org.apache.xml.resolver.tools.ResolvingXMLReader;
import java.io.*;
public class TestResolver {
public static void main(String[] args) throws Exception {
Builder builder = new Builder(new ResolvingXMLReader());
Reader in = new StringReader("<a foo='bar'/>");
System.out.println(builder.build(in).toXML());
}
}
Running with 1.1d4:
> java -cp xom-1.1d4.jar:jaxen-1.1-min.jar:xml-commons-resolver-1.1.jar:. TestResolver
<?xml version="1.0"?>
<a foo="bar" />
Running with 1.1d5:
> java -cp xom-1.1d5.jar:jaxen-1.1-min.jar:xml-commons-resolver-1.1.jar:. TestResolver
<?xml version="1.0"?>
< ="bar" />
This is with:
> java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141.4)
Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode)
I've seen the same behavior with the 1.0 release of the apache commons resolver, and in a variety of runtime environments, including windows and solaris jdk's, all 1.4.2.
I lost momentum and got distracted while trying to trace the problem back to source - there are changes to element/attribute naming in the code between those two tags than I was able to make sense of quickly.
Nonetheless, the approach of using a specific, entity-resolving Reader works well in general.
Michael Abato
On Mar 20, 2005, at 11:42 PM, Elliotte Rusty Harold wrote:
Andrew Thompson wrote:
Another feature question that I couldn't find in the FAQs and that wasn't obvious from the API docs.
What's the best way of using XML Catalogs with XOM?
I assume that the xml-commons catalog entity resolver can be plugged in somehow if my underlying parser is Xerces, but it's not current clear to me how to do this... is there a recommended approach?
You can plug it into the SAX XMLReader as you would any other EntityResolver, before using it to create a builder. XOM even has special code to recognizer this case and will not reverify data the catalog resolver passes it, as it would with untrusted SAX filters.
Catalog support is also on the TODO list, but probably not in 1.1.
--
Elliotte
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest
-
[XOM-interest] XOM and Catalogs,
Andrew Thompson, 03/20/2005
-
Re: [XOM-interest] XOM and Catalogs,
Elliotte Rusty Harold, 03/20/2005
-
Re: [XOM-interest] XOM and Catalogs,
Michael Abato, 03/22/2005
- Re: [XOM-interest] XOM and Catalogs, Elliotte Rusty Harold, 03/22/2005
-
Re: [XOM-interest] XOM and Catalogs,
Elliotte Rusty Harold, 03/22/2005
-
Re: [XOM-interest] XOM and Catalogs,
Michael Abato, 03/22/2005
- Re: [XOM-interest] XOM and Catalogs, Elliotte Rusty Harold, 03/22/2005
- Re: [XOM-interest] XOM and Catalogs, Elliotte Rusty Harold, 03/22/2005
- Re: [XOM-interest] XOM and Catalogs, Elliotte Rusty Harold, 03/22/2005
- Re: [XOM-interest] XOM and Catalogs, Elliotte Rusty Harold, 03/22/2005
-
Re: [XOM-interest] XOM and Catalogs,
Michael Abato, 03/22/2005
-
Re: [XOM-interest] XOM and Catalogs,
Michael Abato, 03/22/2005
-
Re: [XOM-interest] XOM and Catalogs,
Elliotte Rusty Harold, 03/20/2005
Archive powered by MHonArc 2.6.24.