The IXMLStruct C# interface

This section describes the XmlStruct interface that is implemented by C# classes generated from struct specifications. This interface has methods for conversion from and to XML, and functions to manipulate the struct itself, such as validation and cloning.

This interface is defined in the org.xooof.xmlstruct package.

XSToXML

Convert the data structure to its XML representation as an XmlWriter.

public XSToXML(
      System.Xml.XmlWriter writer)

Parameters

System.Xml.XmlWriter writer

The XML string representing the data structure. The XML declaration processing instruction is not generated, because it contains encoding information and the string could be later converted to a specific encoding. The XML declaration with the proper encoding should be added manually when the string is written to a medium with a specific encoding.

XSFromXML

Populate the fields from an XML string.

Unknown XML elements are simply ignored.

public XSFromXML(
      System.Xml.XmlReader reader,
      Xooof.XmlStruct.IXMLStructFactory structFactory)

Parameters

System.Xml.XmlReader reader

The XML source string.

Xooof.XmlStruct.IXMLStructFactory structFactory

The factory used for instanciating the correct XmlStruct class.

XSValidate

Validate the struct against the specification.

public XSValidate(
      System.String ctx)

Parameters

System.String ctx

The context to use to prefix the error messages. This is normally the name of the object. If it is left blank, the field names causing errors are reported without any prefix.

XSValidateNoRaise

Validate the struct against the specification without raising an exception when errors occure. Instead an errorbag is filled with the errors.

public XSValidateNoRaise(
      System.String ctx,
      Xooof.XmlStruct.ErrorBag eb)

Parameters

System.String ctx

The context to use to prefix the error messages. This is normally the name of the object. If it is left blank, the field names causing errors are reported without any prefix.

Xooof.XmlStruct.ErrorBag eb

The error bag object where the errors must be stored.

XSReset

Set the struct into its initial state: vfields and gfields are reset to null, vlfield and glfields are reset to empty collections.

public XSReset()

XSClone

Create a new struct that is an exact (deep) copy.

public XSClone()
   System.Object

XSNamespaceURI

Returns the XML namespace URI of the struct instance

public XSNamespaceURI()
   System.String