I need my BizTalk map to stop converting xml:lang to ns1:lang

Posted by Jeremy Stein on Stack Overflow See other posts from Stack Overflow or by Jeremy Stein
Published on 2010-12-30T16:47:41Z Indexed on 2010/12/30 16:54 UTC
Read the original article Hit count: 352

Filed under:
|
|

I have a map in BizTalk 2009 that is converting some data into an XML document to be sent on to another system. The target schema includes some elements with xml:lang attributes. BizTalk generates those as ns1:lang. The target system requires that the prefix xml be used.

Here is a simplified example to show what BizTalk is doing:

sample.xsd

<xs:schema targetNamespace="http://example.com/"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import schemaLocation="common.xsd"
             namespace="http://www.w3.org/XML/1998/namespace" />
  <xs:element name="example">
    <xs:complexType>
      <xs:attribute ref="xml:lang" />
    </xs:complexType>
  </xs:element>
</xs:schema>

common.xsd

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:xml="http://www.w3.org/XML/1998/namespace"
           targetNamespace="http://www.w3.org/XML/1998/namespace"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:attribute name="lang" type="xs:language" />
</xs:schema>

Example of map output

<ns0:example xmlns:ns0="http://example.com/"
             xmlns:ns1="http://www.w3.org/XML/1998/namespace"
             ns1:lang="en-US" />

Is there some way to convince BizTalk to use the xml prefix?

© Stack Overflow or respective owner

Related posts about xml-schema

Related posts about BizTalk