I have a CRM entity XML message as follows:
<c:KeyValuePairOfstringanyType xmlns:c="ns1" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" >
....
<c:value i:type="**b:AliasedValue**" **xmlns:b="ns3"**>
SomethingHere...
</c:value>
</c:KeyValuePairOfstringanyType>
Then I deserialized it to an object and serialized back to xml
I get
<c:KeyValuePairOfstringanyType xmlns:c="ns1" xmlns:i="http://www.w3.org/2001/XMLSchema- instance" >
<c:value i:type="b:AliasedValue" >
SomethingHere...
</c:value>
</c:KeyValuePairOfstringanyType>
I loose the xmlns:b definition.
Any idea why?
forty-two is right: attribute values do not carry any default semantics, so the namespace usage isn’t recognized as such by xml processors.
if you wish to refer to some
b-data in youri:type-attribute, you my use a mapping element to associatec:valuewith a (hypothesized)b:value, i.e.:… where you would declare
_:refas IDREF attributes in the respective xml schemas. you may have to adjust the design for 1:n-/m:n – mappings e.g. by having referrers as child elements of_:value.best regards, carsten