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

p.s.tilma at knid.nl p.s.tilma at knid.nl
Tue Feb 2 15:45:02 EST 2021


Anjum, 2 february 2021

Hello everybody,

I am busy with a project in which field sensor data has to be read from
or written to a XML file. For my project I compiled all necessary XML
schema files with xsdcxx cxx-tree. The generated *.cxx and *.hxx files
are then added to my project. After compilation and linking I have a
working application. In this application I have a button for parsing
and (after modification) serialising to a xml file, and a button for
creating an object model from scratch.

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.

The relevant part of my XML file :
         <measuredData>
             <swe:description>Measurement error vs.
temperature</swe:description>
             <swe:elementCount>
               <swe:Count>
                 <swe:value>5</swe:value>
               </swe:Count>
             </swe:elementCount>
             <swe:elementType name="point">
               <swe:DataRecord>
                 <swe:label>Error vs. Temperature</swe:label>
                 <swe:field name="temp">
<swe:Quantitydefinition="http://sweet.jpl.nasa.gov/2.0/physThermo.owl#Temperature">
                     <swe:label>Temperature</swe:label>
                     <swe:uom code="Cel"/>
                   </swe:Quantity>
                 </swe:field>
                 <swe:field name="error">
                   <swe:Quantity
definition="http://sweet.jpl.nasa.gov/2.0/sciUncertainty.owl#Error">
                     <swe:label>Relative Error</swe:label>
                     <swe:uom code="%"/>
                   </swe:Quantity>
                 </swe:field>
               </swe:DataRecord>
             </swe:elementType>
             <swe:encoding>
               <swe:TextEncoding blockSeparator=" " tokenSeparator=","/>
             </swe:encoding>
             <swe:values>*0,5 10,2 50,2 80,5 100,15*</swe:values>
         </measuredData>

So my first question is : how do I read or write the contents (sensor data)
of element <swe:values>

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.

Attached : swe-profile.xsd

Hopefully you can give me some hints or tips.
Kind regards from
Pier Tilma
Anjum
The Netherlands

-------------- next part --------------
A non-text attachment was scrubbed...
Name: swe-profile.xsd
Type: application/xml
Size: 33756 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/xsd-users/attachments/20210202/8d0019c4/swe-profile.xml


More information about the xsd-users mailing list