Top Description Inners Fields Constructors Methods
com.sun.msv.reader.xmlschema

public Class XMLSchemaReader

extends GrammarReader
implements XSDatatypeResolver
Class Inheritance
All Implemented Interfaces
com.sun.msv.reader.datatype.xsd.XSDatatypeResolver
Imports
java.text.MessageFormat, java.util.HashMap, .Iterator, .Map, .ResourceBundle, .Set, javax.xml.XMLConstants, javax.xml.parsers.SAXParserFactory, javax.xml.transform.Source, .TransformerConfigurationException, .TransformerException, org.iso_relax.verifier.Schema, org.relaxng.datatype.DatatypeException, org.w3c.dom.ls.LSInput, .LSResourceResolver, org.xml.sax.EntityResolver, .InputSource, .Locator, com.sun.msv.datatype.xsd.DatatypeFactory, .StringType, .XSDatatype, com.sun.msv.grammar.Expression, .ExpressionPool, .Grammar, .NameClass, .ReferenceContainer, .ReferenceExp, .SimpleNameClass, com.sun.msv.grammar.trex.ElementPattern, com.sun.msv.grammar.xmlschema.ComplexTypeExp, .ElementDeclExp, .OccurrenceExp, .SimpleTypeExp, .XMLSchemaGrammar, .XMLSchemaSchema, .XMLSchemaTypeExp, com.sun.msv.reader.AbortException, .ChoiceState, .GrammarReader, .GrammarReaderController, .IgnoreState, .InterleaveState, .RunAwayExpressionChecker, .SequenceState, .State, com.sun.msv.reader.datatype.xsd.FacetState, .SimpleTypeState, .XSDatatypeExp, .XSDatatypeResolver, com.sun.msv.util.StartTagInfo, com.sun.msv.verifier.jarv.XSFactoryImpl

parses XML representation of XML Schema and constructs AGM.
Author
Kohsuke KAWAGUCHI

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
public static class
XMLSchemaReader.StateFactory

creates various State object, which in turn parses grammar.

private static interface

Field Summary

Modifier and TypeField and Description
private Map<String, String>
protected String
attributeFormDefault

value of the "attributeFormDefault" attribute.

protected String
blockDefault

value of the "blockDefault" attribute.

protected String
chameleonTargetNamespace

The intended target namespace of the chameleon schema.

public final ComplexTypeExp
complexUrType

expression that matches to "ur-type" when used as a complex type.

protected XMLSchemaSchema
private final Set<XMLSchemaSchema>
definedSchemata

set of XMLSchemaGrammar that is already defined.

public boolean
doDuplicateDefinitionCheck

a flag that indicates State objects should check duplicate definitions.

protected String
elementFormDefault

value of the "elementFormDefault" attribute.

public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
protected String
finalDefault

value of the "finalDefault" attribute.

protected final XMLSchemaGrammar
grammar

grammar object which is being under construction.

private boolean
public final Map<String, Set<String>>
parsedFiles

tables that store all SystemIds that we've read.

public final XMLSchemaReader.StateFactory
public static final String
public static final String
public static final String
protected static Schema
xmlSchema4XmlSchema

Schema for schema of W3C XML Schema.

public static final String
XMLSchemaNamespace

namespace URI of XML Schema declarations.

public static final String
public static final String
protected final XMLSchemaSchema
xsdSchema

XMLSchemaSchema object that has XMLSchemaNamespace as its target namespace.

public final ReferenceExp
xsiSchemaLocationExp

content model that matches to optional xsi:schemaLocation or xsi:noNamespaceSchemaLocation.

Inherited from com.sun.msv.reader.GrammarReader:
backwardReferencebasePrefixResolvercontrollerERR_BAD_ATTRIBUTE_VALUEERR_BAD_TYPEERR_CHARACTERSERR_CONFLICTING_ATTRIBUTESERR_DATATYPE_ALREADY_DEFINEDERR_DISALLOWED_ATTRIBUTEERR_FRAGMENT_IDENTIFIERERR_ILLEGAL_FINAL_VALUEERR_MALPLACED_ELEMENTERR_MISSING_ATTRIBUTEERR_MISSING_ATTRIBUTE_2ERR_MISSING_CHILD_EXPRESSIONERR_MISSING_CHILD_TYPEERR_MISSING_TOPLEVELERR_MORE_THAN_ONE_CHILD_EXPRESSIONERR_MORE_THAN_ONE_CHILD_TYPEERR_RECURSIVE_DATATYPEERR_RECURSIVE_INCLUDEERR_RUNAWAY_EXPRESSIONERR_UNDEFINED_DATATYPEparserFactorypoolprefixResolverWRN_DEPRECATED_TYPENAMEWRN_MAYBE_WRONG_NAMESPACE

Constructor Summary

