Any Type
Types defined in the XSD as anyType are generated as a structure which stores attributes and textual content. In C, which uses the OSXSDAnyType struct, the textual content is represented by an OSXMLSTRING, and the attributes are stored in an OSRTDList of OSAnyAttr*. C++ uses the OSXSDAnyTypeClass, which stores the textual content in an OSXMLSTRING, and the attributes in an OSRTObjListClass of OSAnyAttrClass*.
The general mapping is as follows:
<xsd:complexType name="TypeName"> <restriction base="xsd:anyType"/> </xsd:simpleType> typedef OSXSDAnyType TypeName; class TypeName : public OSXSDAnyTypeClass { ... } ;
TypeName anyTypeVal; OSAnyAttr* pAnyAttr; anyTypeVal.value.cdata = FALSE; anyTypeVal.value.value = (const OSUTF8CHAR*) "<content>a</content>"; pAnyAttr = rtxMemAllocType (pctxt, OSAnyAttr); pAnyAttr->name = (const OSUTF8CHAR*) "attrname"; pAnyAttr->value = (const OSUTF8CHAR*) "attrvalue"; rtxDListAppend (pctxt, &anyTypeVal.attrs, (void*) pAnyAttr);TypeName anyTypeVal; OSRTObjListClass* pList = anyTypeVal.getAttrListPtr(); OSAnyAttrClass* pAttr = new OSAnyAttrClass ("attrname", "attrvalue"); anyTypeVal.setValue ("<content>a</content>"); pList->appendCopy (pAttr);
Copyright © Objective Systems 2002-2008 This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included. |
Objective Systems, Inc.55 Dowlin Forge RoadExton, 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 |