The XML SET OPTIONS command is used to modify the value of one or more XML options for the structure passed in the first parameter.
This command applies the XML structures of the "tree" type (DOM) or of the "document" type (SAX). In the first parameter, you can pass either a root element reference (elementRef), or the reference of an open SAX document (document).
The options set by this command are only used in the direction 4D to XML (it has no effect on the reading of XML values in 4D). The following commands use these options:
Pass the option to be modified in selector and the new value of the option in value. You can pass as many selector/value pairs as you want.
You must use the constants described below, placed in the "XML" theme:
Constant |
Type |
Value |
Comment |
XML binary encoding |
Longint |
5 |
Specifies the way binary data will be converted. Possible values:
- XML Base64 (default value): binary data are simply converted to Base64
- XML data URI scheme: binary data are converted to Base64 and the "data:;base64" header is added. This format mainly allows a browser to automatically decode a picture, and is also required for the insertion of pictures. For more information, see http://en.wikipedia.org/wiki/Data_URI_scheme.
|
XML date encoding |
Longint |
2 |
Specifies the way 4D dates will be converted. For example, !01/01/2003! in the Paris time zone. Possible values:
- XML ISO (default value): use of the format xs:datetime without indication of time zone. Result: "2003-01-01". The time part, if it is present in the 4D value (via SQL) is lost.
- XML local: use of the format xs:date with indication of time zone. Result: "2003-01-01 +01:00". The time part, if it is present in the 4D value (via SQL) is lost.
- XML datetime local: use of the format xs:dateTime (ISO 8601). Indication of time zone. This format allows the time part to be kept, if it is present in the 4D value (via SQL). Result: "<Date>2003-01-01T00:00:00 +01:00</Date>".
- XML UTC: use of the format xs:date. Result: "2003-01-01Z". The time part, if it is present in the 4D value (via SQL) is lost.
- XML datetime UTC: use of the format xs:dateTime (ISO 8601). This format allows the time part to be kept, if it is present in the 4D value (via SQL). Result: "<Date>2003-01-01T00:00:00Z</Date>".
|
XML indentation |
Longint |
4 |
Specifies the indentation of the XML document. Possible values:
- XML with indentation (default value): the document is indented.
- XML no indentation: the document is not indented; its contents are placed in a single line.
|
XML picture encoding |
Longint |
6 |
Specifies the way pictures must be converted (before encoding in Base64). Possible values:
- XML convert to PNG (default value): pictures are converted to PNG before being encoded in Base64.
- XML native codec: pictures are converted in their first native storage CODEC before being encoded in Base64. You must use these options to encode SVG pictures (see example for the XML SET OPTIONS command).
|
XML string encoding |
Longint |
1 |
Specifies the way 4D strings are converted to element values. It does not concern the conversion to attributes for which XML imposes the use of escape characters. Possible values:
- XML with escaping (default value): conversion of 4D strings to XML element values with replacement of characters. The Text type data are automatically parsed so that forbidden characters (<&>’) are replaced by XML entities (&<> '").
- XML raw data: 4D strings are sent as raw data; 4D does not carry out encoding or parsing. 4D values are converted if possible to XML fragments and inserted as a child of the target element. If a value cannot be considered as an XML fragment, it is inserted as raw data into a new CDATA node.
|
XML time encoding |
Longint |
3 |
Specifies the way 4D times are converted. For example, ?02/00/46? (Paris time). The encoding differs depending on whether you want to express a time or a duration. Possible values for times: - XML datetime UTC: time expressed in UTC (Universal Time Coordinated). Note that conversion to UTC is automatic. Result: "<Duration>0000-00-00T01:00:46Z</Duration>".
- XML datetime local: time expressed with the time difference of the machine of the 4D engine. Result: "<Duration>0000-00-00T02:00:46+01:00</Duration>".
- XML datetime local absolute (default value): time expressed without indication of time zone. No modification of the value. Result: "<Duration>0000-00-00T02:00:46</Duration>".
Possible values for durations:
- XML seconds: number of seconds since midnight; no modification of the value since it expresses a duration. Result: "<Duration>7246</Duration>".
- XML duration: duration expressed in compliance with XML Schema Part 2: Datatypes Second Edition. No modification of the value since it expresses a duration. Result: "<Duration>PT02H00M46S</Duration>".
|
Notes:
- The XML Local and XML Datetime local values do not provide dates expressed in UTC (Universal Time Coordinated); they are converted without modification but indicating the time difference. These formats are useful in the case of successive and reciprocal conversions (round tripping).
- The XML UTC and XML Datetime UTC values are equivalent to the previous from the formatting viewpoint, but are expressed in UTC. These formats should be given priority to ensure interoperability. The values are not modified.
Insertion of an SVG picture: