Can someone p开发者_Python百科lease explain to me what parsing XML means? And what does an XML parser do in general?
It means "reading" the XML file/string and getting its content according to the structure, usually to use them in a program.
For example if you have this XML fragment:
<root>
<node1>value1</node1>
<node2>value2</node2>
</root>
you may want to use these values in a data structure:
ClassRoot:
node1: string
node2: string
so that, in the end:
Object goofy = ClassRoot.new
parse(xml, goofy)
puts(goofy)
yelds something like:
goofy[node1='value1'; node2='value2']
There are many ways of doing so, like DOM or SAX. You might want to investigate XSLT and xpath as well, according to your needs.
- Google Define
An XML parser is the piece of software that reads XML files and makes the information from those files available to applications and programming languages, usually through a known interface like the DOM
- XML Parsers List
Usually some information is stored in xml documents. In order to use this information in your program you have to parse it - read line by line or node by node and fetch pieces of information.
An XML parser converts an XML document into an XML DOM object - which can then be manipulated with a JavaScript.
http://www.w3schools.com/XML/xml_parser.asp
XML: Extensible Markup Language is a set of rules for encoding documents electronically. It is defined in the produced by the W3C and several other related specifications; all are fee-free open standards.
Parser: a computer program that divides code up into functional components; "compilers must parse source code in order to translate it into object code"
精彩评论