Skip to content

xsi:type support is not working when multiple name spaces exist #239

@abdulsathar-m

Description

@abdulsathar-m

When Unmarsalling from XML to JSON it's not converting to the xsi:type, You can see the sample code here
This is the XML I have tried,
<Well xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.namespace1.com"> <Aliases xmlns="http://www.defaultnamespace.com"> <Description>Identifier is created from the uid of the input scheme</Description> </Aliases> <ReferencePoint> <Location xsi:type="ProjectedWellLocation"> <Description>Location of well surface point in projected system.</Description> <Coordinate1>coordinate</Coordinate1> </Location> </ReferencePoint> </Well>

Here Location is marked with xsi:type="ProjectedWellLocation", but the JSON output its converted as its base type "AbstractWellLocation". If I removed the "Aliases" section then it's working correctly. so the issue is happening when there is defaultElementNamespace referenced.

After debugging the issue found that here failing to get the xsiTypeInfo, because of namespaceContext.getNamespaceURI(prefix) giving wrong namespace from Jsonix.Schema.XSD.QName.INSTANCE.parse()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions