use of net.sf.saxon.pattern.NameTest in project sirix by sirixdb.
the class NodeWrapper method getAttributeValue.
@Override
public String getAttributeValue(final int fingerprint) {
String attVal = null;
final NameTest test = new NameTest(Type.ATTRIBUTE, fingerprint, getNamePool());
final AxisIterator iterator = iterateAxis(Axis.ATTRIBUTE, test);
final NodeInfo attribute = (NodeInfo) iterator.next();
if (attribute != null) {
attVal = attribute.getStringValue();
}
return attVal;
}
use of net.sf.saxon.pattern.NameTest in project sirix by sirixdb.
the class TestNodeWrapper method testGetBaseURI.
@Test
public void testGetBaseURI() throws Exception {
// Test with xml:base specified.
final File source = new File("src" + File.separator + "test" + File.separator + "resources" + File.separator + "data" + File.separator + "testBaseURI.xml");
final Session session = generateSession();
final NodeWriteTrx wtx = session.beginNodeWriteTrx();
final XMLEventReader reader = XMLShredder.createFileReader(source);
final XMLShredder shredder = new XMLShredder.Builder(wtx, reader, Insert.ASFIRSTCHILD).commitAfterwards().build();
shredder.call();
wtx.close();
final Processor proc = new Processor(false);
final NodeInfo doc = new DocumentWrapper(session, proc.getUnderlyingConfiguration());
doc.getNamePool().allocate("xml", "http://www.w3.org/XML/1998/namespace", "base");
doc.getNamePool().allocate("", "", "baz");
final NameTest test = new NameTest(Type.ELEMENT, "", "baz", doc.getNamePool());
final AxisIterator iterator = doc.iterateAxis(Axis.DESCENDANT, test);
final NodeInfo baz = (NodeInfo) iterator.next();
assertEquals("http://example.org", baz.getBaseURI());
session.close();
mDatabase.close();
}
Aggregations