This article describes how to exploit the XML serialization through the classes generated by xsd2code+. |
Serialization is the process of converting an object into an easily transportable data stream in memory or on disk. For example, you can serialize an object and transport it over the Internet via HTTP between a client and a server. At the other end, deserialization reconstructs the object from the data stream. XML serialization serializes only the public fields and property values of an object in an XML data stream. XML serialization does not include type information.
xsd2code++ proposes to automatically generate the attributes to serialize your objects so that they correspond 100% to the original schema.
To enable XML serialization, please refer to the common elements for serialization. This page details the options that are specific to XML serialization. To enable the generation of XML serialization methods, please enable the following options:
This parameter defines whether the XML file will be on a single line or formatted.
<?xml version="1.0" encoding="UTF-8"?><PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><BillTo><name>James</name><street>19 av road street</street><country>us</country></BillTo></PurchaseOrder> |
<?xml version="1.0" encoding="UTF-8"?> <PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <BillTo> <name>James</name> <street>19 av road street</street> <country>us</country> </BillTo> </PurchaseOrder> |
Indicates the indentation level for XML formatting.
Indicates that each attribute is positioned on a new line.
true
to omit the XML declaration; otherwise, false
. The default is false
, an XML declaration is written.
Howto referencing a Schema in schemaLocation
xmlns means "XML name space".