AccessConstructor and Description
public
XMLSchemaReader(GrammarReaderController controller)

easy-to-use constructor.

public
public
public

Method Summary

Modifier and TypeMethod and Description
private Expression
_processOccurs(Expression item, int minOccurs, int maxOccurs)

public State
createAttributeState(State parent, StartTagInfo tag)

creates a state object that parses "attribute","attributeGroup ref", and "anyAttribute".

public State
createExpressionChildState(State parent, StartTagInfo tag)

Implements abstract com.sun.msv.reader.GrammarReader.createExpressionChildState.

this method must be implemented by the derived class to create language-default expresion state.
public State
public State
createModelGroupState(State parent, StartTagInfo tag)

creates a state object that parses "all"/"group ref"/"choice" and "sequence".

public Map<String, String>
public XMLSchemaSchema
getOrCreateSchema(String namespaceURI)

gets a reference to XMLSchemaGrammar object whose target namespace is the specified one.

public final XMLSchemaGrammar
public Grammar
private XMLSchemaReader.Type
private XMLSchemaReader.Type
getType(final XSDatatype dt)

public static Schema
protected Expression
interceptExpression(State state, Expression exp)

Overrides com.sun.msv.reader.GrammarReader.interceptExpression.

intercepts an expression made by ExpressionState before it is passed to the parent state.
protected boolean
isGrammarElement(StartTagInfo tag)

Implements abstract com.sun.msv.reader.GrammarReader.isGrammarElement.

checks if given element is that of the grammar elements.
public final boolean
public boolean
private boolean

Returns:

true if d can validly substitute c.
isSubstitutable
(ElementDeclExp
the substitution head
c
,
ElementDeclExp
a member of the substitution group of c.
d
)

implementation of "SCC: Substitution Group OK (Transitive)".

protected String
localizeMessage(String propertyName, Object[] args)

Implements abstract com.sun.msv.reader.GrammarReader.localizeMessage.

formats localized message with arguments
public final void
public static XMLSchemaGrammar
parse(String grammarURL, SAXParserFactory factory, GrammarReaderController controller)

loads XML Schema

public static XMLSchemaGrammar
parse(InputSource grammar, SAXParserFactory factory, GrammarReaderController controller)

loads XML Schema

public static XMLSchemaGrammar
parse(Source schema, GrammarReaderController controller)

Convenience method to create a reader and read a single scheme.

public Expression
processOccurs(StartTagInfo startTag, Expression item)

Adds maxOccurs/minOccurs semantics to a given expression.

public Expression
processOccurs(Expression item, int minOccurs, int
-1 to represent "unbounded".
maxOccurs
)

Adds maxOccurs/minOccurs semantics to a given expression.

public XSDatatype

Returns:

null if the type is not defined.
resolveBuiltinDataType
(String typeLocalName)

resolves built-in datatypes (URI: http://www.w3.org/2001/XMLSchema)

public SimpleTypeExp

Returns:

null if the type is not defined.
resolveBuiltinSimpleType
(String typeLocalName)

Gets a built-in datatype as SimpleTypeExp.

protected String
private String
resolveNamespaceOfDeclaration(String formValue, String defaultValue)

protected String
public Expression
public XSDatatypeExp
resolveXSDatatype(String
The type of this value varies in the schema language. In XML Schema, for example, in which QNames are used to designate datatypes, this parameter will be QName. In RELAX Core, in which the same syntax is used but NCName is used to designate datatypes. So this parameter will be NCName.
typeQName
)

Implements com.sun.msv.reader.datatype.xsd.XSDatatypeResolver.resolveXSDatatype.

Resolves a simple type name into the corresponding XSDatatypeExp object.
public void
setAdditionalNamespaceMap(Map<String, String> additionalNamespaceMap)

public String[]
splitQName(String qName)

Overrides com.sun.msv.reader.GrammarReader.splitQName.

Resolves a QName into a pair of (namespace URI,local name).
protected void
switchSource(State sourceState, State newRootState)

protected void
wrapUp()

performs final wrap-up of parsing.

Inherited from com.sun.msv.reader.GrammarReader:
_parseaddBackPatchJobaddBackPatchJobcombineURIcombineURLcreateParserFactorydetectUndefinedOnesendPrefixMappinggetBackwardCompatibleTypegetBaseUrigetCurrentStategetDeclaredLocationOfgetLocatorinputSourceFromLSInputisNotationisUnparsedEntityiterateInscopeNamespacesonIDparseparseparsepopStatepushStatereportErrorreportErrorreportErrorreportErrorreportErrorreportErrorreportErrorreportErrorreportWarningreportWarningreportWarningreportWarningresolveLocationresolveNamespacePrefixrunBackPatchJobsetDeclaredLocationOfsetDocumentLocatorsetLocatorstartPrefixMappingswitchSourceswitchSourceswitchSource