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

I have a map in BizTalk 2009 that converts some data into an XML document that will be sent to another system. The target schema includes some elements with attributes xml:lang. BizTalk generates them as ns1:lang. The target system requires the use of a prefix xml.

Here is a simplified example showing what BizTalk does:

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

<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>

Card output example

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

Is there a way to convince BizTalk to use a prefix xml?

0
source share
3 answers

As far as I know, there is no built-in way to achieve this.

There are, however, two solutions that I see:

XML StyleSheet

- xsl, XML :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ns1="http://www.w3.org/XML/1998/namespace"
                ...
                >
...
<xsl:attribute name="ns1:lang">
...

BizTalk, . , XSLT , .

  • .
  • BizTalk
  • , .

xsl :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xml="http://www.w3.org/XML/1998/namespace"
                ...
                >
...
<xsl:attribute name="xml:lang">
...

.

  • Visual Studio .
  • BizTalk.
  • XSL .

Custom BizTalk Mapper XSL Path

, . , , BizTalk. .

. , .

, . , .

+4

Maxime, , :

, API- .

, . , BizTalk :

Output validation error: Prefix 'ns1' cannot be mapped to namespace name reserved for "xml" or "xmlns".

, BizTalk!? Youre , ns1. !

script XSL .

, BizTalk. , dummy, xml: lang functoid.`

/

, , , , XML /, .

0

, , - , .

<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xml="http://www.w3.org/XML/1998/namespace">
  <xs:import schemaLocation="xml.xsd" namespace="http://www.w3.org/XML/1998/namespace" />
0

All Articles