What is a XML?
- XML Stand fro Extensible Markup Language.
- XML is a markup language much like HTML.
- XML was designed to store and transport data.
- XML was designed to be self descriptive.
- XML is a W3C Recommandation.It was designed to carry a data, not to display data.
- An XML document is plaintext and contains tags delimited by “<” and ”>”.
- Define a set of rules for encoading document in a format that is both Human-Readable and Machine-Readable.
We can use a XLM file into the PHP using simple_load_file(“ filename ”) function.
=> What is a DTD?
- DTD Stand for Document type definition.
- DTD is used to define the Structure of XML Document.
- Using DTD, XML file can carry a description of it’s own Format.
- Using DTD, you can verify that data receive from the outside World is Valid.
- DOCTYPE declaration is a Reference to an external DTD File.
- It is a also used to define special characters and Characters string used in the document.
- It define the structure with the list of legal elements.
Example:- d1.dtd
<! DOCTYPE note
[
<! ELEMENT note(to, from, heading, body)>
<! ELEMENT to(#PCDATA)>
<! ELEMENT from(#PCDATA)>
<! ELEMENT heading(#PCDATA)>
<! ELEMENT body(#PCDATA)>
]>
- !DOCTYPE note defines that the root element of a document is note.
- !ELEMENT note define that note element contain four element: “to, from, heading, body”.
- !ELEMENT to defines the element to be of type “#PCDATA”.
- !ELEMENT body defines the element to be of type “#PCDATA”.
- !ELEMENT heading defines the element to be of type “#PCDATA”.
- !ELEMENT from defines the element to be of type “#PCDATA”.
How to use DTD file in XML?
Example:- p1.xml
No comments:
Post a Comment