The second parameter of the function serialize.attribute() is "qname" - this is the qualified name of the attribute. In your example you set only the local name and the namespace (uri) is still NS_ETSI_M2M (maybe that is intended??):
Back to your last question - prefix:attribute_local_name. In XML/EXI the prefix is just a short notation for the namespace (uri). In EXI you encode the qualified name for elements/attributes each time you encode them. So it does not use prefixes by default. Note that in most cases, prefixes are not really needed - they rarely carry any information but rather are only use to shorten the namespace references.
If you really need the prefixes (most likely not) you need to use the preserve prefixes fidelity option in the EXI header:
Hi,
I am currently using the libraries without schema. What I would like to have is a XML that has the attribute as QName.
<tns:application xmlns:tns="blabla" tns:id="app"/>
In the examples I only found how to do:
<tns:application xmlns:tns="blabla" id="app"/>
What I am doing now is:
...
TRY_CATCH_ENCODE(serialize.startDocument(&testStrm));
...
How do I obtain an attribute with the structure prefix:attribute_local_name ?
Thank you!
Francesca
Hi Francesca,
The second parameter of the function serialize.attribute() is "qname" - this is the qualified name of the attribute. In your example you set only the local name and the namespace (uri) is still NS_ETSI_M2M (maybe that is intended??):
Back to your last question - prefix:attribute_local_name. In XML/EXI the prefix is just a short notation for the namespace (uri). In EXI you encode the qualified name for elements/attributes each time you encode them. So it does not use prefixes by default. Note that in most cases, prefixes are not really needed - they rarely carry any information but rather are only use to shorten the namespace references.
If you really need the prefixes (most likely not) you need to use the preserve prefixes fidelity option in the EXI header:
Best regards,
Rumen