本文整理汇总了Java中net.sf.saxon.om.NamespaceBinding类的典型用法代码示例。如果您正苦于以下问题:Java NamespaceBinding类的具体用法?Java NamespaceBinding怎么用?Java NamespaceBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NamespaceBinding类属于net.sf.saxon.om包,在下文中一共展示了NamespaceBinding类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: namespaceProcess
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
private void namespaceProcess(final XdmNode node) {
final NodeInfo inode = node.getUnderlyingNode();
final NamespaceBinding[] inscopeNS = inode.getDeclaredNamespaces(null);
// NamespaceIterator.getInScopeNamespaceCodes(inode);
if (inscopeNS.length > 0) {
for (final NamespaceBinding ns : inscopeNS) {
final String pfx = ns.getPrefix();
final String uri = ns.getURI();
this.doc.append(
AQuiXEvent.getNamespace(QuiXCharStream.fromSequence(pfx), QuiXCharStream.fromSequence(uri)));
}
}
// Careful, we're messing with the namespace bindings
// Make sure the nameCode is right...
// int nameCode = inode.getNameCode();
// int typeCode = inode.getTypeAnnotation() & NamePool.FP_MASK;
// String pfx = pool.getPrefix(nameCode);
// String uri = pool.getURI(nameCode);
// if (excludeDefault && "".equals(pfx) && !usesDefaultNS) {
// nameCode = pool.allocate("", "", pool.getLocalName(nameCode));
// }
// tree.addStartElement(nameCode, typeCode, newNS);
// tree.addAttributes(node);
}
示例2: getDeclaredNamespaces
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
@Override
public NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] buffer) {
if (nodeKind == Type.ELEMENT) {
Element elem = (Element)node;
int size = elem.getNamespaceDeclarationCount();
if (size == 0) {
return new NamespaceBinding[0];
}
NamespaceBinding[] result = (buffer != null && size <= buffer.length ? buffer : new NamespaceBinding[size]);
for (int i=0; i < size; i++) {
String prefix = elem.getNamespacePrefix(i);
String uri = elem.getNamespaceURI(prefix);
result[i] = new NamespaceBinding(prefix, uri);
}
if (size < result.length) {
result[size] = null;
}
return result;
}
return null;
}
示例3: afterPropertiesSet
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
@Override
@SuppressWarnings({ CompilerWarnings.UNCHECKED })
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
this.testcases = CrigttStreamUtils.toMap(IdentifiedBean::getId, Function.identity(), LinkedHashMap::new,
CrigttTestcaseUtils.buildTestcases(this.getTestcaseSources(), this.validateJaxbMarshaller).stream());
TinyTree docTree = ((TinyDocumentImpl) this.doc.getUnderlyingNode()).getTree();
for (NamespaceBinding namespaceBinding : docTree.getNamespaceBindings()) {
String prefix;
if (namespaceBinding != null && !this.docNamespaces.containsKey(prefix = namespaceBinding.getPrefix())) {
this.xpathContext.declareNamespace(prefix, namespaceBinding.getURI());
}
}
this.nullFlavors = Arrays.stream(NullFlavor.values()).map(NullFlavor::value).collect(Collectors.toList());
}
示例4: testGetDeclaredNamespaces
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
@Test
public void testGetDeclaredNamespaces() {
try {
rootNode.getDeclaredNamespaces(
new NamespaceBinding[] {new NamespaceBinding("prefix", "uri")});
fail("Exception is excepted");
}
catch (UnsupportedOperationException ex) {
assertEquals(
"Invalid exception message",
"Operation is not supported",
ex.getMessage());
}
}
示例5: namespace
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
@Override
public void namespace(NamespaceBinding namespaceBinding, int properties)
throws XPathException {
MatchContext context = matchContext.getLast();
if (context.matchedElement) {
super.namespace(namespaceBinding, properties);
}
}
示例6: namespace
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
@Override
public void namespace(NamespaceBinding nb, int i) throws XPathException {}
示例7: namespace
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
@Override
public void namespace(NamespaceBinding namespaceBinding, int properties)
throws XPathException {
reciever.namespace(namespaceBinding, properties);
}
示例8: getDeclaredNamespaces
import net.sf.saxon.om.NamespaceBinding; //导入依赖的package包/类
/**
* Returns namespace array. Throws {@code UnsupportedOperationException}, because no child
* class implements it and this method is not used for querying.
* @param namespaceBindings namespace array
* @return namespace array
*/
@Override
public final NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] namespaceBindings) {
throw throwUnsupportedOperationException();
}