net.xoetrope.xml.jaxp
Class JaxpXmlParser

java.lang.Object
  extended by net.xoetrope.xml.jaxp.JaxpXmlParser
All Implemented Interfaces:
XmlParser

public class JaxpXmlParser
extends java.lang.Object
implements XmlParser

A wrapper for JAXP parsers

Copyright (c) Xoetrope Ltd., 2002-2003

$Revision: 2.2 $

License: see License.txt


Field Summary
static java.lang.String JAXP_SCHEMA_LANGUAGE
          Constants used for JAXP 1.2
static java.lang.String JAXP_SCHEMA_SOURCE
           
static java.lang.String W3C_XML_SCHEMA
           
 
Constructor Summary
JaxpXmlParser()
          null ctor
 
Method Summary
 XmlElement createXmlElement(java.lang.String name)
          Create a basic XmlElement of the type registered in the XmlParserFactory
 XmlElement parse(java.io.Reader input)
          Read the passed Reader object and parse its contents into an XmlElement structure of the type defined in the XmlParserFactory.
 XmlElement parse(java.io.Reader input, java.lang.String schemaSource)
          Read the passed Reader object and parse its contents into an XmlElement structure of the type defined in the XmlParserFactory.
static void setErrorHandler(org.xml.sax.ErrorHandler eh)
          Set the static ErrorHandler to report parsing errors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAXP_SCHEMA_LANGUAGE

public static final java.lang.String JAXP_SCHEMA_LANGUAGE
Constants used for JAXP 1.2

See Also:
Constant Field Values

W3C_XML_SCHEMA

public static final java.lang.String W3C_XML_SCHEMA
See Also:
Constant Field Values

JAXP_SCHEMA_SOURCE

public static final java.lang.String JAXP_SCHEMA_SOURCE
See Also:
Constant Field Values
Constructor Detail

JaxpXmlParser

public JaxpXmlParser()
null ctor

Method Detail

createXmlElement

public XmlElement createXmlElement(java.lang.String name)
Create a basic XmlElement of the type registered in the XmlParserFactory

Specified by:
createXmlElement in interface XmlParser
Parameters:
name - The name of the new element
Returns:
The created XmlElement

parse

public XmlElement parse(java.io.Reader input)
Read the passed Reader object and parse its contents into an XmlElement structure of the type defined in the XmlParserFactory.

Specified by:
parse in interface XmlParser
Parameters:
input - The reader from which the content of the XML structure will be read
Returns:
The root XmlElement resulting from the parsing of the XML

parse

public XmlElement parse(java.io.Reader input,
                        java.lang.String schemaSource)
Read the passed Reader object and parse its contents into an XmlElement structure of the type defined in the XmlParserFactory. Validate the parsed XML with the schema file located at the file indicated by the schemaSource parameter

Specified by:
parse in interface XmlParser
Parameters:
input - The reader from which the content of the XML structure will be read
schemaSource - Location of the schema source which will be used to validate the parsed XML
Returns:
The root XmlElement resulting from the parsing of the XML

setErrorHandler

public static void setErrorHandler(org.xml.sax.ErrorHandler eh)
Set the static ErrorHandler to report parsing errors

Parameters:
eh - The ErrorHandler to be used