I have requirements of importing XMLs in to database and after using an application some processing will happen on these data and again XML needs to be generated using these updated values.
I have XSD for the xml which needs to be imported and generated. XSD for both kind of XMLs will remain same.
So please suggest me the best possible way to do it.
Book.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.contoso.com/books" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="bookstore">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="author">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="name" type="xs:string" />
<xs:element minOccurs="0" name="first-name" type="xs:string" />
<xs:element minOccurs="0" name="last-name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="price" type="xs:decimal" />
</xs:sequence>
<xs:attribute name="genre" type="xs:string" use="required" />
<xs:attribute name="publicationdate" type="xs:date" use="required" />
<xs:attribute name="ISBN" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Book.xml (which is imported)
<?xml version="1.0" encoding="utf-8"?>
<bookstore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.contoso.com/books">
<book genre="Religious" publicationdate="2013-02-13" ISBN="SampleISBN">
<title>Live and Let Live</title>
<author>
<name>Donald Allen</name>
<first-name>Allen</first-name>
<last-name>Donald</last-name>
</author>
<price>150</price>
</book>
</bookstore>
Now suppose after doing some processing on above xml data, price of particular book is updated to 180 and now If I again export this as xml then updated price should come as below sample XML
Book.xml (which needs to be generated)
<?xml version="1.0" encoding="utf-8"?>
<bookstore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.contoso.com/books">
<book genre="Religious" publicationdate="2013-02-13" ISBN="SampleISBN">
<title>Live and Let Live</title>
<author>
<name>Donald Allen</name>
<first-name>Allen</first-name>
<last-name>Donald</last-name>
</author>
<price>180</price>
</book>
</bookstore>