2. VTD-XML Motivations Behind VTD-XML Why VTD-XML? When to Use VTD-XML? Known Limitations Basic Concept Essential Classes Shortcomings Typical Programming Flows Demo Reference Agenda 2
3. *Numerous*, well-known issues of old XML processing models, below summarizes a few: Comparison with DOM, SAX and PULL http://vtd-xml.sourceforge.net/userGuide/5.html Motivations Behind VTD-XML 3
8. The world's most efficient XML indexer that seamlessly integrates with your XML applications.
9. The world's only incremental-update capable XML parser capable of cutting, pasting, splitting and assembling XML documents with max efficiency.
10. The world's only XML parser that allows you to use XPath to process 256 GB XML documents.Why VTD-XML? 4
11. The scenarios that you may consider using VTD-XML Large XML files that DOM can’t handle Performance-critical transactional Web- Services/SOA applications Native XML database applications Network-based XML content switching/routing/security applications When to Use VTD-XML? 5
30. Poor exception handling Shortcomings 12 If this method does not execute properly, it will just return false from parseFile method, and does not report any exception message.
31. Add BufferedInput Stream in parseFile method to avoid running out of read buffer max size in UNIX platform Shortcomings – cont. 13 You need to modify the build.bat to rebuild VTD-XML jar file, then set it into class path. //add commons-io jar file into the first line javac-classpath .;D:ibommons-io-1.4ommons-io-1.4.jar comimpleware.java javac comimplewarepath.java javac comimplewarearser.java … Finally, you just need to execute build.bat file. Then it will generate the brand-new jar file for you.
32. Typical Programming Flows Call VTDGen’s parseFile(…) Start with a byte buffer containing the content of XML, call set_doc() of VTDGen Call VTDGen’s loadIndex(…) Call VTDGen’s parse() Obtain an instance VTDNav from VTDGen Move VTDNav’s cursor manually to various locations and perform corresponding application logic Instantiate autoPilot for node iteration and XPath to perform Corresponding application logic 14
35. 1. Add <age> tag after <geneder> – cont. 17 Compiled XPath expression Binded with NTDNav Assigned age value Moved to gender cursor, and added <age> tag after <gender> tag Outputted to new xml file
39. 3. Add Contact info after <age> tag – cont. 21 Compiled XPath expression Binded with NTDNav Assigned age value Inserted new value after <gender> tag Outputted to new xml file