attrPrefix | String Optional. Prefix that designates keys containing attributes. The default prefix is "@". For example, if you set attrPrefix to ATT_ and document contained the following element: pub.xml:documentToXMLString would convert the ATT_currency key to the attribute, currency=dollars, in the <tx> element as shown below: <tx currency=dollars> <acct>cash</acct> <amt>120.00</amt> </tx> | |
document | Document IData object that is to be converted to XML. Note that if you want to produce a valid XML document (one with a single root node), document must contain only one top-level IData object (that is, a single document). The name of that document will serve as the name of the XML document's root element. For example, document shown in the example in this service's description contains one top-level document named AcctInfo, which would result in one root element named <AcctInfo> in the resulting XML String. If you needed to produce an XML fragment (for example, a loose collection of elements that are not encompassed within a single root element) then document can contain multiple top-level elements. To produce this type of output, you must also set the addHeader and enforceLegalXML parameters to false. | |
nsDecls | Document Optional. Namespaces associated with any namespace prefixes that are used in the key names in document. Each entry in nsDecls represents a namespace prefix/URI pair, where a key name represents a prefix and the value of the key specifies the namespace URI. For example, to define the URIs associated with two prefixes called GSX and TxMon, you would set nsDecls as follows: For each prefix specified in nsDecls, pub.xml:documentToXMLString generates an xmlns attribute and inserts it into the top-most element of the resulting XML String. For example, if nsDecls had the two keys shown above, pub.xml:documentToXMLString would insert the following attributes into the root element of the XML String: xmlns:gsx="http://www.gsx.com" xmlns:TxMon="http:www.acrtrak/txMonitor" Note: Alternatively, you can declare a namespace by including an @xmlns key in document. (If you were not using the @ character to designate attributes, use the correct attribute prefix in your code.) | |
addHeader | String Optional. Flag specifying whether the header element: <?xml version="1.0"?> is to be included in the resulting XML String. Set to: true to include the header. This is the default. false to omit the header. (You would omit the header to generate an XML fragment or to insert a custom header.) | |
encode | String Optional. Flag indicating whether to HTML-encode the data. Set this parameter to true if your XML data contains special characters, including the following: < > & " ' Set to: true to HTML-encode the data. For example, the string expression 5 < 6 would be converted to <expr>5 < 6</expr>, which is valid. false to not HTML-encode the data. This is the default. For example, the string expression 5 < 6would be converted to <expr>5 < 6</expr>, which is invalid. | |
documentTypeName | String Optional. Fully qualified name of the document type that describes the structure and format of the output document (for example, examples.rtd:exampleRecord1). You can use this parameter to ensure that the output includes elements that might not be present in document at run time, or to describe the order in which elements are to appear in the resulting XML String. If you are using derived type processing, you must provide this parameter. | |
generateRequiredTags | String Optional. Flag indicating whether empty tags are to be included in the output document if a mandatory element appears in the document type specified in documentTypeName but does not appear in document. Set to: true to include mandatory elements if they are not present in document. false to omit mandatory elements if they are not present in document. This is the default. Note: The generateRequiredTags is only applicable if documentTypeName is provided. | |
generateNilTags | String Optional. Flag indicating whether the resulting XML string includes the attribute xsi:nil for elements that are null. Set to: true to generate the xsi:nil attribute for an element if the Allow null property for the corresponding field is set to true and the field is null in document. Note: generateRequiredTags must also be set to true to generate the xsi:nil attribute in the XML String. false to omit the xsi:nil attribute even if a nillable field is, in fact, null. This is the default. | |
enforceLegalXML | String Optional. Flag indicating whether the service throws an exception when document contains multiple root elements or illegal XML tag names. Set to: true to throw an exception if document would produce an XML String containing multiple root elements and/or illegal XML tag names. false to allow the resulting XML String to contain multiple root elements and/or illegal XML tag names. You would use this setting, for example, to create an XML fragment composed of multiple elements that were not all enclosed within a root element. This is the default. | |
dtdHeaderInfo | Document Optional. Contents of the DOCTYPE header to be inserted into the XML String. (You can retrieve this information from an incoming document using pub.xml:getXMLNodeType.) | |
Key | Description | |
systemID | String Optional. System identifier for the DTD, if any. | |
publicID | String Optional. Public identifier for the DTD, if any. | |
rootNSPrefix | String Optional. Namespace prefix of the rootLocalName, if any. | |
rootLocalName | String Optional. Local name (excluding the namespace prefix) of the root element. | |
bufferSize | String Optional. Initial size (in bytes) of the String buffer that documentToXMLString uses to assemble the output XML String. If the String buffer fills up before documentToXMLString is finished generating the XML String, it reallocates the buffer, expanding it by this amount each time the buffer becomes full. If you do not set bufferSize, documentToXMLString looks to see whether a default buffer size is specified in the following parameter on the server: watt.server.recordToDocument.bufferSize If so, it uses this value to allocate the String buffer. If this parameter is not set, documentToXMLString uses a default buffer size of 4096 bytes. For best performance, you should always set bufferSize to a value that closely matches the size of the XML String that you expect documentToXMLString to produce. This practice will spare the server from having to enlarge the buffer repeatedly if the XML String is many times larger than the default buffer or if you arbitrarily set bufferSize to a value that is too small. Setting bufferSize to an appropriately sized value will also prevent your service from unnecessarily consuming more memory than it needs if the XML String is much smaller than the default buffer size or if you arbitrarily set bufferSize to a value that is too large. |
xmldata | String XML String produced from document. |