/**
* Adds a namespace mapping for [name] to [namespaces], if it doesn't already exist on [writer].
*/
private static boolean register(XMLEventWriter writer, List<Namespace> namespaces, QName name) {
String nsUri = name.getNamespaceURI();
if (nsUri != null && !nsUri.isEmpty()) {
String existing = writer.getNamespaceContext().getNamespaceURI(name.getPrefix());
Namespace ns = evtFactory.createNamespace(name.getPrefix(), nsUri);
if ((existing == null || !existing.equals(nsUri)) && !namespaces.stream().anyMatch(n ->
n.getPrefix().equals(ns.getPrefix())
)) {
namespaces.add(ns);
return true;
}
}
return false;
}
StaxWriter.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:ts-reaktive
作者:
评论列表
文章目录