KB Article #45687
Using XSD NameSpace in Datamapper
We've created an ADF from an XSD. The Xsd contains namespaces. When we look at the adf in the datamapper it detects which namespace an element belongs to, it says "//ELEM! //NS=s" in the directives. When mapping to this element I expect the outdata to be like this:
< s:Verb >Add< /s:Verb >
But the namespace is missing, it creates the element as < Verb >Add< Verb >
How should I do to make it use the namespace in the element?
Resolution
To add namespaces as prefix , we need to use literals.Literlas provides a way through which we can add namespaces to output XML file.
1.) Create Literals on input side. suppose String1 and String 2
2.) Map String 1 with name/xmlAttr
3.) MapString2 with value/xmlAttr
4.) Map Envelop to xmlAttr
5.) Inside the link code of string1->name/xmlAttr, you nees to mention the source expression like "xmlns:s" as in your case which is mentioned in your XSD file.
6.) In same way , mention the source expression for string2->value/xmlAttr like "urn:segments" which is according to the XSD file which you are using. Source expression must be in double quotes.
This will show the output as described above in problem.