开发者

what is the difference between Using Xml Parser and Xpath in XML

开发者 https://www.devze.com 2023-02-25 11:36 出处:网络
I Would like to know what are the difference between Using Xml Parser and Xpath in XML.Because, both are used to get 开发者_运维技巧the any pieces of information in the xml document.That why i asked t

I Would like to know what are the difference between Using Xml Parser and Xpath in XML.Because, both are used to get 开发者_运维技巧the any pieces of information in the xml document.That why i asked this question...


An XML Parser turns an XML document into a data structure that you can access programatically (or a stream of SAX events).

XPath is a query language for taking an XML based data structure (or a stream of SAX events) and finding the bits of it you want.

The difference is rather like that of an HTML parser and a CSS selector engine or a Car and a Road Map. They are two completely different things that can be used together.


An XML Parser parses the XML-file and creates an object representing the XML document and adhering to the DOM standard. Via this interface you can iterate over the XML document and retrieve the information you want.

XPath is a language to define queries on XML-documents. To be of any use there must be an engine/program which "understands" that language, parses the XML and retrieves the information accordingly.


XPath is a query language for selecting nodes from an XML.

An XML parser is a program that reads your XML and produces some kind of data structure, usually a Document Object Model (DOM) that you can programmatically manipulate in your programming language (java, perl, etc.).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号