当前位置:网站首页>Brief introduction to XML
Brief introduction to XML
2022-07-26 08:00:00 【Super Qi】
XML
1、XML An introduction to the
1. Concept :
xml Is an extensible markup language .( Extensible means that there are labels that can be customized )
2. effect
To hold data , And these data are self descriptive
It can also be used as the configuration file of the project or module
It can also be used as a network transmission data format ( Now in order to JSON Mainly )
3. grammar
The document statement
Create a xml file
<?xml version="1.0" encoding="UTF-8"?>
The above content is for xml Statement
version Express xml Version of
encoding Express xml The encoding of the file itself
Elements ( label )
xml Element means from ( And includes ) Start tagging until ( And includes ) End the part of the tag
Can include elements other elements 、 Text or a combination of both
Naming rules :
New names can contain letters 、 Numbers and other characters
Names cannot begin with numbers or punctuation
The name cannot be in characters “xml”( perhaps XML、Xml) Start
The name cannot contain spaces
* As short as possible , Don't be too long. . Spaces cannot be included . There are also single labels and double labels
<book sn=“SN54174544” name=" Exorcism sword " author=“ Lin Pingzhi ” price=“9999”/>
<books><!-- books Represents multiple book information -->
<book sn=“SN54174544”> <!-- book Represents a book information sn Property represents the book serial number -->
<name> A brief history of time </name> <!-- name Indicates the title of the book -->
<author> Hawking </author><!-- author The author -->
<price>75</price><!-- price It means the price -->
</book>
</books>
xml attribute
Additional information about labels can be provided , Must use “ ” Lead up . The document must have a root element ( Top level element without parent tag ) And only
<books><!-- books Represents multiple book information -->
<book sn=“SN54174544”> <!-- book Represents a book information sn Property represents the book serial number -->
<name> A brief history of time </name> <!-- name Indicates the title of the book -->
<author> Hawking </author><!-- author The author -->
<price>75</price><!-- price It means the price -->
</book>
</books>
sn For attributes
xml notes
<books><!-- books Represents multiple book information -->
<book sn=“SN54174544”> <!-- book Represents a book information sn Property represents the book serial number -->
<name> A brief history of time </name> <!-- name Indicates the title of the book -->
<author> Hawking </author><!-- author The author -->
<price>75</price><!-- price It means the price -->
</book>
</books>
<!-- book Represents a book information sn Property represents the book serial number --> For comment And html The comments of are the same <!-- -->
Text area (CDATA District )
Format :<![CDATA[ Here you can display the characters you entered as they are , No resolution xml ]]>
effect : You can tell xml Parser , I CDATA The content in the text is pure text , Unwanted xml analysis
<![CDATA[<<<<<<<< sand ]]>
<!-- Inside <<<<<<< Sand is text -->
2、xml Introduction to parsing technology
have access to w3c Organization customized dom Technical analysis

document Object represents the entire document ( It can be html file , It can also be xml file )
3、dom4j Parsing Technology ( a key )
1.dom4j Use of class library ( Go to the official website to download )
2.dom4j Programming steps

3. obtain document object
Guide pack dom4j.jar

Create a SAXReader Input stream , Read out xml Configuration file for , Generate document object
SaxReader.read(“xml Of documents url”);


边栏推荐
- Copy pcap file with producer consumer model
- 如何关闭高位端口
- NFS service and Samba service deployment
- Database foundation
- Abstract classes and interfaces
- 为啥谷歌的内部工具不适合你?
- [classic thesis of recommendation system (10)] Alibaba SDM model
- Web side 3D visualization engine hoops communicator reads 10g super large model test | digital twin Technology
- OVS underlying implementation principle
- Distributed system and distributed database system (Introduction)
猜你喜欢

Unity Metaverse(二)、Mixamo & Animator 混合树与动画融合

动态性能视图概述

If the thread crashes, why doesn't it cause the JVM to crash? What about the main thread?

What is message subscription and publishing?

Program environment and pretreatment

Burp Suite-第六章 如何使用Burp Spider

20220209 create a basic Servlet
![[xshell7 free download and installation]](/img/1f/7ac3e2c40c1b3ef2e7ce7403541972.png)
[xshell7 free download and installation]

JMeter性能测试之使用CSV文件参数化

JSP action -- usebean action
随机推荐
Burp Suite-第八章 如何使用Burp Intruder
Web side 3D visualization engine hoops communicator reads 10g super large model test | digital twin Technology
[uniapp] encapsulation of multiple payment methods
File parsing (JSON parsing)
Burp Suite-第六章 如何使用Burp Spider
Command line execution and test report generation of JMeter performance test
Pycharm code specification tool flake8
数据库基础
Rewriting and overloading
Abnormal (2)
How to close the high-level port
Lnmp+wordpress to quickly build a personal website
The analysis, solution and development of the problem of router dropping frequently
Traversal mode of list, set, map, queue, deque, stack
JSP built-in object (implicit object) -- input / output object
2022.7.22DAY612
Use js to count the number of occurrences of each string in the string array, and format it into an object array.
LeetCode剑指offer专项(一)整数
【uniapp】多种支付方式封装
JMeter性能测试之使用CSV文件参数化