javax.xml.stream.events.StartElement#isStartElement ( )源码实例Demo

下面列出了javax.xml.stream.events.StartElement#isStartElement ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk1.8-source-analysis   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码2 项目: TencentKona-8   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码3 项目: jdk8u60   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码4 项目: JDKSourceCode1.8   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码5 项目: openjdk-jdk8u   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码7 项目: Bytecoder   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator<Attribute> i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码8 项目: openjdk-jdk9   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码9 项目: hottub   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码10 项目: openjdk-8-source   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
源代码11 项目: openjdk-8   文件: StAXEvent2SAX.java
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}