XML
XML
<?xml version="1.0"?>
<addbook>
<details>
<name>John Smith</name>
<DOB>2-january-1978</DOB>
<city>Chennai</city>
<state>Tamilnadu</state>
<pincode>600089</pincode>
<work title="Project Manager" company="TCS" city="Chennai"></work>
<phoneno>984002561</phoneno>
<email>[email protected]</email>
</details>
<details>
<name>Annie</name>
<DOB>30-March-1982</DOB>
<city>Ville Parle</city>
<state>Mumbai</state>
<pincode>876001</pincode>
<work title="HR" company="Wipro" city="Mumbai"></work>
<phoneno>9600560190</phoneno>
<email>[email protected]</email>
</details>
</addbook>
XML SCHEMA
Objective: Creating a XML Schema
Step 1: open VSCode for creating .dtd file for xml schema definition
Step 2: define the data types of elements which is to be defined in xml file.
Step 3: close the root element of .dtd file and save it.
Step 4: Open another VSCode for xml file
Step 5: define respected element as defined in the .dtd file and define the value.
Step 6. close all the subsequent elements tag.
Step 7: save the file with .xml extension
Step 8: Open Browser and open the XML file.
<?xml version="1.0"?> <?xml version="1.0"?>
<note xmlns="http://www.w3cschools.com" <xs:schema>
xmlns:xsi="http://www.w3.org/2001/XMLNS <xmlns:xs="http://www.w3.org/2001/XML
schema_instance" NS schema"
xsi:xmlSchemaLocation="http:/w3cschoools.c target
om note.xsd"> namespace="http://www.w3schools.com
<to>Tove</to> element form default="qualified">
<from>Jani</from> <xs:element name="to"type="xs:string"/>
<heading>Reminder</heading> <xs:element
<body>don't forgot me</body> name="heading"type=xs:string"/>
</note> <xs:element
name="body"type="xs:string"/>
</xs:sequence>
</xs:complex type>
</xs:element>
</xs:schema>
XSL TRANSFORMATION
To create a simple XSLT transformation from XSL to XML.
Step-1: Create a XSLT document using VSCode.
Step-2: Using XSLT document, we can create a style sheet like Font Style, Font Size,
bgcolor,..etc. and write the following code: :“cdcatalog.xsl”
Step-3: Save the document as“ Filename.xsl”.
Step-4: Then create a XML document.
Step-5: Create a Link with the XSLT document using href tag=”Filename.xsl” and write the
following code: “Simpxsl.xml”
Step-6: Save the document as “Simpxsl.xml”.
Step-7: Then execute the xml file and view the output: