none
BizTalk remove ns0 from populating RRS feed

  • Question

  • I have this schema, when I generate the instance its always giving me ns0 for everything in the beginning. How can I avoid this. I don't need ns0 to be populated ?

    <ns0:Root xmlns:ns0="http://Company.Integration.IPM.Schemas.IPM_SR">
     <ns0:req CpnyId="CpnyId_0" VendId="VendId_1" InvcNbr="InvcNbr_2" InvcDate="1999-05-31" ReqAmt="1">
      <ns0:rit CpnyId="CpnyId_0" Acct="Acct_1" Sub="Sub_2" TranAmt="1" Descr="Descr_4">rit_0</ns0:rit> 
      </ns0:req>
      </ns0:Root>

    below is my schema

    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://Brightstar.Integration.Serengeti.IPM.Schemas.IPM_SR" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    	<xs:element name="Root">
    		<xs:complexType>
    			<xs:sequence>
    				<xs:element name="req" maxOccurs="unbounded" minOccurs="1">
    					<xs:complexType>
    						<xs:sequence>
    							<xs:element name="rit" maxOccurs="unbounded" minOccurs="1">
    								<xs:complexType>
    									<xs:simpleContent>
    										<xs:extension base="xs:string">
    											<xs:attribute type="xs:string" name="CpnyId" use="required"/>
    											<xs:attribute type="xs:string" name="Acct" use="required" />
    											<xs:attribute type="xs:string" name="Sub" use="optional"/>
    											<xs:attribute name="TranAmt" use="required">
    												<xs:simpleType>
    													<xs:restriction base="xs:decimal"> 
    														<xs:minExclusive value="0"/>
    													</xs:restriction> 
    												</xs:simpleType>
    											</xs:attribute>
    											<xs:attribute type="xs:string" name="Descr" use="required" />
    										</xs:extension>
    									</xs:simpleContent>
    								</xs:complexType>
    							</xs:element>
    						</xs:sequence>
    						<xs:attribute type="xs:string" name="CpnyId" use="required"/>
    						<xs:attribute type="xs:string" name="VendId" use="required"/>
    						<xs:attribute type="xs:string" name="InvcNbr" use="required"/>
    						<xs:attribute type="xs:date" name="InvcDate" use="required"/>
    						<xs:attribute name="ReqAmt" use="required">
    							<xs:simpleType>
    								<xs:restriction base="xs:decimal"> 
    									<xs:minExclusive value="0"/>
    								</xs:restriction> 
    							</xs:simpleType>
    						</xs:attribute>
    					</xs:complexType>
    				</xs:element>
    			</xs:sequence>
    		</xs:complexType>
    		<xs:unique name="VendId_InvcNbr">
    			<xs:selector xpath="req"/>
    			<xs:field xpath="@CpnyId"/>
    			<xs:field xpath="@VendId"/>
    			<xs:field xpath="@InvcNbr"/>
    		</xs:unique>
    	</xs:element>
    </xs:schema>


    MBH


    • Edited by JaguarsJag Monday, June 15, 2015 10:53 PM info
    Monday, June 15, 2015 10:50 PM

Answers

  • Using one output as the source to another map should not be a problem.  .Net handles the namespaces just fine so it's likely the problem is actually the second map or schema.

    As for the target system, there's nothing wrong with pushing this back to them until they tell you, and equally importantly your management, that they are not Xml compliant and expect you to accommodate them.  This more of a project issues then a technical one.  Trust me, you want to make it very clear the problem is on their side.

    • Marked as answer by Angie Xu Tuesday, June 23, 2015 2:33 AM
    Tuesday, June 16, 2015 11:44 AM
    Moderator
  • I think you can deal with mapping with namespace until finishing all your business processes and once you want to send message you can remove namespace by using namespace removal pipeline

    https://msdn.microsoft.com/en-us/library/ee250047%28v=bts.10%29.aspx?f=255&MSPPError=-2147217396

    You need first to install ESB Toolkit then you can take dll from that sample

    Then you can add remove namespace component to your send pipeline.


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    Tuesday, June 16, 2015 7:23 AM

