private XdmNode parse(String uri, String base) { XdmNode doc = runtime.parse(uri, base); if (uri.contains("#")) { int pos = uri.indexOf("#"); String ptr = uri.substring(pos+1); if (ptr.matches("^[\\w]+$")) { ptr = "element(" + ptr + ")"; } XPointer xptr = new XPointer(runtime, ptr, 1024 * 1000); // does this need to be configurable? No, because there can be only one fragid, right? Vector<XdmNode> nodes = xptr.selectNodes(runtime, doc); if (nodes.size() == 1) { doc = nodes.get(0); } else if (nodes.size() != 0) { throw new XProcException(node, "XPointer matches more than one node!?"); } } return doc; } }
private XdmNode parse(String uri, String base) { XdmNode doc = runtime.parse(uri, base); if (uri.contains("#")) { int pos = uri.indexOf("#"); String ptr = uri.substring(pos+1); if (ptr.matches("^[\\w]+$")) { ptr = "element(" + ptr + ")"; } XPointer xptr = new XPointer(runtime, ptr, 1024 * 1000); // does this need to be configurable? No, because there can be only one fragid, right? Vector<XdmNode> nodes = xptr.selectNodes(runtime, doc); if (nodes.size() == 1) { doc = nodes.get(0); } else if (nodes.size() != 0) { throw new XProcException(node, "XPointer matches more than one node!?"); } } return doc; } }
public void testXmlns() { XPointer xp = new XPointer(runtime, "xmlns(a=http://example.com/a) xmlns(b=http://example.com/b)", 1024000); assertNotNull(xp); xp = new XPointer(runtime, "xmlns(a=http://example.com/a)xmlns(b=http://example.com/b)", 1024000); assertNotNull(xp); xp = new XPointer(runtime, "xmlns(a=http://example.com/^(a^))xmlns(b=http://example.com/b)", 1024000); assertNotNull(xp); }
public void testSchemes() { XPointer xp = new XPointer(runtime, "xmlns(a=http://example.com/a) a:unk(a=^^b)", 1024000); assertNotNull(xp); xp = new XPointer(runtime, "xmlns(a=http://example.com/a)xmlns(b=http://example.com/b) a:unk(a) b:unk(b)", 1024000); assertNotNull(xp); /* xp = new XPointer("xmlns(a=http://example.com/^(a^))xmlns(b=http://example.com/b) c:unk()", 1024000); assertNotNull(xp); */ } }
xpointer = new XPointer(runtime, xptr, readLimit);
xpointer = new XPointer(runtime, xptr, readLimit);