use of net.sf.saxon.tree.iter.NamespaceIterator.NamespaceNodeImpl in project sirix by sirixdb.
the class TestNodeWrapper method testGetStringValueCS.
@Test
public void testGetStringValueCS() {
// Test on document node.
assertEquals("oops1foooops2baroops3", node.getStringValueCS());
// Test on element node.
AxisIterator iterator = node.iterateAxis(Axis.DESCENDANT);
node = (NodeWrapper) iterator.next();
assertEquals("oops1foooops2baroops3", node.getStringValueCS());
// Test on namespace node.
iterator = node.iterateAxis(Axis.NAMESPACE);
NamespaceNodeImpl namespace = (NamespaceNodeImpl) iterator.next();
/*
* Elements have always the default xml:NamespaceConstant.XML namespace, so
* we have to search if "ns" is found somewhere in the iterator (order
* unpredictable because it's implemented with a HashMap internally).
*/
while (!"ns".equals(namespace.getStringValueCS()) && namespace != null) {
namespace = (NamespaceNodeImpl) iterator.next();
}
if (namespace == null) {
fail("namespace is null!");
} else {
assertEquals("ns", namespace.getStringValueCS());
}
// Test on attribute node.
final NodeWrapper attrib = (NodeWrapper) node.iterateAxis(Axis.ATTRIBUTE).next();
assertEquals("j", attrib.getStringValueCS());
// Test on text node.
final NodeWrapper text = (NodeWrapper) node.iterateAxis(Axis.CHILD).next();
assertEquals("oops1", text.getStringValueCS());
}
Aggregations