Hello,

I want to read the following xml with all the fields and attributes:

---------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<rootelement someId="11756">
    <subgroup subgroupId="25">
        <someString>this is a string</someString>
    </subgroup>
</rootelement>
---------------------------------------------------------------------------------------------


But I cannot read the attributes "someId" and "subgroupId".

I tried with the following code that just prints to the logfile:

---------------------------------------------------------------------------------------------

void operator>>= (const cxxtools::SerializationInfo& si, Dummy& fields)
{
    size_t count = si.memberCount();
    log_info("root: " << si.name());

    for (size_t idx = 0; idx < count; ++idx)
    {
        // get current field
        cxxtools::SerializationInfo oneField = si.getMember(idx);

        if (oneField.memberCount() > 0) // it is a group
        {
            log_info("Group: " << oneField.typeName());
            // keep name of current parent in mind
            parentName.push(oneField.typeName());

            oneField >>= fields;

            // get rid of the last groupname
            parentName.pop();
        }
        else
        {
            std::string value;
            oneField.getValue(value);
            log_info("Field: " << oneField.typeName() << ": " << value);
        }
    }
}
---------------------------------------------------------------------------------------------



Could someone give me a hint on how to read the attributes?

Cheers
Raphael
------------------------------------------------------------------------------
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to