public class NGCCRuntimeEx extends NGCCRuntime implements PatcherManager
PatcherManager.Patcher
Modifier and Type | Field and Description |
---|---|
boolean |
attributeFormDefault
The @attributeFormDefault value of the current schema.
|
int |
blockDefault
The @blockDefault value of the current schema.
|
boolean |
chameleonMode
True if the current schema is in a chameleon mode.
|
SchemaImpl |
currentSchema
The schema currently being parsed.
|
SchemaDocumentImpl |
document
Points to the
SchemaDocumentImpl that represents the
schema document being parsed. |
boolean |
elementFormDefault
The @elementFormDefault value of the current schema.
|
int |
finalDefault
The @finalDefault value of the current schema.
|
ParserContext |
parser
coordinator.
|
static String |
XMLSchemaNSURI |
Modifier and Type | Method and Description |
---|---|
void |
addErrorChecker(Patch patcher) |
void |
addPatcher(Patch patcher) |
void |
checkDoubleDefError(XSDeclaration c) |
String |
collapse(String text)
Utility function for collapsing the namespaces inside qname declarations
and 'name' attribute values that should contain the qname values
|
Locator |
copyLocator()
Creates a copy of the current locator object.
|
AnnotationParser |
createAnnotationParser()
Creates a new instance of annotation parser.
|
ValidationContext |
createValidationContext()
Returns an immutable snapshot of the current context.
|
XmlString |
createXmlString(String value) |
void |
endPrefixMapping(String prefix) |
String |
getAnnotationContextElementName()
Gets the element name that contains the annotation element.This method works correctly only when called by the annotation handler.
|
ErrorHandler |
getErrorHandler() |
boolean |
hasAlreadyBeenRead()
Called when a new document is being parsed and checks
if the document has already been parsed before.
|
static boolean |
ignorableDuplicateComponent(XSDeclaration c) |
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 |
parseBoolean(String v) |
void |
parseEntity(InputSource source,
boolean includeMode,
String expectedNamespace,
Locator importLocation)
Parses the specified entity.
|
ForeignAttributesImpl |
parseForeignAttributes(ForeignAttributesImpl next) |
UName |
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.
|
void |
startPrefixMapping(String prefix,
String uri) |
protected void |
unexpectedX(String token) |
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
public final ParserContext parser
public SchemaImpl currentSchema
public int finalDefault
public int blockDefault
public boolean elementFormDefault
public boolean attributeFormDefault
public boolean chameleonMode
public SchemaDocumentImpl document
SchemaDocumentImpl
that represents the
schema document being parsed.public static final String XMLSchemaNSURI
public void checkDoubleDefError(XSDeclaration c) throws SAXException
SAXException
public static boolean ignorableDuplicateComponent(XSDeclaration c)
public void addPatcher(Patch patcher)
addPatcher
in interface PatcherManager
public void addErrorChecker(Patch patcher)
addErrorChecker
in interface PatcherManager
public void reportError(String msg, Locator loc) throws SAXException
PatcherManager
reportError
in interface PatcherManager
loc
- location of the error in the source file, or null if
it's unavailable.SAXException
public void reportError(String msg) throws SAXException
SAXException
public void includeSchema(String schemaLocation) throws SAXException
schemaLocation
- SAXException
public void importSchema(String ns, String schemaLocation) throws SAXException
ns
- schemaLocation
- SAXException
public boolean hasAlreadyBeenRead()
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.
public void parseEntity(InputSource source, boolean includeMode, String expectedNamespace, Locator importLocation) throws SAXException
source
- importLocation
- The source location of the import/include statement.
Used for reporting errors.includeMode
- expectedNamespace
- SAXException
public AnnotationParser createAnnotationParser()
public String getAnnotationContextElementName()
public Locator copyLocator()
public ErrorHandler getErrorHandler()
public void onEnterElementConsumed(String uri, String localName, String qname, Attributes atts) throws SAXException
NGCCRuntime
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.
onEnterElementConsumed
in class NGCCRuntime
SAXException
public void onLeaveElementConsumed(String uri, String localName, String qname) throws SAXException
onLeaveElementConsumed
in class NGCCRuntime
SAXException
public ValidationContext createValidationContext()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class NGCCRuntime
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class NGCCRuntime
SAXException
public UName parseUName(String qname) throws SAXException
qname
- Attribute name.UName
instance based on attribute name.SAXException
public String collapse(String text)
text
- String where whitespaces should be collapsedpublic boolean parseBoolean(String v)
protected void unexpectedX(String token) throws SAXException
unexpectedX
in class NGCCRuntime
SAXException
public ForeignAttributesImpl parseForeignAttributes(ForeignAttributesImpl next)
Copyright © 2021 JBoss by Red Hat. All rights reserved.