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 anObject = aString.xmlToClass()
set anObject = xmlToClass(LITERAL) 
set anObject = aString.xmlToClass(xmlOptions)
Semantics

The operation takes an XML string (aString) and tries to map the XML document to 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

Frequently, an XML document is given as blob instead of a string (for instance after receiving it from the FileSystem adapter). In such cases, it is possible to apply xmlToClass() to a Blob as well. For details see xmlToClass Blobs.

SubstitutablesaString An XML document as String.
anObject Target object, can be any object.
LITERAL String literal.
xmlOptions This is an optional parameter of type Base Components.Basic Behavior.XML.XMLOptions. This parameter controls the parsing behavior. For example, it defines whether the XML document is validated against an XML schema. The available options are explained below.
Examples

The action script below creates an object of type Address. An output object named myAddress of type Address needs to be defined.

Code Block
languagenone
create myAddress;
set myAddress = addressAsXMLDocument.xmlToClass();

Beneath, a sample XML document is shown to illustrate the executed mapping. The XML document is mapped to an instance of Address as shown in the class diagram.

XML SourceTarget Class Structure
<myAddress id="myAddressID">
<street>108, Kearny Avenue</street>
<city>Newark</city>
</myAddress>
Note, that the XML element myAddress is mapped to the object myAddress, which is of type Address. This type has the UML 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.

XML Parsing Options (Validation against a Schema)

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameclassToXML_parse_options_example
PageWithExcerptINTERNAL:_designer_excerpts_asl
shouldDisplayInlineCommentsInIncludesfalse

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

Otp
Floatingfalse

rp

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameclassToXML_parse_options
PageWithExcerptINTERNAL:_designer_excerpts_asl
shouldDisplayInlineCommentsInIncludesfalse