Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WDESIGNER and version 24.0
Syntax
Code Block
languagenone
set aBlob = anObject.classToXML()
set aBlob = anObject.classToXML(options)
Semantics

The operation takes any object (anObject) and tries to map it to an XML document. The document structure is given by the class definition of anObject. If this is not possible an error is raised (e.g. XML parser errors, invalid mappings, etc.).

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameclassToXML_mapping_rules
PageWithExcerptINTERNAL:_designer_excerpts_asl
shouldDisplayInlineCommentsInIncludesfalse

Info
iconfalse

A conversion with operation classToXML() always returns an object of type Blob. To display this data as a String you need to transcode it first (see transcodeToString).

SubstitutablesanObjectTarget object can be any complex object. However, simple types and arrays are not supported, since they do not map naturally to a well formed XML document.
options
Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameclassToXML_compose_options
PageWithExcerptINTERNAL:_designer_excerpts_asl
shouldDisplayInlineCommentsInIncludesfalse
Examples
Code Block
languagenone
set xmlBlob = myAddress.classToXML();

XML Serialization Example

Assume you have an object myAddress of type Address .

The following action script serializes this object.

Code Block
set xmlBlob = myAddress.classToXML();

The sample XML document below illustrates the mapping executed by classToXML(). The object myAddress of type Address is mapped to an XML document as depicted in the following XML document:

<myAddress id="myAddressID">
<street>108, Kearny Avenue</street>
<city>Newark</city>
</myAddress>

Note, that the XML element myAddress is of type Address . This type has the attribute id, which corresponds to the XML attribute id. Additionally, the XML elements street and city are mapped to the association ends city respectively street. Both are having the type String.

Panel
titleOn this Page:
Table of Contents
Panel
titleRelated Pages:

Otp
Floatingfalse

rp