XML Programming

Contents:

XML stands for eXtensible Markup Language.

XML was designed to store and transport data.

XML was designed to be both human- and machine-readable.

XML plays an important role in many different IT systems.

XML is often used for distributing data over the Internet.

Visit https://xmlgrid.net/ to see XML examples.

Visit https://codebeautify.org/xmlviewer to see XML examples.

  <books> <book> </book> </books>
  

Visit https://xmlgrid.net/ to write your own XML codes.

editor

reference

XML Tree Structure
XML documents are formed as element trees.
An XML tree must start with a root element and branches from the root to child elements.
In the example <books> is the root element.
All elements can have sub elements (child elements)

<?xml version="1.0" encoding="UTF-8"?> 
<books> 
	<book> 
		<title>
			...
		</title> 
	</book> 
</books>

An XML element is everything from (including) the element's start tag to (including) the element's end tag.
For example, <price>29.99</price>
An element can contain:
- text
- attributes
- other elements
- or a mix of the above

XML elements can have attributes, just like HTML.
Attributes are designed to contain data related to a specific element.

<bookstore> 
	<book category="children"> 
		<title>Harry Potter</title> 
		<author>J K. Rowling</author> 
		<year>2005</year> 
		<price>29.99</price> 
	</book> 
	<book category="web"> 
		<title>Learning XML</title> 
		<author>Erik T. Ray</author> 
		<year>2003</year> 
		<price>39.95</price> 
	</book> 
</bookstore>

The purpose of a DTD is to define the structure and the legal elements and attributes of an XML document.

  <!DOCTYPE note 
  [ 
  <!ELEMENT note (to,from,heading,body)> 
  <!ELEMENT to (#PCDATA)> 
  <!ELEMENT from (#PCDATA)> 
  <!ELEMENT heading (#PCDATA)> 
  <!ELEMENT body (#PCDATA)> 
  ]>
  
  

https://docs.google.com/document/d/1EzUdNQKP3lik1MDD40oB8e5wG4JmtCMX1wrqBdxp0so/edit?usp=sharing

Post a Comment

0 Comments