cancel
Showing results for 
Search instead for 
Did you mean: 

Namespace issue

glenn_karlsson2
Participant
0 Kudos

Hi experts,

I have an imported complex xsd in PI that acts as the target of my message mapping.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:osn="http://perfect.com/LiteEnvelope/xcbl" xmlns="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd" targetNamespace="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd" elementFormDefault="qualified" version="1.0">
   <xs:include schemaLocation="schemas/Order.xsd" />
   <xs:import namespace="http://perfect.com/LiteEnvelope/xcbl" schemaLocation="osnxcbl.xsd" />
   <xs:element name="OSNOrder">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="Order" type="Order" />
            <xs:element name="Envelope" type="osn:EnvelopeType" />
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

When I process this mapping, the target xml-file says, after the xml begin tag

<OSNChangeOrder xmlns="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd">

I want the namespace to include all the :xs and :osn namespaces as well, like

<OSNChangeOrder xmlns="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osn="http://perfect.com/LiteEnvelope/xcbl" xsi:schemaLocation="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd osnxcbl35.xsd">

I assume that the file I get have the namespace assigned as targetNamespace.

My question: Can I fix the target namespace so that it includes all of what I want, like in the second example? If so, how do I do it? Do I have to use XSLT?

kind regards,

Glenn

Accepted Solutions (0)

Answers (2)

Answers (2)

glenn_karlsson2
Participant
0 Kudos

Hi all,

Are there no other ways to achieve this than xslt? Can't I do something to the imported xsd file? Are PI limited to one namespace if I do not use xslt mapping?

regards,

Glenn

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>I want the namespace to include all the :xs and :osn namespaces as well, like

You basically want to add namespace prefix. This can be done using XMLAnonymizerBean module.

refer this link

http://help.sap.com/saphelp_nw04/helpdata/en/45/d169186a29570ae10000000a114a6b/content.htm

glenn_karlsson2
Participant
0 Kudos

Hi,

My problem is not that I want to set prefixes before existing namespaces. I just get the namespace from example 1, but I would like to have all namespavces like in example 2.

So I don't think the anonymizeBean is of any use in this case.

kind regards,

Glenn

Former Member
0 Kudos

Hi Glenn,

You can try with XSLT.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
       <xsl:template match="OSNChangeOrder">
        <xsl:element name="{name()}" namespace="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd">
            <xsl:attribute name="xsi:schemaLocation">osnxcbl35.xsd
</xsl:attribute>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
    </xsl:template>
 <xsl:template match="OSNChangeOrder">
        <xsl:element name="{name()}" namespace="http://perfect.com/LiteEnvelope/xcbl">
<xsl:attribute name="osn:schemaLocation">osnxcbl.xsd
</xsl:attribute>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>

I havent tested....just try from your side...and modify for your requirement.

Thanks

Ray..