Files
yallie 9fa3874800 Added the contents of the archive.
Moved the original file to the archive subfolder.
2017-11-20 16:11:42 +03:00

126 lines
3.1 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>XML Serialization Sample</title>
<link rel="stylesheet" type="text/css" href="../../../docs/rotor.css">
</head>
<body>
<h1> XML Serialization Sample</h1>
<h2>Sample Overview</h2>
<p>This sample illustrates using the XSD utility and XML serialization to create
in-memory objects that have been deserialized from XML files.</p>
<p>The sample consists of two elements:</p>
<ol>
<li>The purchaseorder XSD file which will be built into the purchaseorder.dll
assembly by means of the XSD tool.</li>
<li>The xmlserialize.cs source code, which will use the generated purchaseorder
assembly to create a type definition used to deserialize an XML file into an
object instance.&nbsp;The deserialized object instance will be modified and
then serialized back out to a different XML file with the modifications.</li>
</ol>
<h2>Sample Source and Build Output Locations</h2>
<p>The sample source is found in two directories under
sscli\samples\howto\xmlserialization:</p>
<ul>
<li>purchaseorder<ul>
<li>Contains <a href="purchaseorder/purchaseorder.xsd">purchaseorder.xsd</a>
which is used by the XSD tool to create
purchaseorder.dll.</li>
</ul>
</li>
<li>xmlserialize<ul>
<li>Contains <a href="xmlserialize/xmlserialize.cs">xmlserialize.cs</a> which is built into the sample application.</li>
<li>Contains inputdata.xml which is used by the sample application to create
an instance of type PurchaseOrder.</li>
</ul>
</li>
</ul>
<p>The build output location is %TARGETCOMPLUS%\samples\howto\xmlserialization.&nbsp;
</p>
<p>The output files are:</p>
<ul>
<li>purchaseorder.dll</li>
<li>xmlserialize.exe</li>
</ul>
<p>The input file, inputdata.xml, is also copied to the
%TARGETCOMPLUS%\samples\howto\xmlserialization directory.</p>
<p>The sample displays the status of deserializing the object from the XML
file and reserializing it.&nbsp;After the sample runs, a new file named
purchaseorder_serialized.xml will have been created in the
%TARGETCOMPLUS%\samples\howto\xmlserialization directory.&nbsp;This file
contains the modified content of the deserialized object instance.</p>
<h2>Building the Sample</h2>
<p>All samples are built from the buildall script.&nbsp; </p>
<p>You can also build all the
samples by switching to the root of the sample directory, sscli\samples, and typing
<code>build -c</code>.</p>
<p>You can build this specific sample by switching to the sample directory and typing
<code>build -c</code>.</p>
<h2>Running the Sample</h2>
<p>These steps require that the Shared Source CLI (SSCLI) be already built and
functional.</p>
<ol>
<li>Run env.bat or source the env.csh or env.sh script files, depending on
your platform.</li>
<li>Switch to the %TARGETCOMPLUS%\samples\howto\xmlserialization directory.</li>
<li>Type the following command:<blockquote>
<p>clix xmlserialize.exe</p>
</blockquote>
</li>
</ol>
<hr>
<p><i>Copyright (c) 2002 Microsoft Corporation. All rights reserved.</i></p>
</body>
</html>