Java Code Examples for com.sun.org.apache.xerces.internal.xni.XMLAttributes#removeAllAttributes()

The following examples show how to use com.sun.org.apache.xerces.internal.xni.XMLAttributes#removeAllAttributes() . 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: SchemaDOMParser.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 2
Source File: SchemaDOMParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 3
Source File: SchemaDOMParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 4
Source File: SchemaDOMParser.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 5
Source File: SchemaDOMParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 6
Source File: SchemaDOMParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 7
Source File: SchemaDOMParser.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 8
Source File: SchemaDOMParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 9
Source File: SchemaDOMParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 10
Source File: SchemaDOMParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}
 
Example 11
Source File: SchemaDOMParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {

    if (fGenerateSyntheticAnnotation && fAnnotationDepth == -1 &&
            element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart != SchemaSymbols.ELT_ANNOTATION && hasNonSchemaAttributes(element, attributes)) {

        schemaDOM.startElement(element, attributes,
                fLocator.getLineNumber(),
                fLocator.getColumnNumber(),
                fLocator.getCharacterOffset());

        attributes.removeAllAttributes();
        String schemaPrefix = fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
        final String annRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_ANNOTATION);
        schemaDOM.startAnnotation(annRawName, attributes, fNamespaceContext);
        final String elemRawName = (schemaPrefix.length() == 0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' + SchemaSymbols.ELT_DOCUMENTATION);
        schemaDOM.startAnnotationElement(elemRawName, attributes);
        schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
        schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
        schemaDOM.endSyntheticAnnotationElement(annRawName, true);

        schemaDOM.endElement();

        return;
    }
    // the order of events that occurs here is:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.emptyElement  (basically the same as startElement then endElement)
    //   schemaDOM.endAnnotationElement (if applicable)
    // the order of events that would occur if this was <element></element>:
    //   schemaDOM.startAnnotation/startAnnotationElement (if applicable)
    //   schemaDOM.startElement
    //   schemaDOM.endAnnotationElement (if applicable)
    //   schemaDOM.endElementElement
    // Thus, we can see that the order of events isn't the same.  However, it doesn't
    // seem to matter.  -- PJM
    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.startAnnotation(element, attributes, fNamespaceContext);
        }
    }
    else {
        schemaDOM.startAnnotationElement(element, attributes);
    }

    ElementImpl newElem = schemaDOM.emptyElement(element, attributes,
            fLocator.getLineNumber(),
            fLocator.getColumnNumber(),
            fLocator.getCharacterOffset());

    if (fAnnotationDepth == -1) {
        // this is messed up, but a case to consider:
        if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA &&
                element.localpart == SchemaSymbols.ELT_ANNOTATION) {
            schemaDOM.endAnnotation(element, newElem);
        }
    }
    else {
        schemaDOM.endAnnotationElement(element);
    }
}