[xsd-users] Reading and writing sensor data from and to XML

Boris Kolpackov boris at codesynthesis.com
Mon Feb 8 06:33:22 EST 2021


p.s.tilma at knid.nl <p.s.tilma at knid.nl> writes:

> Parsing and serialising seem to work, but there is a problem. When I print
> the output in a textbox I do not see the data *0,5 10,2 50,2 80,5 100,15*
> (see element <swe:values> below) in the generated XML.

Here is the type of this element:

    <complexType name="EncodedValuesPropertyType">
        <complexContent mixed="true">
            <extension base="anyType">
                <attributeGroup ref="swe:AssociationAttributeGroup"/>
            </extension>
        </complexContent>
    </complexType>

As you can see it has mixed content (meaning elements and be mixed
with text in any order) and it derives from anyType (meaning that
it can contain any nested elements). So, in effect, this element can
contain anything. Naturally, there is no statically-typed mapping
for something like this so you will have to deal with it yourself.
There are several ways to do it as shown in the following examples
(part of the XSD package):

examples/cxx/tree/order/mixed/
examples/cxx/tree/custom/mixed/
examples/cxx/tree/mixed/


> Another question : I am also trying to create an object model from scratch.
> But during serialising the application crashes. How can you display errors
> which occur during serialisation.

That depends on why it is crashing. If it's due to a C++ exception, then
you can try to catch and print it to get more information (see "Error
Handling" sections in the documentation for details). If it crashed for
other reasons (e.g., access violation, etc), then you will need to use
a debugger.



More information about the xsd-users mailing list