开发者

What does parsing XML mean? [closed]

开发者 https://www.devze.com 2023-02-13 16:48 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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"

0

精彩评论

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