Schema Attribute Commands |
Schema Attribute Commands are usually used to control the way Fuzzware serialises XML. Their most typical use is to control whether or not to output the XML mark-up of a schema element or type and also to control the output formatting of the schema element or type's value. To add these commands to your XML Schema you need to declare the Fuzzware.Schemas.SchemaAttributeCommands namespace in your XSD file. The SchemaAttributeCommands.xsd file that defines these attributes can be found in the Schemas directory. Attribute
| Value
| Description
| markup | remove removeIncludingChildNodes dontRemove dontRemoveIncludingChildNodes | Indicates whether or not a schema element (and potentially all its child elements) will have its XML mark-up removed when the element is serialised to the output. | outputAs
| Unchanged Decoded Base64 Hex MSBase64 BinaryLittleEndian BinaryBigEndian ASCIIString UTF7String UTF8String UTF8StringWithBOM UTF16LEString UTF16BEString UTF32LEString UTF32BEString
| By default the output format of a schema element's value is as if it was output to an XML file, so the element's value is output as a string. This attribute changes how an element is written to output.
Example: A node is of type int, and has 'outputAs="BinaryLittleEndian"'. When the node is being written to the final output it will be encoded into a Little Endian binary number.
Example: A node has 'outputAs="Base64"' and has child nodes beneath it that should be encoded before output (the child nodes could contain both binary and XML data), each child node will be formatted according to each of their 'outputAs' commands, then encoded and output in Base64.
The value 'Decoded' means that if the type is hexBinary or base64 the type will be decoded and written as binary data.
The string encodings support outputting strings in different encodings, LE and BE refer to little and big endianess respectively and BOM is byte-order-mark.
The value of the attribute should be appropriate for the type e.g. 'BinaryLittleEndian' will only be effective on number types.
| DontOutput
| true false
| Setting to true will suppress the element and child element from being serialised to the output, however this element and its elements will still be serialised for the purpose of being passed to Schemer processing instructions. This is useful for passing custom data to custom Extensible.IUserNodeProcessor functions. | TypeId | a string
| This attribute only needs to be specified in a particular scenario to help automatic conversion to XML. If a data format has an element with a choice of child elements, and the particular child is specified by another element, then assign each child element a unique TypeId value. In the XML a TypeId processing instruction needs to be used to indicate which child element is being used.
For instance, if a file format that can contain several different types of records, but the specific record used in a particular file is identified by a field that is part of the header of the file.
This attribute needs to be both a schema attribute command (as this is where the identifier is specified) and an XML processing instruction command (so the identifier in the file format header (for instance) can be set to the right value).
See the TLS example to see a practical application of this attribute.
|
|