StaxEventXMLReader.java 文件源码

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

项目:spring4-understanding 作者:
private void handleStartElement(StartElement startElement) throws SAXException {
    if (getContentHandler() != null) {
        QName qName = startElement.getName();
        if (hasNamespacesFeature()) {
            for (Iterator i = startElement.getNamespaces(); i.hasNext();) {
                Namespace namespace = (Namespace) i.next();
                startPrefixMapping(namespace.getPrefix(), namespace.getNamespaceURI());
            }
            for (Iterator i = startElement.getAttributes(); i.hasNext();){
                Attribute attribute = (Attribute) i.next();
                QName attributeName = attribute.getName();
                startPrefixMapping(attributeName.getPrefix(), attributeName.getNamespaceURI());
            }

            getContentHandler().startElement(qName.getNamespaceURI(), qName.getLocalPart(), toQualifiedName(qName),
                    getAttributes(startElement));
        }
        else {
            getContentHandler().startElement("", "", toQualifiedName(qName), getAttributes(startElement));
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号