URL
                    https://opencores.org/ocsvn/openrisc/openrisc/trunk
                
            Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [doc/] [README.jaxp] - Rev 771
Go to most recent revision | Compare with Previous | Blame | View Log
This file describes the jaxp (xml processing) implementation of GNU Classpath.GNU Classpath includes interfaces and implementations for basic XML processingin in the java programming language, some general purpose SAX2 utilities, andtransformation.These classes used to be maintained as part of an external project GNU JAXPbut are now integrated with the rest of the core class library provided byGNU Classpath.PACKAGES. javax.xml.* ... JAXP 1.3 interfaces. gnu.xml.aelfred2.* ... SAX2 parser + validator. gnu.xml.dom.* ... DOM Level 3 Core, Traversal, XPath implementation. gnu.xml.dom.ls.* ... DOM Level 3 Load & Save implementation. gnu.xml.xpath.* ... JAXP XPath implementation. gnu.xml.transform.* ... JAXP XSL transformer implementation. gnu.xml.pipeline.* ... SAX2 event pipeline support. gnu.xml.stream.* ... StAX pull parser and SAX-over-StAX driver. gnu.xml.util.* ... various XML utility classes. gnu.xml.libxmlj.dom.* ... libxmlj DOM Level 3 Core and XPath. gnu.xml.libxmlj.sax.* ... libxmlj SAX parser. gnu.xml.libxmlj.transform.* ... libxmlj XSL transformer. gnu.xml.libxmlj.util.* ... libxmlj utility classesIn the external directory you can find the following packages.They are not maintained as part of GNU Classpath, but are used by theclasses in the above packages.. org.xml.sax.* ... SAX2 interfaces. org.w3c.dom.* ... DOM Level 3 interfaces. org.relaxng.datatype.* ... RELAX NG pluggable datatypes APICONFORMANCEThe primary test resources are at http://xmlconf.sourceforge.netand include:SAX2/XML conformance testsThat the "xml.testing.Driver" addresses the core XML 1.0specification requirements, which closely correspond to thefunctionality SAX1 provides. The driver uses SAX2 APIs totest that functionality It is used with a bugfixed version ofthe NIST/OASIS XML conformance test cases.The AElfred2 parser is highly conformant, though it still takesa few implementation shortcuts. See its package documentationfor information about known XML conformance issues in AElfred2.The primary issue is using Unicode character tables, rather thanthose in the XML specification, for determining what names arevalid. Most applications won't notice the difference, and thissolution is smaller and faster than the alternative.For validation, a secondary issue is that issues relating toentity modularity are not validated; they can't all be cleanlylayered. For example, validity constraints related to standalonedeclarations and PE nesting are not checked.The current implementation has also been tested against ElliotteRusty Harold's SAXTest test suite (http://www.cafeconleche.org/SAXTest)and achieves approximately 93% conformance to the SAX specificationaccording to these tests, higher than any other current Java parser.SAX2SAX2 API conformance currently has a minimal JUNIT (0.2) test suite,which can be accessed at the xmlconf site listed above. It doesnot cover namespaces or LexicalHandler and Declhandler extensionsanywhere as exhaustively as the SAX1 level functionality istested by the "xml.testing.Driver". However:- Applying the DOM unit tests to this implementation givesthe LexicalHandler (comments, and boundaries of DTDs,CDATA sections, and general entities) a workout, anddoes the same for DeclHandler entity declarations.- The pipeline package's layered validator demands thatelement and attribute declarations are reported correctly.By those metrics, SAX2 conformance for AElfred2 is also strong.DOM Level 3 Core TestsThe DOM implementation has been tested against the W3C DOM Level 3Core conformance test suite (http://www.w3.org/DOM/Test/). Currentconformance according to these tests is 72.3%. Many of the testfailures are due to the fact that GNU JAXP does not currentlyprovide any W3C XML Schema support.XSL transformationThe transformer and XPath implementation have been tested againstthe OASIS XSLT and XPath TC test suite. Conformance against theXalan tests is currently 77%.libxmlj========================================================================libxmlj is an effort to create a 100% JAXP-compatible Java wrapper forlibxml2 and libxslt. JAXP is the Java API for XML processing, libxml2is the XML C library for Gnome, and libxslt is the XSLT C library forGnome.libxmlj currently supports most of the DOM Level 3 Core, Traversal, andXPath APIs, SAX2, and XSLT transformations. There is no W3C XML Schemasupport yet.libxmlj can parse and transform XML documents extremely quickly incomparison to Java-based JAXP implementations. DOM manipulations, however,involve JNI overhead, so the speed of DOM tree construction and traversalcan be slower than the Java implementation.libxmlj is highly experimental, doesn't always conform to the DOMspecification correctly, and may leak memory. Production use is not advised.The implementation can be found in gnu/xml/libxmlj and native/jni/xmlj.See the INSTALL file for the required versions of libxml2 and libxslt.configure --enable-xmlj will build it.Usage------------------------------------------------------------------------To enable the various GNU JAXP factories, set the following system properties(command-line version shown, but they can equally be set programmatically):AElfred2:-Djavax.xml.parsers.SAXParserFactory=gnu.xml.aelfred2.JAXPFactoryGNU DOM (using DOM Level 3 Load & Save):-Djavax.xml.parsers.DocumentBuilderFactory=gnu.xml.dom.DomDocumentBuilderFactoryGNU DOM (using AElfred-only pipeline classes):-Djavax.xml.parsers.DocumentBuilderFactory=gnu.xml.dom.JAXPFactoryGNU XSL transformer:-Djavax.xml.transform.TransformerFactory=gnu.xml.transform.TransformerFactoryImplGNU StAX:-Djavax.xml.stream.XMLEventFactory=gnu.xml.stream.XMLEventFactoryImpl-Djavax.xml.stream.XMLInputFactory=gnu.xml.stream.XMLInputFactoryImpl-Djavax.xml.stream.XMLOutputFactory=gnu.xml.stream.XMLOutputFactoryImplGNU SAX-over-StAX:-Djavax.xml.parsers.SAXParserFactory=gnu.xml.stream.SAXParserFactorylibxmlj SAX:-Djavax.xml.parsers.SAXParserFactory=gnu.xml.libxmlj.sax.GnomeSAXParserFactorylibxmlj DOM:-Djavax.xml.parsers.DocumentBuilderFactory=gnu.xml.libxmlj.dom.GnomeDocumentBuilderFactorylibxmlj XSL transformer:-Djavax.xml.transform.TransformerFactory=gnu.xml.libxmlj.transform.GnomeTransformerFactoryWhen using libxmlj, the libxmlj shared library must be available.In general it is picked up by the runtime using GNU Classpath. If not youmight want to try adding the directory where libxmlj.so is installed(by default ${prefix}/lib/classpath/) with ldconfig or specifying in theLD_LIBRARY_PATH environment variable. Additionally, you may need to specifythe location of your shared libraries to the runtime environment using thejava.library.path system property.Missing (libxmlj) Features------------------------------------------------------------------------See BUGS in native/jni/xmlj for known bugs in the libxmlj native bindings.This implementation should be thread-safe, but currently alltransformation requests are queued via Java synchronization, whichmeans that it effectively performs single-threaded. Long story short,both libxml2 and libxslt are not fully reentrant.Update: it may be possible to make libxmlj thread-safe nonethelessusing thread context variables.Update: thread context variables have been introduced. This is veryuntested though, libxmlj therefore still has the single threadbottleneck.Validation===================================================Pluggable datatypes---------------------------------------------------Validators should use the RELAX NG pluggable datatypes API to retrievedatatype (XML Schema simple type) implementations in a schema-neutralfashion. The following code demonstrates looking up a W3C XML SchemanonNegativeInteger datatype:DatatypeLibrary xsd = DatatypeLibraryLoader.createDatatypeLibrary(XMLConstants.W3C_XML_SCHEMA_NS_URI);Datatype nonNegativeInteger = xsd.createDatatype("nonNegativeInteger");It is also possible to create new types by derivation. For instance,to create a datatype that will match a US ZIP code:DatatypeBuilder b = xsd.createDatatypeBuilder("string");b.addParameter("pattern", "(^[0-9]{5}$)|(^[0-9]{5}-[0-9]{4}$)");Datatype zipCode = b.createDatatype();A datatype library implementation for XML Schema is provided; otherlibrary implementations may be added.
Go to most recent revision | Compare with Previous | Blame | View Log

