org.apache.ws.jaxme.xs

Class XSParser

public class XSParser extends Object

The XML schema parser.

Version: $Id: XSParser.java 232099 2005-04-27 19:42:55Z jochen $

Author: Jochen Wiedmann

Field Summary
static StringXML_SCHEMA_URI

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

Constructor Summary
XSParser()

Creates a new instance of XSParser.

Method Summary
voidaddImport(String pNamespace, String pSchemaLocation)

Adds a schema being imported by the parser.

voidaddImport(String pNamespace, String pSchemaLocation, Node pSchema)

Adds a schema being imported by the parser.

XSContextgetContext()

Provides access to the parsers internal data.

static XSParsergetRunningInstance()

Provides access to the currently running instance of XSParser.

XSContentHandlergetXSContentHandler(String pSchemaLocation)

Returns an instance of {@link XSContentHandler} for parsing a stream of SAX events.

booleanisValidating()

Returns whether the parser is validating.

protected XSLogicalParsernewXSLogicalParser()
XSSchemaparse(InputSource pSource)

Parses the given XML schema and returns a logical representation.

XSSchemaparse(Node pNode)

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

XsESchemaparseSyntax(InputSource pSource)

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

protected voidsetData(XSContext pData)
voidsetValidating(boolean pValidating)

Sets whether the parser is validating.

Field Detail

XML_SCHEMA_URI

public static final String XML_SCHEMA_URI

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

Constructor Detail

XSParser

public XSParser()

Creates a new instance of XSParser.

Method Detail

addImport

public void addImport(String pNamespace, 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: XSParser

addImport

public void addImport(String pNamespace, String pSchemaLocation, 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: XSParser

getContext

public XSContext getContext()

Provides access to the parsers internal data. Use the {@link #getRunningInstance()} method to find the parser.

getRunningInstance

public static XSParser getRunningInstance()

Provides access to the currently running instance of XSParser.

getXSContentHandler

public XSContentHandler getXSContentHandler(String pSchemaLocation)

Returns an instance of {@link XSContentHandler} for parsing a stream of SAX events.

isValidating

public boolean isValidating()

Returns whether the parser is validating.

newXSLogicalParser

protected XSLogicalParser newXSLogicalParser()

parse

public XSSchema parse(InputSource pSource)

Parses the given XML schema and returns a logical representation.

parse

public XSSchema parse(Node pNode)

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 {@link org.w3c.dom.Document}, an instance of {@link org.w3c.dom.Element}, or an instance of {@link org.w3c.dom.DocumentFragment}. In the latter case, make sure, that the fragment contains a single root element.

parseSyntax

public XsESchema parseSyntax(InputSource pSource)

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

See Also: parse

setData

protected void setData(XSContext pData)

setValidating

public void setValidating(boolean pValidating)

Sets whether the parser is validating.