下面列出了org.w3c.dom.TypeInfo#com.sun.org.apache.xerces.internal.xni.Augmentations 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Ignorable whitespace. For this method to be called, the document
* source must have some way of determining that the text containing
* only whitespace characters should be considered ignorable. For
* example, the validator can determine if a length of whitespace
* characters in the document are ignorable based on the element
* content model.
*
* @param text The ignorable whitespace.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
try {
// SAX1
if (fDocumentHandler != null) {
fDocumentHandler.ignorableWhitespace(text.ch, text.offset, text.length);
}
// SAX2
if (fContentHandler != null) {
fContentHandler.ignorableWhitespace(text.ch, text.offset, text.length);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
/**
* A notation declaration
*
* @param name The name of the notation.
* @param identifier An object containing all location information
* pertinent to this notation.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void notationDecl(String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {
try {
// SAX1 and SAX2
if (fDTDHandler != null) {
String publicId = identifier.getPublicId();
String systemId = fResolveDTDURIs ?
identifier.getExpandedSystemId() : identifier.getLiteralSystemId();
fDTDHandler.notationDecl(name, publicId, systemId);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
/**
* An external entity declaration.
*
* @param name The name of the entity. Parameter entity names start
* with '%', whereas the name of a general entity is just
* the entity name.
* @param identifier An object containing all location information
* pertinent to this external entity.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void externalEntityDecl(String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {
DTDGrammar grammar = (fDTDGrammar != null? fDTDGrammar: fGrammarBucket.getActiveGrammar());
int index = grammar.getEntityDeclIndex(name) ;
//If the same entity is declared more than once, the first declaration
//encountered is binding, SAX requires only effective(first) declaration
//to be reported to the application
//REVISIT: Does it make sense to pass duplicate entity information across
//the pipeline -- nb?
//its a new entity and hasn't been declared.
if(index == -1){
//store external entity declaration in grammar
if(fDTDGrammar != null)
fDTDGrammar.externalEntityDecl(name, identifier, augs);
// call handlers
if (fDTDHandler != null) {
fDTDHandler.externalEntityDecl(name, identifier, augs);
}
}
}
/**
* A notation declaration
*
* @param name The name of the notation.
* @param identifier An object containing all location information
* pertinent to this notation.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void notationDecl(String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {
try {
// SAX1 and SAX2
if (fDTDHandler != null) {
String publicId = identifier.getPublicId();
String systemId = fResolveDTDURIs ?
identifier.getExpandedSystemId() : identifier.getLiteralSystemId();
fDTDHandler.notationDecl(name, publicId, systemId);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
/**
* The end of the DTD.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void endDTD (Augmentations augs) throws XNIException {
if (DEBUG_EVENTS) {
System.out.println ("==>endDTD()");
}
fInDTD = false;
if (!fBaseURIStack.isEmpty ()) {
fBaseURIStack.pop ();
}
String internalSubset = fInternalSubset != null && fInternalSubset.length () > 0
? fInternalSubset.toString () : null;
if (fDeferNodeExpansion) {
if (internalSubset != null) {
fDeferredDocumentImpl.setInternalSubset (fDocumentTypeIndex, internalSubset);
}
}
else if (fDocumentImpl != null) {
if (internalSubset != null) {
((DocumentTypeImpl)fDocumentType).setInternalSubset (internalSubset);
}
}
}
/** Handles end element. */
protected void endNamespaceScope(QName element, Augmentations augs, boolean isEmpty)
throws XNIException {
// bind element
String eprefix = element.prefix != null ? element.prefix : XMLSymbols.EMPTY_STRING;
element.uri = fNamespaceContext.getURI(eprefix);
if (element.uri != null) {
element.prefix = eprefix;
}
// call handlers
if (fDocumentHandler != null) {
if (!isEmpty) {
fDocumentHandler.endElement(element, augs);
}
}
// pop context
fNamespaceContext.popContext();
}
public void startDocument(
XMLLocator locator,
String encoding,
NamespaceContext namespaceContext,
Augmentations augs)
throws XNIException {
side.startDocument(locator, encoding, namespaceContext, augs);
next.startDocument(locator, encoding, namespaceContext, augs);
}
protected void endNamespaceScope(QName element, Augmentations augs, boolean isEmpty){
// call handlers
if (fDocumentHandler != null && !isEmpty) {
// NOTE: The binding of the element doesn't actually happen
// yet because the namespace binder does that. However,
// if it does it before this point, then the endPrefix-
// Mapping calls get made too soon! As long as the
// rawnames match, we know it'll have a good binding,
// so we can just use the current element. -Ac
fDocumentHandler.endElement(fCurrentElement, augs);
}
}
/**
* The end of the document.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void endDocument(Augmentations augs) throws XNIException {
// call handlers
if (fDocumentHandler != null) {
fDocumentHandler.endDocument(augs);
}
}
@Override
public void notationDecl(
String name,
XMLResourceIdentifier identifier,
Augmentations augmentations)
throws XNIException {
this.addNotation(name, identifier, augmentations);
if (fDTDHandler != null) {
fDTDHandler.notationDecl(name, identifier, augmentations);
}
}
/**
* The end of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void endCDATA(Augmentations augs) throws XNIException {
fInCDATASection = false;
// call handlers
if (fDocumentHandler != null) {
fDocumentHandler.endCDATA(augs);
}
}
@Override
public void xmlDecl(
String version,
String encoding,
String standalone,
Augmentations augs)
throws XNIException {
fIsXML11 = "1.1".equals(version);
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.xmlDecl(version, encoding, standalone, augs);
}
}
@Override
public void startParameterEntity(
String name,
XMLResourceIdentifier identifier,
String encoding,
Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.startParameterEntity(
name,
identifier,
encoding,
augmentations);
}
}
/**
* The start of a conditional section.
*
* @param type The type of the conditional section. This value will
* either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*
* @see #CONDITIONAL_INCLUDE
* @see #CONDITIONAL_IGNORE
*/
public void startConditional(short type, Augmentations augs) throws XNIException {
// set state
fInDTDIgnore = type == XMLDTDHandler.CONDITIONAL_IGNORE;
// call handlers
if(fDTDGrammar != null)
fDTDGrammar.startConditional(type, augs);
if (fDTDHandler != null) {
fDTDHandler.startConditional(type, augs);
}
}
/**
* The start of the DTD external subset.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startExternalSubset(XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {
if(fDTDGrammar != null)
fDTDGrammar.startExternalSubset(identifier, augs);
if(fDTDHandler != null){
fDTDHandler.startExternalSubset(identifier, augs);
}
}
/**
* The start of a CDATA section.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startCDATA(Augmentations augs) throws XNIException {
try {
// SAX2 extension
if (fLexicalHandler != null) {
fLexicalHandler.startCDATA();
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
/**
* A comment.
*
* @param text The text in the comment.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by application to signal an error.
*/
public void comment(XMLString text, Augmentations augs) throws XNIException {
// call handlers
if (fDocumentHandler != null) {
fDocumentHandler.comment(text, augs);
}
}
@Override
public void xmlDecl(
String version,
String encoding,
String standalone,
Augmentations augs)
throws XNIException {
fIsXML11 = "1.1".equals(version);
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.xmlDecl(version, encoding, standalone, augs);
}
}
/**
* The end of a group for mixed or children content models.
*
* @param augs Additional information that may include infoset
* augmentations.
* @throws XNIException Thrown by handler to signal an error.
*/
public void endGroup(Augmentations augs) throws XNIException {
if (!fMixed) {
if (fPrevNodeIndexStack[fDepth] != -1) {
fNodeIndexStack[fDepth] = addContentSpecNode(fOpStack[fDepth], fPrevNodeIndexStack[fDepth], fNodeIndexStack[fDepth]);
}
int nodeIndex = fNodeIndexStack[fDepth--];
fNodeIndexStack[fDepth] = nodeIndex;
}
}
public void characters(XMLString text, Augmentations augs)
throws XNIException {
if (!fIgnoreChars) {
final Element currentElement = (Element) fDOMValidatorHelper.getCurrentElement();
currentElement.appendChild(fDocument.createTextNode(text.toString()));
}
}
/**
* An element declaration.
*
* @param name The name of the element.
* @param contentModel The element content model.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void elementDecl(String name, String contentModel, Augmentations augs)
throws XNIException {
try {
// SAX2 extension
if (fDeclHandler != null) {
fDeclHandler.elementDecl(name, contentModel);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
/**
* This method notifies of the start of an entity. The DTD has the
* pseudo-name of "[dtd]" parameter entity names start with '%'; and
* general entities are just specified by their name.
*
* @param name The name of the entity.
* @param identifier The resource identifier.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal entities or a document entity that is
* parsed from a java.io.Reader).
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void startEntity(String name,
XMLResourceIdentifier identifier,
String encoding, Augmentations augs) throws XNIException {
// keep track of this entity before fEntityDepth is increased
if (fEntityDepth == fEntityStack.length) {
int[] entityarray = new int[fEntityStack.length * 2];
System.arraycopy(fEntityStack, 0, entityarray, 0, fEntityStack.length);
fEntityStack = entityarray;
}
fEntityStack[fEntityDepth] = fMarkupDepth;
super.startEntity(name, identifier, encoding, augs);
// WFC: entity declared in external subset in standalone doc
if(fStandalone && fEntityStore.isEntityDeclInExternalSubset(name)) {
reportFatalError("MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE",
new Object[]{name});
}
/** we are not calling the handlers yet.. */
// call handler
if (fDocumentHandler != null && !fScanningAttribute) {
if (!name.equals("[xml]")) {
fDocumentHandler.startGeneralEntity(name, identifier, encoding, augs);
}
}
}
public boolean resolveXPointer(QName element, XMLAttributes attributes,
Augmentations augs, int event) throws XNIException {
// reset fIsFragmentResolved
if (fMatchingChildCount == 0) {
fIsFragmentResolved = false;
}
// On startElement or emptyElement, if no matching elements or parent
// elements were found, check for a matching idenfitier.
if (event == XPointerPart.EVENT_ELEMENT_START) {
if (fMatchingChildCount == 0) {
fIsFragmentResolved = hasMatchingIdentifier(element, attributes, augs,
event);
}
if (fIsFragmentResolved) {
fMatchingChildCount++;
}
} else if (event == XPointerPart.EVENT_ELEMENT_EMPTY) {
if (fMatchingChildCount == 0) {
fIsFragmentResolved = hasMatchingIdentifier(element, attributes, augs,
event);
}
}
else {
// On endElement, decrease the matching child count if the child or
// its parent was resolved.
if (fIsFragmentResolved) {
fMatchingChildCount--;
}
}
return fIsFragmentResolved ;
}
@Override
public void ignoredCharacters(XMLString text, Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.ignoredCharacters(text, augmentations);
}
}
protected void endNamespaceScope(QName element, Augmentations augs, boolean isEmpty){
// call handlers
if (fDocumentHandler != null && !isEmpty) {
// NOTE: The binding of the element doesn't actually happen
// yet because the namespace binder does that. However,
// if it does it before this point, then the endPrefix-
// Mapping calls get made too soon! As long as the
// rawnames match, we know it'll have a good binding,
// so we can just use the current element. -Ac
fDocumentHandler.endElement(fCurrentElement, augs);
}
}
/**
* An element declaration.
*
* @param name The name of the element.
* @param contentModel The element content model.
*
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void elementDecl(String name, String contentModel, Augmentations augs)
throws XNIException {
try {
// SAX2 extension
if (fDeclHandler != null) {
fDeclHandler.elementDecl(name, contentModel);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
@Override
public void startAttlist(String elementName, Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.startAttlist(elementName, augmentations);
}
}
public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs)
throws XNIException {
side.doctypeDecl(rootElement, publicId, systemId, augs);
next.doctypeDecl(rootElement, publicId, systemId, augs);
}
public void xmlDecl(String version, String encoding, String standalone,
Augmentations augs) throws XNIException {}
public void internalEntityDecl(String name, XMLString text, XMLString nonNormalizedText, Augmentations augmentations) throws XNIException {
throw Abort.INSTANCE;
}