dom|xml| Conversion
This article briefly describes the concept and internal logic structure of DOM, which describes the Java implementation process of DOM document manipulation and XML file conversion.
1. Introduction to Dom
Currently, the consortium has introduced the specification DOM level 2 on November 13, 2000. The Document Object Model (DOM) is a programmin
pipeline stream is transmitted between networks. You can use the same XML parser to parse the protocol and then tag it based on different XML, differentiate different parts of the data to make the underlying data more readable. [4]
5. Both json and json are data exchange formats.
Data sharing between different databases and systems solves a big problem
In the first part of this four-part series, we'll figure out what data binding is, and what the advantages are, and how to start using it, compared to other methods of processing XML data in a Java application. This section examines why data binding is used and how constraints are modeled to allow XML documents to be converted into
to process XML data. Dom already has implementations of many languages, including Java. Java applications can access XML data through the DOM API. The XML parser produces the DOM representation of the
Xml| programming from the date of the birth of XML, it has been the industry's focus on one of the topics. After several years of development, XML technology is becoming more and more mature, now more and more applications are based on XML development. Today, with the increasing popularity of the Internet, distributed
= Db.parse ("Candidate.xml"); NodeList list = document.getElementsByTagName ("person"); 2, Sax,simple APIs for XML, provides a sequential access pattern, the way to read and write XML data quickly.Step1: Get the SAX parser factory instance saxparserfactory factory = Saxparserfactory.newinstance (); Step
1 DOM
DOM (Document Object Model) is a Document Object Model. DOM can access and modify the content and structure of a Document in a way independent of platform and language. In other words, this is a common way to represent and process an HTML or XML document. It is very important that DOM is designed based on the specification of Object Management Organization (OMG), so it can be used in any programming language.DOM is actually a document model desc
quickly. When parsing an XML document using the SAX parser, a series of events are triggered and the corresponding event handlers are activated, and the application accesses the XML document through these event handlers, and the Sax interface is also referred to as the event-driven interface.3, Jdom Way:Jdom is an open source project that uses pure
; // student agePrivate string phone; // phone number
Public void setsex (string s ){Sex = s;}Public void setname (string s ){Name = s;}Public void setage (int ){Age =;}Public void setphone (string s ){Phone = s;}Public String getsex (){Return sex;}Public String getname (){Return name;}Public int getage (){Return age;}Public String getphone (){Return phone;}}
Then write the XML test class. I name this class xmltest. to read and write the
in advance, occupy less resources; SAX parser code is smaller than DOM parser code, suitable for applets, download. Cons: not persistent; After the event, if the data is not saved, then the data is lost, stateless, only the text can be obtained from the event, but the text is not known which element; use case: Applet; only a small amount of content in an XML doc
For Java, there are two ways to load and parse XML files:
One is to generate a document by loading the entire XML file and parse the tree and root of the document content.
Another method is to use the sax encapsulation class for gradual parsing.
The two methods have their own advantages and disadvantages: the first method is to load the entire
Javain theXMLthe parsing1.dom4jDom parsing principle:The XML parser loads the XML document into memory at once, and then constructs a document object tree in Memory. Gets the node object on the tree through the document object, manipulating the document content through the node Object. dom4j commonly used objects:Saxreader: Reading an
Following previous articlesHttp://www.cnblogs.com/EasonJim/p/6221952.htmlHttp://www.cnblogs.com/EasonJim/p/6959120.htmlIn the Web. XML configuration involved, you can refer to the following Web site for the configuration of the schema on Web-app:Http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/index.htmlNote: In the process of review, you should pay attention to the release version, for example
can use Transform-related APIs to Transform memory objects to files. 1) DOMDOM is W3C standard API for processing XML, it is the basis of many other standards related to XML processing, not only Java, other such as JavaScript, PHP, MS. NET and other languages have implemented this standard and become the most widely used XML
This article briefly describes the concept and internal logic structure of DOM, which describes the Java implementation process of DOM document manipulation and XML file conversion.
1.DOM Introduction
Currently, the consortium has introduced the specification DOM level 2 on November 13, 2000. The Document Object Model (DOM) is a programming interface specification for HTML and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.