Troubble in namespace land

Home Page Forums BizTalk 2004 – BizTalk 2010 Troubble in namespace land

Viewing 1 reply thread
  • Author
    Posts
    • #19025

      Evening gents,

      I’m having an issue I can’t seem to wrap my head around and solve it.

      I have an xml like this:

      <

      Root xmlns=http://Test1 xmlns:test=http://Test2><test:data>

      <

      Field>Field_0</Field></test:data>

      </

      Root>

      It has an element reference to another namespace, but the root doesn’t have a namespace prefix. Without the test2 what I would have to do was to set the element formdefault to qualified. but once I add the reference to Test2 the “Field” element generates a validation error:

      The element ‘data’ in namespace ‘http://Test2&#8217; has invalid child element ‘Field’ in namespace ‘http://Test1&#8217;. List of possible elements expected: ‘Field’.

      I can get around that in a few different ways by changing the xml file, but in this case that is not an option, I need to be able to define a schema that matches the xml as it is.

      Test1.xsd:

      <?xml version=”1.0″ encoding=”utf-16″?>
      <xs:schema xmlns:b=”http://schemas.microsoft.com/BizTalk/2003” xmlns:test=”http://Test2” xmlns=”http://Test1” elementFormDefault=”qualified” targetNamespace=”http://Test1” xmlns:xs=”http://www.w3.org/2001/XMLSchema“>
        <xs:import schemaLocation=”Test2.xsd” namespace=”http://Test2” />
        <xs:annotation>
          <xs:appinfo>
            <b:references>
              <b:reference targetNamespace=”http://SomePlace” />
            </b:references>
          </xs:appinfo>
        </xs:annotation>
        <xs:element name=”Root”>
          <xs:complexType>
            <xs:sequence>
              <xs:element ref=”test:data” />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:schema>

      Test2.xsd:

      <?xml version=”1.0″ encoding=”utf-16″?>
      <xs:schema xmlns:b=”http://schemas.microsoft.com/BizTalk/2003” xmlns=”http://Test2” elementFormDefault=”unqualified” targetNamespace=”http://Test2” xmlns:xs=”http://www.w3.org/2001/XMLSchema“>
        <xs:element name=”data”>
          <xs:complexType>
            <xs:sequence>
              <xs:element name=”Field” type=”xs:string” />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:schema>

      Any pointers would be much apprechiated!

      Thanks, Dan

    • #19030

      Note: 

      <b:reference targetNamespace=”http://SomePlace” /> is supposed to be

      <b:reference targetNamespace=”http://Test2” />

      I just made a misstake when I posted. The error is still the same, just need to change to the second line if you need to test this yourself.

       

      Dan 

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.