All replies

  • Well, what exactly is the problem?

    That format, Qualified, is perfectly valid xml.

    You can change the Element Form Default value of the <Schema> node to either (Default) or Unqualified and you will only get the root qualified.

    Monday, June 15, 2015 11:04 PM
    Moderator
  • I changed Attribute form Default, Element FormDefault to unqualified, still receiving ns0: before Root. How can I avoid this

    <ns0:Root xmlns:ns0="http://Brightstar.Integration.Serengeti.IPM.Schemas.IPM_SR">
     <req CpnyId="CpnyId_0" VendId="VendId_1" InvcNbr="InvcNbr_2" InvcDate="1999-05-31" ReqAmt="1">
      <rit CpnyId="CpnyId_0" Acct="Acct_1" Sub="Sub_2" TranAmt="1" Descr="Descr_4">rit_0</rit> 
      </req>
      </ns0:Root>


    MBH

    Monday, June 15, 2015 11:07 PM
  • That unfortunately is not possible with the tools as they are.

    That is still completely valid xml so what exactly is the problem?  If you are dealing with a non-compliant system, you first task is to get them to accept valid Xml.

    Understanding that they may be unwilling to change, keep in mind, this is not your problem or a problem with BizTalk.

    If you still have to deal with it, the ESB Namespace Remove can probably help you out. If not, let us know what the actual issue is and we can offer some other options.

    Tuesday, June 16, 2015 12:11 AM
    Moderator
  • The problem what Iam facing is, I have an xslt (.xsl file) mapped from source to destination schema, and this destinTion schema is source for another map. The first map (.xsl file) is generating correct output without ns0, but taking this output as input to schema is failing validation at root node i.e it is requiring ns0 to pass. If Iam adding ns0 , then it is working. So I want to remove that ns0 from schema

    MBH

    Tuesday, June 16, 2015 1:16 AM
  • While not recommended and the BizTalk Schema Editor will give you a warning, you can create a schema WITHOUT TARGET NAMESPACE. This will ensure that there is no namespace assigned to the generated XML.

    Regards.

    Tuesday, June 16, 2015 7:06 AM
  • I think you can deal with mapping with namespace until finishing all your business processes and once you want to send message you can remove namespace by using namespace removal pipeline

    https://msdn.microsoft.com/en-us/library/ee250047%28v=bts.10%29.aspx?f=255&MSPPError=-2147217396

    You need first to install ESB Toolkit then you can take dll from that sample

    Then you can add remove namespace component to your send pipeline.


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    Tuesday, June 16, 2015 7:23 AM
  • Another option is to add the namespace and prefixes in your custom xslt.

    Tuesday, June 16, 2015 7:57 AM
  • the thing is if I add ns0 in custom xslt and send data, the destination side where the data is send doesn't like the ns0 prefixes, that will make their validation fail

    MBH

    Tuesday, June 16, 2015 8:51 AM
  • Hi ,

    You can make your name space empty and then try to execute your xslt . It will work it that way  or else you can read the incoming message in custom Pipeline and update the ns0 premix with empty string . 

    There are couple of articles for this map chaining .

    Removing ns0 prefix from biztalk output message

    Removing XML namespace in BizTalk

    Thanks

    Abhishek

    Tuesday, June 16, 2015 9:03 AM
  • Well, I proposed this option as you stated that the output from the xslt is used as input to another map, the latter requiring the qualified Rootnode.

    If the ultimate destination cannot cope with namespace prefixes, but still require a namespace specified, you'll have to resort the aforementioned pipelinecomponents from the ESB Toolkit.Regards,

    René

    Tuesday, June 16, 2015 9:17 AM
  • Using one output as the source to another map should not be a problem.  .Net handles the namespaces just fine so it's likely the problem is actually the second map or schema.

    As for the target system, there's nothing wrong with pushing this back to them until they tell you, and equally importantly your management, that they are not Xml compliant and expect you to accommodate them.  This more of a project issues then a technical one.  Trust me, you want to make it very clear the problem is on their side.

    • Marked as answer by Angie Xu Tuesday, June 23, 2015 2:33 AM
    Tuesday, June 16, 2015 11:44 AM
    Moderator
  • how can I add ns0: namespace in my xslt ?

    MBH

    Tuesday, June 16, 2015 4:36 PM
  • That's the thing, you shouldn't have to.  It's the namespace declaration in the xslt that counts.  The prefix is local only
    Tuesday, June 16, 2015 6:08 PM
    Moderator
  • Hi JaguarsJag,

    How did you resolve this issue? Were you able to remove ns0: from Root level? Any help would be much appreciated. Thank you!

    -RJ

    Monday, January 20, 2020 7:55 PM
  • I usually use the ESB Toolkit pipeline components.  ESB Remove namespace and  ESB Add Namespace

    Note: That if you have multiple namespaces it will remove all of them, which could cause other issues.

    As per John's answer, you really need to push back and ask why they need this removed, as it is part of the XML standard, and if they can't support it they are not compliant with it.

    Monday, January 20, 2020 9:54 PM