Тема: очередной "парсер" для XML...

Создан:Mikhail Cholokov 03/18/2008 03:13 PM
Модифицирован:Mikhail Cholokov 03/18/2008 03:22 PM
Папка:
06. Разработка Notes-приложений, 10. Java & Lotus Notes
Тип сообщения:
Ссылка

Сообщение:

но с заявленной высокой скоростью и без оверхеда на объекты...
http://www.javaworld.com/cgi-bin/mailto/x_java.cgi
http://vtd-xml.sourceforge.net/

интересен ф-циями замены, вставки/копирования, усечения, работает с XPath, короткая выдержка:

* Cut: Given an XML document, carve away some portions of it (e.g., an attribute, a text node, or an element) while keeping it well-formed.
* Paste: After copying a chunk of an XML document, stick the copy into another XML document while keeping it well-formed.
* Split: A beauty of XML is that any element of the root element is itself XML. VTD-XML can cut the elements of a single large piece of XML and dump each into an XML file.
* Assemble: Pull out element fragments and combine them into a new XML file.

At the API level, VTD-XML supports those operations at the following three granularity levels:

* A single token: Once you have the index value of a VTD record, you can use VTDNav's getTokenOffset(...) and getTokenLength(...) methods to return the starting offset and length of a token. Both values are useful when the token content must be updated.
* A group of adjacent tokens: Sometimes a group of adjacent tokens (the attribute name/value pair) must be replaced or deleted in one swoop. In this case, you need to obtain the starting and ending offset for the first and last token, respectively, in the group.
* An element: VTDNav's getElementFragment(...) method returns the offset and length of an element as it appears in the XML document. This allows you to directly manipulate the element content with byte-level fidelity.



Here is a quick overview of the basic VTD-XML concepts you will encounter in the examples that follow.

* Essential classes:
1. VTDGen is the name of the class encapsulating parsing functions.
2. After parsing, you can obtain an instance of VTDNav, which allows you to move to different locations in the tree.
3. AutoPilot is the wrapper class for XPath and node iterators.
* Cursor-based model: There is only one cursor available. After parsing, the cursor is at the root element. You can use a global stack to remember the position of the cursor.
* Stateless XPath evaluation: VTD-XML's XPath evaluation returns one node at a time, unless the node set is empty. An instance of the AutoPilot class acts like a magic hand that moves the cursor position across the XML tree according to the XPath expression.



Иерархия документов данной дискуссии:
очередной "парсер" для XML... (Mikhail Cholokov) (18.03.2008 15:13:45)


Разработчикам и администраторам: курсы, книги, сертификация