org.apache.ws.jaxme.xs.impl

Class XSLogicalParser

public class XSLogicalParser extends Object

Implementation of a logical parser.

Author: Jochen Wiedmann

Nested Class Summary
static classXSLogicalParser.AddedImport
This class is used to ensure, that schemata aren't loaded twice.
Method Summary
protected voidadd(XsESchema pSyntaxSchema, Object pChild)

Adds the given object to the schema.

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.

protected voidaddSyntaxSchema(XsESchema pSyntaxSchema)
protected voidclearSyntaxSchemas()
protected voidcreateSubstitutionGroups(XSSchema pSchema)
XSLogicalParser.AddedImport[]getAddedImports()

Returns the array of added imports, typically empty.

XsESchemagetCurrentSyntaxSchema()

Returns the syntax schema, which is currently being parsed.

protected XSContextgetData()
protected InputSourcegetInputSource(String pReferencingSystemId, String pURI)

Converts the given URI into an instance of InputSource.

XSSchemagetSchema()

Returns the schema, which is currently being parsed.

XsESchema[]getSyntaxSchemas()

Provides context information to the schema which is currently being parsed.

XSContentHandlergetXSContentHandler(String pSystemId)

This is the logical parsers frontend for parsing a stream of SAX events.

protected voidimportSchema(XsESchema pImportingSchema, String pNamespace, String pSchemaLocation, Locator pLocator)

Handles xs:import.

protected voidimportSchema(XsESchema pImportingSchema, String pNamespace, Node pNode, String pSchemaLocation)
protected voidincludeSchema(XsESchema pIncludingSchema, XsEInclude pInclude, Locator pLocator, String pSchemaLocation)

Handles xs:include.

booleanisValidating()

Returns whether the parser is validating.

protected voidparse(XsESchema pSyntaxSchema, String pSchemaLocation)

Parses the given InputSource syntactically and converts the objects that it finds into logical objects.

XSSchemaparse(Node pNode)

This is the logical parsers frontend for parsing a DOM node.

XSSchemaparse(InputSource pSource)

This is the logical parsers frontend for parsing the given InputSource.

protected XsESchemaparseSyntax(Node pNode)
protected XsESchemaparseSyntax(Locator pLocator, String pSchemaLocation)
protected voidparseSyntax(Locator pLocator, String pSchemaLocation, XsESchema pSchema)
protected voidredefine(XsESchema pSyntaxSchema, XsERedefine pRedefine, XsRedefinable pChild)

Redefines the given XsRedefinable.

protected voidredefineSchema(XsESchema pRedefiningSchema, XsERedefine pRedefine)

Handles xs:refefine.

protected voidremoveSyntaxSchema()
protected voidsetSchema(XSSchema pSchema)

Sets the schema, which is currently being parsed.

voidsetValidating(boolean pValidating)

Sets whether the parser is validating.

Method Detail

add

protected void add(XsESchema pSyntaxSchema, Object pChild)

Adds the given object to the schema.

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.

In practice, the declaration will silently create an "xs:import" node.

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.

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 System ID of the schema being imported, if known, or null. Knowing the system ID is important only, if you need to prevent recursive parsing of schemata. pSchema A DOM node with the schema being imported.

addSyntaxSchema

protected void addSyntaxSchema(XsESchema pSyntaxSchema)

clearSyntaxSchemas

protected void clearSyntaxSchemas()

createSubstitutionGroups

protected void createSubstitutionGroups(XSSchema pSchema)

getAddedImports

public XSLogicalParser.AddedImport[] getAddedImports()

Returns the array of added imports, typically empty.

getCurrentSyntaxSchema

public XsESchema getCurrentSyntaxSchema()

Returns the syntax schema, which is currently being parsed.

getData

protected XSContext getData()

getInputSource

protected InputSource getInputSource(String pReferencingSystemId, String pURI)

Converts the given URI into an instance of InputSource.

getSchema

public XSSchema getSchema()

Returns the schema, which is currently being parsed.

getSyntaxSchemas

public XsESchema[] getSyntaxSchemas()

Provides context information to the schema which is currently being parsed. The schema with index 0 is the outermost schema, on which the parser is actually invoked.

getXSContentHandler

public XSContentHandler getXSContentHandler(String pSystemId)

This is the logical parsers frontend for parsing a stream of SAX events.

Parameters: pSystemId System Id (schema location of the schema being parsed, if known. Null otherwise. Knowing the system id is important only, if you want to prevent recursive includes.

importSchema

protected void importSchema(XsESchema pImportingSchema, String pNamespace, String pSchemaLocation, Locator pLocator)

Handles xs:import.

importSchema

protected void importSchema(XsESchema pImportingSchema, String pNamespace, Node pNode, String pSchemaLocation)

includeSchema

protected void includeSchema(XsESchema pIncludingSchema, XsEInclude pInclude, Locator pLocator, String pSchemaLocation)

Handles xs:include.

isValidating

public boolean isValidating()

Returns whether the parser is validating.

parse

protected void parse(XsESchema pSyntaxSchema, String pSchemaLocation)

Parses the given InputSource syntactically and converts the objects that it finds into logical objects. These logical objects are added to the given XSSchema.

parse

public XSSchema parse(Node pNode)

This is the logical parsers frontend for parsing a DOM node.

parse

public XSSchema parse(InputSource pSource)

This is the logical parsers frontend for parsing the given InputSource. If the parsed schema includes or imports other schemas, they are also parsed and added to the parsers object tree.

See Also: XSLogicalParser

parseSyntax

protected XsESchema parseSyntax(Node pNode)

parseSyntax

protected XsESchema parseSyntax(Locator pLocator, String pSchemaLocation)

parseSyntax

protected void parseSyntax(Locator pLocator, String pSchemaLocation, XsESchema pSchema)

redefine

protected void redefine(XsESchema pSyntaxSchema, XsERedefine pRedefine, XsRedefinable pChild)

Redefines the given XsRedefinable.

redefineSchema

protected void redefineSchema(XsESchema pRedefiningSchema, XsERedefine pRedefine)

Handles xs:refefine.

removeSyntaxSchema

protected void removeSyntaxSchema()

setSchema

protected void setSchema(XSSchema pSchema)

Sets the schema, which is currently being parsed.

setValidating

public void setValidating(boolean pValidating)

Sets whether the parser is validating.