7. Write an XML file that displays book information with the following fields: Title of the book, Author Name, ISBN number, Publisher name, Edition, and Price. Define an XML schema to validate the XML document created above.

PHOTO EMBED

Thu Oct 31 2024 16:13:21 GMT+0000 (Coordinated Universal Time)

Saved by @varuntej #kotlin

XML File (books.xml): 
 
xml 
Copy code 
 
<?xml version="1.0" encoding="UTF-8"?>
<books xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="books.xsd">
    <book>
        <title>Wings of Fire</title>
        <author>A.P.J Abdul Kalam</author>
        <isbn>81-7371-146-1</isbn>
        <publisher>Arun Tiwar</publisher>
        <edition>1st</edition>
        <price>180</price>
    </book>
<book>
        <title>Introduction to xml</title>
        <author>Jane doe</author>
        <isbn>978-0451524935</isbn>
        <publisher>Tech Books Publisher</publisher>
        <edition>1st</edition>
        <price>29.99</price>
    </book>
</books>

 
 
XSD File (books.xsd):
 
xsd 
Copy code 
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
	xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="books">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="title" type="xs:string" />
				<xs:element name="author" type="xs:string" />
				<xs:element name="isbn" type="xs:string" />
				<xs:element name="publisher" type="xs:string" />
				<xs:element name="edition" type="xs:string" />
				<xs:element name="price" type="xs:decimal" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
content_copyCOPY

xml pulse