case 3: l = l2;break; remove(l); return; case SEGMENT_OP_INTERSECT_STRICT: case 3: l = l1;break; remove(l); return; case SEGMENT_OP_EXCLUDE_STRICT: switch(b){ case 0: l = (long)((os2-os1)<<32) | os1;remove(l);return; case 1: remove(((long)(os2-os1)<<32) | os1); remove(((long)(os1+len1-(os2+len2))<<32)| (os2+len2)); return; case 2: l = (long)((os1-os2)<<32) | os2;remove(l);return; case 3: remove(((long)(os1-os2)<<32) | os2); remove(((long)(os2+len2-(os1+len1))<<32)| (os1+len1)); return;
import com.ximpleware.*; import java.io.*; public class removeAttrNode { public static void main(String[] s) throws VTDException, Exception{ VTDGen vg = new VTDGen(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Payment xmlns=\"http://api.com/schema/store/1.0\"><Store>abc</Store></Payment>"; vg.setDoc(xml.getBytes()); vg.parse(false); // turn off namespace awareness so that VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPilot(vn); XMLModifier xm = new XMLModifier(vn); ap.selectXPath("//@xmlns"); int i=0; while((i=ap.evalXPath())!=-1){ xm.remove(); } xm.output(baos); System.out.println(baos.toString()); } }
while((i=ap.evalXPath())!=-1){ xm.remove();
import com.ximpleware.*; import java.io.*; public class removeNode { public static void main(String s[]) throws VTDException, IOException{ VTDGen vg = new VTDGen(); if (!vg.parseFile("input.xml", false)); VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPilot(vn); XMLModifier xm = new XMLModifier(vn); ap.selectXPath("/xml/A/B[C/E='13']"); while (ap.evalXPath()!=-1){ xm.remove(); } xm.output("output.xml"); } }
import com.ximpleware.*; import java.io.*; public class removeElement { public static void main(String s[]) throws VTDException,IOException{ VTDGen vg = new VTDGen(); if (!vg.parseFile("input.xml", false)) return; VTDNav vn = vg.getNav(); XMLModifier xm = new XMLModifier(vn); AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/ClOrdIDS/ClOrdID[@id='3']"); int i=0; while((i=ap.evalXPath())!=-1){ xm.remove(); } xm.output("output.xml"); } }
import com.ximpleware.*; import java.io.*; public class removeElement { public static void main(String s[]) throws VTDException,IOException{ VTDGen vg = new VTDGen(); if (!vg.parseFile("input.xml", false)) return; VTDNav vn = vg.getNav(); XMLModifier xm = new XMLModifier(vn); AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/ClOrdIDS/ClOrdID[@id='3']"); int i=0; while((i=ap.evalXPath())!=-1){ xm.remove(); } xm.output("output.xml"); } }
import com.ximpleware.*; import java.io.*; public class removeElement { public static void main(String s[]) throws VTDException,IOException{ VTDGen vg = new VTDGen(); if (!vg.parseFile("input.xml", false)) return; VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/definition/task"); XMLModifier xm = new XMLModifier(vn); int i=0; while((i=ap.evalXPath())!=-1){ xm.remove(); } xm.output("output.xml"); } }
import com.ximpleware.*; public class deleteNode { public static void main(String s[]) throws VTDException,java.io.UnsupportedEncodingException,java.io.IOException{ VTDGen vg = new VTDGen(); if (!vg.parseFile("input.xml", false)) return; VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPilot(vn); XMLModifier xm = new XMLModifier(vn); ap.selectXPath("/*/*[@id='s2']");// this is the key XPath expression int i=0; while((i=ap.evalXPath())!=-1){ xm.remove(vn.getElementFragment());// remove the node } xm.output("new.xml"); // output to a new document called new.xml } }
import com.ximpleware.*; public class removeNode { public static void main(String s[]) throws Exception{ VTDGen vg = new VTDGen(); boolean b = vg.parseFile("input.xml", false); if (b==false) return; VTDNav vn = vg.getNav(); XMLModifier xm = new XMLModifier(vn); vn.toElement(VTDNav.FC); // get to A node long l = vn.getContentFragment(); xm.remove(l); xm.output("output.xml"); } }
mod.remove();
xm.remove(); //remove all ns node fib.append(i);
if (vn.toElement(VTDNav.NS, "d")) { long l = vn.getContentFragment(); xm.remove(l); // remove the node <c> xm1.remove(); // remove the node <b> to save it in a temp file xm.output(new FileOutputStream("E://new.xml")); // generate the first file xm1.output(new FileOutputStream("E://newonetemp.xml")); xm2.remove(); // remove the node <b> xm2.output(new FileOutputStream("E://newtwo.xml")); // generate the next file
import com.ximpleware.*; import java.io.*; public class removeTag { public static void main(String[] args) throws VTDException,IOException { // TODO Auto-generated method stub VTDGen vg = new VTDGen(); AutoPilot ap=new AutoPilot(); ap.selectXPath("//value"); XMLModifier xm = new XMLModifier(); if (!vg.parseFile("d:\\xml\\tag.xml", false)){ System.out.println("error in xml"); return; } VTDNav vn = vg.getNav(); xm.bind(vn); ap.bind(vn); int i=0; while((i=ap.evalXPath())!=-1){ xm.remove();//remove value fragment long l = vn.getContentFragment(); //replace value with everything it encloses xm.insertBeforeElement(vn.getXML().getBytes(), l); } xm.output("d:\\xml\\newTag.xml"); } }
if (fib.intAt(j)==0x1){ vn.recoverNode(j); xm.remove();