VTDGen vg = new VTDGen(); if (vg.parseFile("c://xml//alex.txt", true)){ VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPilot(vn); ap.selectXPath("//L/D"); int i=-1; while((i=ap.evalXPath())!=-1){ long l = vn.getContentFragment(); System.out.println(" -==> "+ vn.toString((int )l, (int)(l>>32))); } }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
protected boolean checkNsUniqueness(int i) throws NavException{ for (int j=0;j<fib.size();j++){ if (vn.compareTokens(fib.intAt(j), vn, i)==0) return false; } fib.append(i); return true; } /**
final public void markCacheable2(){ e.markCacheable2(); if (p.expr!=null){ if (p.expr.isFinal()&&p.expr.isNodeSet()){ CachedExpr ce = new CachedExpr(p.expr); p.expr = ce; } p.expr.markCacheable2(); } }
/** * * @param vn1 */ public NodeRecorder(VTDNav vn1) { bind(vn1); size = position = count = 0; fib = new FastIntBuffer(BUF_SZ_EXPO); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
protected boolean checkNsUniqueness(int i) throws NavException { for (int j = 0; j < fib.size(); j++) { if (vn.compareTokens(fib.intAt(j), vn, i) == 0) return false; } fib.append(i); return true; }
final public void markCacheable2(){ e.markCacheable2(); if (p.expr!=null){ if (p.expr.isFinal()&&p.expr.isNodeSet()){ CachedExpr ce = new CachedExpr(p.expr); p.expr = ce; } p.expr.markCacheable2(); } }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
/** * insert the byte content into XML and surround it with "<" and ">" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }
/** * insert the byte content into XML and surround it with ">" and "<" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }