com.sun.org.apache.xerces.internal.xni.Augmentations Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xni.Augmentations. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLNSDTDValidator.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/** 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();

}
 
Example #2
Source File: AbstractDOMParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example #3
Source File: AbstractSAXParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }

}
 
Example #4
Source File: AbstractSAXParser.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }

}
 
Example #5
Source File: AbstractSAXParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }

}
 
Example #6
Source File: XMLDTDProcessor.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
        }
    }

}
 
Example #7
Source File: ShortHandPointer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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 ;
}
 
Example #8
Source File: DTDGrammar.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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;
    }

}
 
Example #9
Source File: XMLDTDValidator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
        }
    }
 
Example #10
Source File: XMLDTDValidator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }

}
 
Example #11
Source File: TeeXMLDocumentFilterImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #12
Source File: AbstractSAXParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }

}
 
Example #13
Source File: AbstractSAXParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }

}
 
Example #14
Source File: XIncludeHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example #15
Source File: DOMResultAugmentor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void characters(XMLString text, Augmentations augs)
        throws XNIException {
    if (!fIgnoreChars) {
        final Element currentElement = (Element) fDOMValidatorHelper.getCurrentElement();
        currentElement.appendChild(fDocument.createTextNode(text.toString()));
    }
}
 
Example #16
Source File: XIncludeHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void startAttlist(String elementName, Augmentations augmentations)
    throws XNIException {
    if (fDTDHandler != null) {
        fDTDHandler.startAttlist(elementName, augmentations);
    }
}
 
Example #17
Source File: AbstractSAXParser.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }

}
 
Example #18
Source File: XMLDTDValidator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
        }
    }
 
Example #19
Source File: XMLDTDValidator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }

}
 
Example #20
Source File: XIncludeHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example #21
Source File: XIncludeHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example #22
Source File: XIncludeHandler.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void startParameterEntity(
    String name,
    XMLResourceIdentifier identifier,
    String encoding,
    Augmentations augmentations)
    throws XNIException {
    if (fDTDHandler != null) {
        fDTDHandler.startParameterEntity(
            name,
            identifier,
            encoding,
            augmentations);
    }
}
 
Example #23
Source File: XIncludeHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void ignoredCharacters(XMLString text, Augmentations augmentations)
    throws XNIException {
    if (fDTDHandler != null) {
        fDTDHandler.ignoredCharacters(text, augmentations);
    }
}
 
Example #24
Source File: XMLDTDProcessor.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }

}
 
Example #25
Source File: XMLSchemaValidator.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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);
    }

}
 
Example #26
Source File: XMLDTDProcessor.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #27
Source File: XMLDocumentFragmentScannerImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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);
        }
    }

}
 
Example #28
Source File: TeeXMLDocumentFilterImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException {
    side.emptyElement(element, attributes, augs);
    next.emptyElement(element, attributes, augs);
}
 
Example #29
Source File: XMLDocumentFilterImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void textDecl(String version, String encoding, Augmentations augs) throws XNIException {
    next.textDecl(version, encoding, augs);
}
 
Example #30
Source File: DOMParserImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public void notationDecl(String name, XMLResourceIdentifier identifier, Augmentations augmentations) throws XNIException {
    throw Abort.INSTANCE;
}