/**
* creates a DOM Element and appends it to the current element in the tree.
* @param namespaceURI {@inheritDoc}
* @param localName {@inheritDoc}
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
*/
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException {
if(ownerDoc != null){
String qualifiedName = null;
String prefix = null;
if(namespaceURI == null ){
throw new XMLStreamException("NamespaceURI cannot be null");
}
if(localName == null){
throw new XMLStreamException("Local name cannot be null");
}
if(namespaceContext != null){
prefix = namespaceContext.getPrefix(namespaceURI);
}
if(prefix == null){
throw new XMLStreamException("Namespace URI "+namespaceURI +
"is not bound to any prefix" );
}
if("".equals(prefix)){
qualifiedName = localName;
}else{
qualifiedName = getQName(prefix,localName);
}
Element element = ownerDoc.createElementNS(namespaceURI, qualifiedName);
if(currentNode!=null){
currentNode.appendChild(element);
}else{
ownerDoc.appendChild(element);
}
currentNode = element;
}
if(needContextPop[depth]){
namespaceContext.pushContext();
}
incDepth();
}
XMLDOMWriterImpl.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:OpenJSharp
作者:
评论列表
文章目录