Problems with namespace prefix

Home Page Forums BizTalk 2004 – BizTalk 2010 Problems with namespace prefix

Viewing 1 reply thread
  • Author
    Posts
    • #14417

      I’m new to all this so please excuse my ignorance 🙂
      Case: I made a schema for my XML data that looks like this:

      [code:1:72c3072d7e]<?xml version=\"1.0\" encoding=\"utf-16\"?>
      <xs:schema xmlns:b=\"http://schemas.microsoft.com/BizTalk/2003\" xmlns=\"http://BizTalk_Server_Project1.Schema1\" targetNamespace=\"http://BizTalk_Server_Project1.Schema1\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">
      <xs:element name=\"Root\">
      <xs:complexType>
      <xs:sequence>
      <xs:element minOccurs=\"1\" maxOccurs=\"unbounded\" name=\"Row\">
      <xs:complexType>
      <xs:sequence>
      <xs:element name=\"Field1\" type=\"xs:string\" />
      <xs:element name=\"Field2\" type=\"xs:string\" />
      <xs:element name=\"Field3\" type=\"xs:string\" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>[/code:1:72c3072d7e]

      When I chose Generate Instance on the schema in VS I get that following XML which works fine when I run it through my BizTalk project

      [code:1:72c3072d7e]<ns0:Root xmlns:ns0=\"http://BizTalk_Server_Project1.Schema1\">
      <Row>
      <Field1>Field1_0</Field1>
      <Field2>Field2_0</Field2>
      <Field3>Field3_0</Field3>
      </Row>
      </ns0:Root>[/code:1:72c3072d7e]

      My problem is that the real xml I will have to run through the project doesn’t have the ns0: prefix. Like this:

      [code:1:72c3072d7e]<Root xmlns=\"http://BizTalk_Server_Project1.Schema1\">
      <Row>
      <Field1>Field1_0</Field1>
      <Field2>Field2_0</Field2>
      <Field3>Field3_0</Field3>
      </Row>
      </Root>[/code:1:72c3072d7e]

      When I try to run that xml through biztalk it doesn’t work. I end up with an xml without the fields.

      I’m sure I’m just missing something simple and obvious. Afaik if you don’t have a ns prefix it should use the default namespace, which I set with the xmlns=\”http://BizTalk_Server_Project1.Schema1\” line in the schema, right?

      Any pointers would be appreciated

    • #14416

      Your two document examples are different.
      In the first document the Root element is in namespace ‘http://BizTalk_Server_Project1.Schema1&#8217; but the Row and Field elements have no namespace.

      In the second document all elements are in the ‘http://BizTalk_Server_Project1.Schema1&#8217; namespace.

      The easiest way to fix this is to open the schema, select the [b:9329ac149e]<Schema>[/b:9329ac149e] node and set the [b:9329ac149e]Element FormDefault[/b:9329ac149e] property to [b:9329ac149e]Qualified[/b:9329ac149e]

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