on 07-26-2016 8:26 PM
Hi Experts,
I have an inbound interface, the XSD is shared by the partner and its used in the mapping. The mapping is expecting <ns0 in the beginning of every element however the XML we are getting from partner does not have it. How do I add it or what i can do to process the XML's
XML expected by PI mapping
<?xml version="1.0" encoding="UTF-8"?>
<ns0:ED xmlns:ns0="http://www.abc.com/ED">
<ns0:Header>
<ns0:Period/>
<ns0:Count/>
</ns0:Header>
<ns0:ED1>
<ns0:SAP/>
<ns0:WorkDate/>
</ns0:ED1>
</ns0:ED>
XML sent by partner
<ear:ED xmlns:ear="http://www.abc.com/ED">
<Header>
<Period>4</Period>
<Count>4</Count>
</Header>
<ED1>
<SAP>00813518</SAP>
<WorkDate>121212</WorkDate>
</ED1>
Thanks,
Nishant Chavan
Hi Nishant,
You can use XSLT also you can create a UDF with the following code to set the required NS qualifier to each
StructureNode node = ((StructureNode) container.getParameter("STRUCTURE_NODE"));
node.setNSDeclarations(" xmlns:ns0=\"http://sap.com/xi/XXXX\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:yourNS=\"http://abc.com/" xsi:schemaLocation=\"http://abc.com " "); // notice the space before xmlns:
node.setQName("ns0:yourelement");
return "";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nishant,
Modify your xsd File, use elementFormDefault="qualified", then the mapping use not ns0
then import again
something like this in the schema of your XSD
<types>
<xsd:schema targetNamespace="http://xmlns.cocose.com/ora/INTC/WEB_POPO_WS/TAKE" elementFormDefault="qualified">
<xsd:element name="CXMLTYPE-TAKEN">
Regards Juan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nishant,
Ask the sender to send proper XSD or change the supplied XSD in editor to something like this
<?xml version="1.0" encoding="UTF-8"?>
<ear::ED xmlns:ns0="http://www.abc.com/ED">
<Header>
<Period/>
<Count/>
</Header>
<ED1>
<SAP/>
<WorkDate/>
</ED1>
</ear:ED>
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wouldn't it make sense to enquire partner why they are sending wrong XML? The XML they send is not valid against the schema! Change the XSD or XML. Make things in order. Don't make workaround.
/k
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nishant,
Are you using just one xsd? Adding or changing elementFormDefault="qualified" could do the trick.
Regards.
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nishant!
You can use XSL transformation:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://www.abc.com/ED"
xmlns:ear="http://www.abc.com/ED"
exclude-result-prefixes="ear">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="*">
<xsl:element name="ns0:{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.