TOC PREV NEXT INDEX


Any Element


An element in a sequence can be declared using the xsd:any keyword to indicate that an element of any type can be present in that position. An example of this type of construct is as follows:

<xsd:complexType name="SeqWithAny">
<xsd:sequence>
<xsd:element name="a" type="xsd:string"/>
<xsd:any processContents="lax"/>
</xsd:sequence>
</xsd:complexType>

In this case, the element a is followed by another element with any name and of any type. The processContents="lax" attribute tells a schema processor to do lax validation processing on the element in this position - something that is of no concern to the XBinder compiler.
The generated C type definition for this type is as follows:

typedef struct SeqWithAny {
OSXMLSTRING a;
OSAnyElement _any;
} SeqWithAny;

C++ is similar except that the standard class pattern is used:

class SeqWithAny : public OSBaseType {
public:
OSXMLStringClass a;
OSAnyElementClass _any;
...
} ;

In this case, the compiler has inserted an OSAnyElement typed element to represent the any field. This contains UTF-8 character string fields for the element name and value.
An example code snippet that could be used to populate a C variable of this type for encoding is as follows:

const OSUTF8CHAR* anyData = (OSUTF8CHAR*)
"<anyData>this is test data</anyData>";

SeqWithAny testSeq;

testSeq.a.value = (const OSUTF8CHAR*)"test string";
testSeq._any.name = (const OSUTF8CHAR*)"anyData";
testSeq._any.value =
(const OSUTF8CHAR*)"this is test data";
...


Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX