Splitting Records using Biztalk

Home Page Forums BizTalk 2004 – BizTalk 2010 Splitting Records using Biztalk

Viewing 1 reply thread
  • Author
    Posts
    • #16726

      Hi there,

       

      i am having an xml file that contains the following structure:

      <Colors>

       <Color>

         <FrontColor>Red</FrontColor>

         <BackColor>Black</BackColor>

      </Color>

       

       <Color>

         <FrontColor>Green</FrontColor>

         <BackColor>Black</BackColor>

      </Color>

      .

      .

      .

       

      I want to do a process for each Color Record, as i read that the XML disassembler can do this for me, what i want to know is that, do i have to do a schema for the Colors "The header", and another for the Color "The Envelope" ??

       

      Please guide me if i was wrong.

       

      Thanks in advance,

       

       

    • #16733

      You need to create an envelope and document schema.

      Here is an example with both envelope and document in the same schema file. You should be able to deploy this schema and use the standard XmlReceive pipleine to debatch your file into separate <Color> messages 

      <?xml version="1.0" encoding="utf-16"?>
      <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:annotation>
          <xs:appinfo>
            <b:schemaInfo is_envelope="yes" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element name="Colors">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo body_xpath="/*[local-name()='Colors' and namespace-uri()='']" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" ref="Color" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Color" type="ColorType" />
        <xs:complexType name="ColorType">
          <xs:sequence>
            <xs:element name="FrontColor" type="xs:string" />
            <xs:element name="BackColor" type="xs:string" />
          </xs:sequence>
        </xs:complexType>
      </xs:schema> 

       

      You may also have problems without any namespaces in your xml. The message type of the envelope will be #Colors and the message type of the document will be #Color. If you have any other schemas deployed wuth the same root nodes and without a namespace things will become difficult.

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