From 1a4099b78717b16f632b0e7e0980a27811221e52 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 3 Jul 2014 09:57:09 +0200 Subject: Implement anyType and anySimpleType content representation anyType as a DOM fragment, similar to wildcards. anySimpleType as a text string. --- doc/cxx/tree/manual/index.xhtml | 94 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/cxx/tree/manual/index.xhtml b/doc/cxx/tree/manual/index.xhtml index 052f2b3..235c33c 100644 --- a/doc/cxx/tree/manual/index.xhtml +++ b/doc/cxx/tree/manual/index.xhtml @@ -1214,18 +1214,44 @@ public: virtual ~type (); -public: type (); type (const type&); -public: type& operator= (const type&); -public: virtual type* _clone () const; + // anyType DOM content. + // +public: + typedef element_optional dom_content_optional; + + const dom_content_optional& + dom_content () const; + + dom_content_optional& + dom_content (); + + void + dom_content (const xercesc::DOMElement&); + + void + dom_content (xercesc::DOMElement*); + + void + dom_content (const dom_content_optional&); + + const xercesc::DOMDocument& + dom_content_document () const; + + xercesc::DOMDocument& + dom_content_document (); + + bool + null_content () const; + // DOM association. // public: @@ -1237,7 +1263,44 @@ public: }; -

For more information about DOM association refer to +

When xml_schema::type is used to create an instance + (as opposed to being a base of a derived type), it represents + the XML Schema anyType type. anyType + allows any attributes and any content in any order. In the + C++/Tree mapping this content can be represented as a DOM + fragment, similar to XML Schema wildcards (Section + 2.12, "Mapping for any and + anyAttribute").

+ +

To enable automatic extraction of anyType content + during parsing, the --generate-any-type option must be + specified. Because the DOM API is used to access such content, the + Xerces-C++ runtime should be initialized by the application prior to + parsing and should remain initialized for the lifetime of objects + with the DOM content. For more information on the Xerces-C++ runtime + initialization see Section 3.1, "Initializing the + Xerces-C++ Runtime".

+ +

The DOM content is stored as the optional DOM element container + and the DOM content accessors and modifiers presented above are + identical to those generated for an optional element wildcard. + Refer to Section 2.12.2, "Mapping for any + with the Optional Cardinality Class" for details on their + semantics.

+ +

The dom_content_document() function returns the + DOM document used to store the raw XML content corresponding + to the anyType instance. It is equivalent to the + dom_document() function generated for types + with wildcards.

+ +

The null_content() accessor is an optimization function + that allows us to check for the lack of content without actually + creating its empty representation, that is, empty DOM document for + anyType or empty string for anySimpleType + (see the following section for details on anySimpleType).

+ +

For more information on DOM association refer to Section 5.1, "DOM Association".

2.5.3 Mapping for anySimpleType

@@ -1250,18 +1313,37 @@ class simple_type: public type { public: simple_type (); + simple_type (const C*); + simple_type (const std::basic_string<C>&); + simple_type (const simple_type&); -public: simple_type& operator= (const simple_type&); -public: virtual simple_type* _clone () const; + + // anySimpleType text content. + // +public: + const std::basic_string<C>& + text_content () const; + + std::basic_string<C>& + text_content (); + + void + text_content (const std::basic_string<C>&); }; +

When xml_schema::simple_type is used to create an instance + (as opposed to being a base of a derived type), it represents + the XML Schema anySimpleType type. anySimpleType + allows any simple content. In the C++/Tree mapping this content can + be represented as a string and accessed or modified with the + text_content() functions shown above.

2.5.4 Mapping for QName

-- cgit v1.1