XMLStreamReaderToXMLStreamWriter.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
/**
 * Writes out the {@code i}-th attribute of the current element.
 *
 * <p>
 * Used from {@link #handleStartElement()}.
 */
protected void handleAttribute(int i) throws XMLStreamException {
    String nsUri = in.getAttributeNamespace(i);
    String prefix = in.getAttributePrefix(i);
     if (fixNull(nsUri).equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
         //Its a namespace decl, ignore as it is already written.
         return;
     }

    if(nsUri==null || prefix == null || prefix.equals("")) {
        out.writeAttribute(
            in.getAttributeLocalName(i),
            in.getAttributeValue(i)
        );
    } else {
        out.writeAttribute(
            prefix,
            nsUri,
            in.getAttributeLocalName(i),
            in.getAttributeValue(i)
        );
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号