Title: PHP XML
1XML
With Teacher Sachin Zurange
VISION ACADEMY (BCA,BBA(CA),BCS,MCA)
2WHAT IS XML?
- XML stands for Extensible Markup Language
- XML is a markup language much like HTML
- XML is text-based markup language that enables to
store data - in structure format by using meaningful tags.
- XML tags are not predefined. You must define your
own tags - XML is designed to be self-descriptive
- XML is a W3C (World Wide Web Consortium
Recommendation
3Feature of XML
1.XML Separates Data from HTML if you need to
display dynamic data in your HTML document, it
will take a lot of work to edit the HTML each
time the data changes. With XML, data can be
stored in separate XML files. This way you can
concentrate on using HTML/CSS for display and
layout, and be sure that changes in the
underlying data will not require any changes to
the HTML. With a few lines of JavaScript code,
you can read an external XML file and update
the data content of your web page. 2XML
Simplifies Data Sharing In the real world,
computer systems and atabases contain data in
incompatible formats.XML data is stored in plain
text format. This provides a software and
hardware-independent way of storing data. This
makes it much easier to create data that can be
shared by different applications.
4XML DOCUMENT STRUCTURE OR COMPONENENT OF XML
XML DECLARATION XML declaration contains details
that prepare an XML processor to parse the XML
document. It is optional, but when used, it must
appear in the first line of the XML document.
lt?xml version "version_number" encoding
"encoding_declaration" ?gt It defines the XML
version (1.0) and the encoding information such
as ISO-8859- 1,UTF-8,UTF-16 e.g lt?xml
version"1.0" encoding"ISO- 8859-1"?gt
- DOCUMENT PROLOG SECTION
- Document Prolog comes at the top of the
document, before the root element. This section
contains - - XML declaration
- Document type declaration
5Document Elements Section
- DOCUMENT ELEMENTS ARE THE BUILDING BLOCKS OF XML.
ELEMENTS CAN BEHAVE AS CONTAINERS TO HOLD TEXT,
ELEMENTS, ATTRIBUTES ETC - ltELEMENT-NAME ATTRIBUTE1 ATTRIBUTE2gt ....CONTENT
lt/ELEMENT- NAMEgt - ELEMENT-NAME IS THE NAME OF THE ELEMENT. THE NAME
ITS CASE IN THE START AND END TAGS MUST MATCH. - A MARKUP CONSTRUCT THAT BEGINS WITH lt AND ENDS
WITH gt. TAGS COME IN THREE WAYS - START-TAGS FOR EXAMPLE ltSECTIONgt
- END-TAGS FOR EXAMPLE lt/SECTIONgt
- EMPTY-ELEMENT TAGS FOR EXAMPLE ltSECTION/gt
- ATTRIBUTE1, ATTRIBUTE2 ARE ATTRIBUTES OF THE
ELEMENT SEPARATED BY WHITE SPACES. AN ATTRIBUTE
DEFINES A PROPERTY OF THE ELEMENT. IT ASSOCIATES
A NAME WITH A VALUE, WHICH IS A STRING OF
CHARACTERS. AN ATTRIBUTE IS WRITTEN AS
NAMEVALUE
6XML SYNTAX RULES
- 1 All XML Elements Must Have a Closing Tag
- In HTML, some elements do not have to have a
closing tag - ltpgtThis is a paragraph.In XML, it is illegal to
omit the closing tag. All elements must have a
closing tagltpgtThis is a paragraph.lt/pgt - XML Tags are Case Sensitive
- XML tags are case sensitive. The tag ltLettergt is
different from the tag ltlettergt.Opening and
closing tags must be written with the same
caseltMessagegtThis is incorrectlt/messagegt - ltmessagegtThis is c orrectlt/messagegt
- XML Elements Must be Properly Nested
- In HTML, you might see improperly nested
elementsltbgtltigtThis text is bold and
italiclt/bgtlt/igt - In XML, all elements must be properly nested
within each otherltbgtltigtThis text is bold and
italiclt/igtlt/b - XML Documents Must Have a Root Element
- XML documents must contain one element that is
the parent of all other elements. This element is
called the root element.ltrootgt - ltchildgt
- ltsubchildgt.....lt/subchildgt
- lt/childgt
- lt/rootgt
7XML 2 type of reference
- Entity References
- Some characters have a special meaning in XML. If
you place a character like "lt" inside an XML
element, it will generate an error because the
parser interprets it as the start of a new
element. - Character References
- A character reference gives the number of the
particular Unicode character it stands for, in
eit her decimal or hexadecimal. - Dec imal character references look like
hexadecimal character references have an extra x
after the , that is, they look like
8APPLICATION OF XML
- Web publishing
- XML allows the developers to save the data into XM
L files use XSLT transformation - APIS to generate content in the required format
such as HTML, XHTML - Web Searching
- It can use XML data then search the data from
the XML file display it to the user - Data Transfer
- It can use XML to save configuration or business
data for our application - Created Other languages
- Many language are created using XML such as WML
9QUESTIONS? CLARIFICATIONS?
Email Address sachin.zurange_at_gmail.com
Please feel free to contact me, Teacher Sachin
Zurange through email or phone.
Mobile Number (9822506209/9823037693)
Consultation Hours 4 PM to 6 PM