Class NGCCRuntimeEx
- All Implemented Interfaces:
PatcherManager
,NGCCEventSource
,ContentHandler
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.sun.xml.xsom.impl.parser.PatcherManager
PatcherManager.Patcher
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
The @attributeFormDefault value of the current schema.int
The @blockDefault value of the current schema.boolean
True if the current schema is in a chameleon mode.private NGCCRuntimeEx.Context
The schema currently being parsed.Points to theSchemaDocumentImpl
that represents the schema document being parsed.private String
URI that identifies the schema document.boolean
The @elementFormDefault value of the current schema.Keep the local name of elements encountered so far.int
The @finalDefault value of the current schema.final ParserContext
coordinator.private final NGCCRuntimeEx
Points to the schema document (the parser of it) that included/imported this schema.static final String
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
NGCCRuntimeEx
(ParserContext _parser) private
NGCCRuntimeEx
(ParserContext _parser, boolean chameleonMode, NGCCRuntimeEx referer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addErrorChecker
(Patch patcher) void
addPatcher
(Patch patcher) void
Creates a copy of the current locator object.Creates a new instance of annotation parser.org.relaxng.datatype.ValidationContext
Returns an immutable snapshot of the current context.createXmlString
(String value) void
endPrefixMapping
(String prefix) Gets the element name that contains the annotation element.boolean
Called when a new document is being parsed and checks if the document has already been parsed before.static boolean
void
importSchema
(String ns, String schemaLocation) Imports the specified schema.void
includeSchema
(String schemaLocation) Includes the specified schema.void
onEnterElementConsumed
(String uri, String localName, String qname, Attributes atts) Called by the generated handler code when an enter element event is consumed.void
onLeaveElementConsumed
(String uri, String localName, String qname) boolean
void
parseEntity
(InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation) Parses the specified entity.parseUName
(String qname) Parses UName under the given context.void
reportError
(String msg) void
reportError
(String msg, Locator loc) Reports an error during the parsing.private InputSource
resolveRelativeURL
(String namespaceURI, String relativeUri) Resolves relative URI found in the document.void
startPrefixMapping
(String prefix, String uri) protected void
unexpectedX
(String token) Methods inherited from class com.sun.xml.xsom.impl.parser.state.NGCCRuntime
characters, consumeAttribute, endDocument, endElement, getAttributeIndex, getCurrentAttributes, getLocator, ignorableWhitespace, processingInstruction, processList, redirectSubtree, replace, reset, resolveNamespacePrefix, sendEnterAttribute, sendEnterElement, sendLeaveAttribute, sendLeaveElement, sendText, setDocumentLocator, setRootHandler, skippedEntity, startDocument, startElement, trace, traceln
-
Field Details
-
parser
coordinator. -
currentSchema
The schema currently being parsed. -
finalDefault
public int finalDefaultThe @finalDefault value of the current schema. -
blockDefault
public int blockDefaultThe @blockDefault value of the current schema. -
elementFormDefault
public boolean elementFormDefaultThe @elementFormDefault value of the current schema. True if local elements are qualified by default. -
attributeFormDefault
public boolean attributeFormDefaultThe @attributeFormDefault value of the current schema. True if local attributes are qualified by default. -
chameleonMode
public boolean chameleonModeTrue if the current schema is in a chameleon mode. This changes the way QNames are interpreted. Life is very miserable with XML Schema, as you see. -
documentSystemId
URI that identifies the schema document. Maybe null if the system ID is not available. -
elementNames
Keep the local name of elements encountered so far. This information is passed to AnnotationParser as context information -
referer
Points to the schema document (the parser of it) that included/imported this schema. -
document
Points to theSchemaDocumentImpl
that represents the schema document being parsed. -
currentContext
-
XMLSchemaNSURI
- See Also:
-
-
Constructor Details
-
NGCCRuntimeEx
NGCCRuntimeEx(ParserContext _parser) -
NGCCRuntimeEx
-
-
Method Details
-
checkDoubleDefError
- Throws:
SAXException
-
ignorableDuplicateComponent
-
addPatcher
- Specified by:
addPatcher
in interfacePatcherManager
-
addErrorChecker
- Specified by:
addErrorChecker
in interfacePatcherManager
-
reportError
Description copied from interface:PatcherManager
Reports an error during the parsing.- Specified by:
reportError
in interfacePatcherManager
- Parameters:
loc
- location of the error in the source file, or null if it's unavailable.- Throws:
SAXException
-
reportError
- Throws:
SAXException
-
resolveRelativeURL
Resolves relative URI found in the document.- Parameters:
namespaceURI
- passed to the entity resolver.relativeUri
- value of the schemaLocation attribute. Can be null.- Returns:
- non-null if
EntityResolver
returned anInputSource
, or if the relativeUri parameter seems to be pointing to something. Otherwise it returns null, in which case import/include should be abandoned. - Throws:
SAXException
-
includeSchema
Includes the specified schema.- Throws:
SAXException
-
importSchema
Imports the specified schema.- Throws:
SAXException
-
hasAlreadyBeenRead
public boolean hasAlreadyBeenRead()Called when a new document is being parsed and checks if the document has already been parsed before.Used to avoid recursive inclusion. Note that the same document will be parsed multiple times if they are for different target namespaces.
Document Graph Model
The challenge we are facing here is that you have a graph of documents that reference each other. Each document has an unique URI to identify themselves, and references are done by using those. The graph may contain cycles.
Our goal here is to parse all the documents in the graph, without parsing the same document twice. This method implements this check.
One complication is the chameleon schema; a document can be parsed multiple times if they are under different target namespaces.
Also, note that when you resolve relative URIs in the @schemaLocation, their base URI is *NOT* the URI of the document.
- Returns:
- true if the document has already been processed and thus needs to be skipped.
-
parseEntity
public void parseEntity(InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation) throws SAXException Parses the specified entity.- Parameters:
importLocation
- The source location of the import/include statement. Used for reporting errors.- Throws:
SAXException
-
createAnnotationParser
Creates a new instance of annotation parser. -
getAnnotationContextElementName
Gets the element name that contains the annotation element. This method works correctly only when called by the annotation handler. -
copyLocator
Creates a copy of the current locator object. -
getErrorHandler
-
onEnterElementConsumed
public void onEnterElementConsumed(String uri, String localName, String qname, Attributes atts) throws SAXException Description copied from class:NGCCRuntime
Called by the generated handler code when an enter element event is consumed.Pushes a new attribute set.
Note that attributes are NOT pushed at the startElement method, because the processing of the enterElement event can trigger other attribute events and etc.
This method will be called from one of handlers when it truely consumes the enterElement event.
- Overrides:
onEnterElementConsumed
in classNGCCRuntime
- Throws:
SAXException
-
onLeaveElementConsumed
- Overrides:
onLeaveElementConsumed
in classNGCCRuntime
- Throws:
SAXException
-
createValidationContext
public org.relaxng.datatype.ValidationContext createValidationContext()Returns an immutable snapshot of the current context. -
createXmlString
-
startPrefixMapping
- Specified by:
startPrefixMapping
in interfaceContentHandler
- Overrides:
startPrefixMapping
in classNGCCRuntime
- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Overrides:
endPrefixMapping
in classNGCCRuntime
- Throws:
SAXException
-
parseUName
Parses UName under the given context.- Throws:
SAXException
-
parseBoolean
-
unexpectedX
- Overrides:
unexpectedX
in classNGCCRuntime
- Throws:
SAXException
-
parseForeignAttributes
-