Due to project needs, I started to learn Java and play with XML. I used to have some object-oriented basics in other languages and have some knowledge about XML. Therefore, I beat myself in the first place. But the two new things of Java and Dom are still a little difficult. Having read numerous materials, I have a little bit of eye-catching. I will briefly summarize myself and provide some clues to the old revolutionaries who are also facing new problems.
This article is not a tutorial or technical Article, but a personal experience in learning. For practical purpose, this article describes the standard DOM model and JDOM (javax. XML) mixed, not clearly identified, and temporarily ignored many other excellent parsers (such as APACHE ). This article only involves the creation of XML and does not discuss reading.
A brief review of XML elements: in plain text format, tags enclose data in an ideographic manner and indicate case sensitivity. Each XML document can have only one root node, node type: element, comment, processing instruction, CDATA, namespaces, and attribute ). As shown below:
View in a text editor (such as Notepad and ultraedit:
John Smith
It can be seen that the text content does not wrap, and only the semantics is correct. The format is determined by the browser.
Note: Once a source is created, it is associated with the document object. The document tree automatically changes the source without explicit action. That is to say, the source does not have to be created before being transform. Of course, transformer cannot be expected to have this effect, because its target is fileoutputstream, and the disk can only be appended if it is written. |