org.apache.ws.jaxme.xs
Class XSParser

java.lang.Object
  extended by org.apache.ws.jaxme.xs.XSParser
Direct Known Subclasses:
JAXBParser

public class XSParser
extends java.lang.Object

The XML schema parser.

Version:
$Id$
Author:
Jochen Wiedmann

Field Summary
static java.lang.String XML_SCHEMA_URI
          The XML Schema URI: http://www.w3.org/2001/XMLSchema
 
Constructor Summary
XSParser()
          Creates a new instance of XSParser.
 
Method Summary
 void addImport(java.lang.String pNamespace, java.lang.String pSchemaLocation)
          Adds a schema being imported by the parser.
 void addImport(java.lang.String pNamespace, java.lang.String pSchemaLocation, org.w3c.dom.Node pSchema)
          Adds a schema being imported by the parser.
 XSContext getContext()
          Provides access to the parsers internal data.
static XSParser getRunningInstance()
          Provides access to the currently running instance of XSParser.
 XSContentHandler getXSContentHandler(java.lang.String pSchemaLocation)
          Returns an instance of XSContentHandler for parsing a stream of SAX events.
 boolean isValidating()
          Returns whether the parser is validating.
protected  XSLogicalParser newXSLogicalParser()
           
 XSSchema parse(org.xml.sax.InputSource pSource)
          Parses the given XML schema and returns a logical representation.
 XSSchema parse(org.w3c.dom.Node pNode)
          Parses the given DOM node containing an an XML schema and returns a logical representation.
 XsESchema parseSyntax(org.xml.sax.InputSource pSource)
          Parses the given XML schema.
protected  void setData(XSContext pData)
           
 void setValidating(boolean pValidating)
          Sets whether the parser is validating.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_SCHEMA_URI

public static final java.lang.String XML_SCHEMA_URI

The XML Schema URI: http://www.w3.org/2001/XMLSchema

See Also:
Constant Field Values
Constructor Detail

XSParser

public XSParser()

Creates a new instance of XSParser.

Method Detail

setValidating

public void setValidating(boolean pValidating)

Sets whether the parser is validating.


isValidating

public boolean isValidating()

Returns whether the parser is validating.


addImport

public void addImport(java.lang.String pNamespace,
                      java.lang.String pSchemaLocation)

Adds a schema being imported by the parser. This feature is useful, if a schema silently assumes the presence of additional datatypes. For example, a WSDL definition will contain references to SOAP datatypes without explicit import.

Parameters:
pNamespace - Matches the "xs:import" nodes "namespace" attribute. In particular it may be null, in which case the imported schema may not have a targetNamespace.
pSchemaLocation - Matches the "xs:import" nodes "schemaLocation" attribute. In particular it may be null.
See Also:
#addImport(String, Node)

addImport

public void addImport(java.lang.String pNamespace,
                      java.lang.String pSchemaLocation,
                      org.w3c.dom.Node pSchema)

Adds a schema being imported by the parser. The schema is provided as a DOM node. This feature is useful, if a schema silently assumes the presence of additional datatypes. For example, a WSDL definition will contain references to SOAP datatypes without explicit import.

Parameters:
pNamespace - Matches the "xs:import" nodes "namespace" attribute. In particular it may be null, in which case the imported schema may not have a targetNamespace.
pSchemaLocation - The imported schemas system ID, if known, or null. Knowing the system ID is important only, if you need to prevent recursive schematas being included more than once.
pSchema - A DOM node with the schema being imported.
See Also:
addImport(String, String)

getContext

public XSContext getContext()

Provides access to the parsers internal data. Use the getRunningInstance() method to find the parser.


setData

protected void setData(XSContext pData)

parseSyntax

public XsESchema parseSyntax(org.xml.sax.InputSource pSource)
                      throws javax.xml.parsers.ParserConfigurationException,
                             org.xml.sax.SAXException,
                             java.io.IOException

Parses the given XML schema. and returns a syntactical representation.

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
See Also:
parse(InputSource)

newXSLogicalParser

protected XSLogicalParser newXSLogicalParser()

parse

public XSSchema parse(org.xml.sax.InputSource pSource)
               throws javax.xml.parsers.ParserConfigurationException,
                      org.xml.sax.SAXException,
                      java.io.IOException

Parses the given XML schema and returns a logical representation.

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

parse

public XSSchema parse(org.w3c.dom.Node pNode)
               throws org.xml.sax.SAXException

Parses the given DOM node containing an an XML schema and returns a logical representation.

Parameters:
pNode - A node containing a valid XML document. Must be either an instance of Document, an instance of Element, or an instance of DocumentFragment. In the latter case, make sure, that the fragment contains a single root element.
Throws:
org.xml.sax.SAXException

getXSContentHandler

public XSContentHandler getXSContentHandler(java.lang.String pSchemaLocation)
                                     throws org.xml.sax.SAXException

Returns an instance of XSContentHandler for parsing a stream of SAX events.

Throws:
org.xml.sax.SAXException

getRunningInstance

public static XSParser getRunningInstance()

Provides access to the currently running instance of XSParser.