1 2 Previous Next 18 Replies Latest reply: Nov 1, 2013 1:26 AM by 950456 RSS

    xsd issue. multiple records with different values.

    950456

      I need some help in creating xsd.

       

      My data from the file will be as fallows.

       

      Sample file data

       

      AB xxxx  yyyy   zzz  ttttt

      bbb  hhh  ddd  jjj

      bbb  hhh  ddd  jjj

      bbb  hhh  ddd  jjj

      BC  xxxx  yyyy   zzz  ttttt

      ccc hhh  ddd  jjj

      ccc hhh  ddd  jjj

      ccc hhh  ddd  jjj

      CD xxxx  yyyy   zzz  ttttt

      ddd hhh  ddd  jjj

      ddd hhh  ddd  jjj

      ddd hhh  ddd  jjj

       

       

      My xsd is as fallows:


        <xsd:element name="Root-Element">

          <xsd:complexType>

            <xsd:sequence>

              <xsd:element name="Element" type="tns:mainelement" minOccurs="0" maxOccurs="unbounded"/>

            </xsd:sequence>

          </xsd:complexType>

        </xsd:element>

        <xsd:complexType name="mainelement">

          <xsd:sequence>

            <xsd:element name="Header" type="tns:HeaderType" maxOccurs="1"/>

            <xsd:element name="lineitem1" type="tns:lineitemrecord1" minOccurs="0" maxOccurs="unbounded" nxsd:lookAhead="0" nxsd:lookFor=""/>

          </xsd:sequence>

        </xsd:complexType>

       

        <xsd:complexType name="HeaderType">

          <xsd:sequence>   

            <xsd:element name="HeaderData" type="xsd:string" nxsd:style="fixedLength"

                         nxsd:length="2528"/>    

          </xsd:sequence>

        </xsd:complexType>

       

        <xsd:complexType name="lineitemrecord1">

          <xsd:sequence>

            <xsd:element name="RecordData" type="xsd:string" nxsd:style="fixedLength" nxsd:length="161"/>    

          </xsd:sequence>

        </xsd:complexType>

       

       

      How can differentiate the values in header field starting with [AB, BC,CD]   and data record fields starting with [bbb,ccc,ddd]

       

      I can not use nxsd: lookAhead and nxd:lookFor.

       

      Inputs required to process the file. what alteration should be made for the xsd in order to execute.

        • 1. Re: xsd issue. multiple records with different values.
          S.Ananth

          You may need to use a combination of xsd:choice, nxsd:conditionValue etc. For example,

           

          <xsd:element name="rootelement">

              <xsd:complexType>

                <xsd:choice minOccurs="1" maxOccurs="unbounded" nxsd:choiceCondition="terminated" nxsd:terminatedBy=" ">

                  <xsd:element name="header1" nxsd:conditionValue="AB">

                 <xsd:complexType>...</xsd:complexType>

                  </xsd:element>

                  <xsd:element name="data1" nxsd:conditionValue="bbb">

                    <xsd:complexType>...</xsd:complexType>

                  </xsd:element>

                  <xsd:element name="header2" nxsd:conditionValue="BC">

                    <xsd:complexType>...</xsd:complexType>

                  </xsd:element>

                 ...

                </xsd:choice>

              </xsd:complexType>

            </xsd:element>

           

          You can use the file adapter native format builder wizard to automatically build the corresponding schema based on a sample file.

          • 2. Re: xsd issue. multiple records with different values.
            PuneetRekhade

            You can use "startsWith" attribute to differentiate the header and the data rows.

            Refer this document - http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/nfb.htm, Section : Processing Elements Within a Sequence Model Group Based on the Condition

            • 3. Re: xsd issue. multiple records with different values.
              950456

              Hi Puneeth,

               

              I had gone through the link you had mentioned above, But its taking long time to test the XSD in the adapter.

              Tested the xsd mentioned in the link with the sample data provided. Even this is taking so much time to execute in adapter.

              If possible can you suggest some examples to go through.

               

              as mentioned in

              6.2.2.6  condition processing


              is it single xsd. or referring from different xsd's.   <!---PO------>       <!-- SO -->  <!-- IN -->

               

              Its taking so much time to execute. following is the xsd in reference to the xsd you asked me to refer..

               

               

               

              <?xml version="1.0" encoding="UTF-8" ?>

              <schema xmlns="http://www.w3.org/2001/XMLSchema"

                          xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"

                          xmlns:tns="http://TargetNamespace.com/Input"

                          targetNamespace="http://TargetNamespace.com/Input"

                          elementFormDefault="qualified" attributeFormDefault="unqualified"

                          nxsd:version="NXSD" nxsd:stream="chars" nxsd:encoding="US-ASCII"

                          nxsd:normalizeLineTerminators="false">

               

              <element name="container">

               

                <complexType>

                  <sequence maxOccurs="unbounded">

                 

                    <element ref="tns:Record51" minOccurs="0" nxsd:startsWith="69" />

                 

                   

                        

                  </sequence>

                </complexType>

              </element>

               

              <!-- PO -->

              <element name="Record51" type="tns:RecordType51"/>

               

              <complexType name="RecordType51">

                <sequence>

               

               

                                

                                

              <element name="HeaderRecord">

                     <complexType>

                      <sequence>

                        <element name="HeaderDetailRecord" minOccurs="0" maxOccurs="1">

                          <complexType>

                            <group ref="tns:HeaderLineItems" />

                          </complexType>

                        </element>

                      </sequence>

                    </complexType>

                  </element>

                 

               

                    

                

                

               

               

               

                 

                 

                 

                 

                 

                 

                 

                 

                    

                     <element name="DetailRecord">

                     <complexType>

                      <sequence>

                        <element name="Detail" minOccurs="0" maxOccurs="unbounded">

                          <complexType>

                            <group ref="tns:LineItems" />

                          </complexType>

                        </element>

                      </sequence>

                    </complexType>

                  </element>

                 

                </sequence>

              </complexType>

                    

                <group name="HeaderLineItems">

                <sequence>

                  <element name="RecordData" type="string" nxsd:style="fixedLength" nxsd:length="2526"/>

                   <element name="Filler" type="string" nxsd:style="terminated"

                     nxsd:terminatedBy="${eol}" fixed="" />

                </sequence>

              </group>

                

               

               

              <group name="LineItems">

                <sequence>

                  <element name="RecordData" type="string" nxsd:style="fixedLength" nxsd:length="161"/>

                   <element name="Filler" type="string" nxsd:style="terminated"

                     nxsd:terminatedBy="${eol}" fixed="" />

                </sequence>

              </group>

               

              </schema>

               

              <!--NXSDWIZ:C:\xxxxxxxx.txt:-->

              <!--USE-HEADER:false:-->

              • 4. Re: xsd issue. multiple records with different values.
                PuneetRekhade

                I had gone through the link you had mentioned above, But its taking long time to test the XSD in the adapter.

                Tested the xsd mentioned in the link with the sample data provided. Even this is taking so much time to execute in adapter.

                 

                How long does it take to test the example mentioned in the developer's guide ? Does it hangs in between ?

                6.2.2.6  condition processing

                 

                is it single xsd. or referring from different xsd's.   <!---PO------>       <!-- SO -->  <!-- IN -->

                Yes, it is one single XSD - try copy pasting in JDeveloper and validate schema, if in doubt..

                • 5. Re: xsd issue. multiple records with different values.
                  950456

                  Hi Puneeth,

                   

                  Thanks for the support. I did test the xsd described in the link with sample data mentioned.It's taking so long time to test in adapter.

                  But I want to mention the structure of the file in detail.

                   

                  My sample data will be as fallows.

                   

                  71  02/03/2013     sales     purchases     invoice

                  72     30     20     40

                  72     40     30     60

                  72     30     60     90

                  73  03/03/2013     sales     purchases     invoice

                  74     20     30     60

                  74     10     40     70

                  74     40     60     80

                  71   03/02/2013     sales                        invoice

                  72     40     30     80

                  72     20     40     80

                  73   02/03/2013               purchases             

                  74     20     50     80

                  74     10     30     90

                  75   03/10/2013     sales                         invoice

                  76     10     30     90

                  76     30     50     90

                   

                   

                  above sample file can be example of my structure. How can we read the data with the xsd. I already mentioned my xsd in previous reply. please go through once.

                  Based on the values 71,72,73,74,75,76 . I should read the data and get executed

                  • 6. Re: xsd issue. multiple records with different values.
                    PuneetRekhade

                    Is there a parent - child relationship kind of thing in your file structure ?

                    Row containing sales, purchases etc is the parent and the records following it are the child records, until we encounter any other record of the type "sales, purchases, invoice" ? Also, you tried using "conditionValue" and "startsWith" and it didn't worked.. Is it ?

                    • 7. Re: xsd issue. multiple records with different values.
                      950456

                      Hi,

                       

                      Yes there is dependent data. 71 will be having 72  and 73 will be having dependent data 74 and so on...

                       

                      I haven't used conditional value. but i need to read both header and dependent data. Which can not read with lookAhead and lookFor. since header and details records are varying..

                       

                      In details about the file.

                      it consists of Header and Detail Reocrds..

                       

                      Header consists

                      1. Personal information

                      2. Sales data

                      3. purchase data

                      4. Invoice data

                       

                      Detail records consists

                      1. some dependent data to personal information

                       

                      So in combine we need to differentiate header and detail records in xsd. I am not aware how we can use condition value.

                      In fact we need to split personal information,sales data, purchase data, invoice data to separate Files and dependent data to separate file. 

                      • 8. Re: xsd issue. multiple records with different values.
                        950456

                        Thanks dude..

                         

                        I used nxdcondition value.. ITs working

                        • 9. Re: xsd issue. multiple records with different values.
                          950456

                          Hi puneeth,

                           

                          Can we read nxsd:condition with sapces. I figured out i had to read some spaces in header where i need to 71,73,75, space.

                           

                          i need to write headers into one file and detail records into another file. where i am not able to write  values in condition values (71,73,75,-)

                          Please guide me, how we can write data without loosing the condition values too

                           

                          Can i read the values mentioned in condition value.. while testing with condition value, its omitting the values specified in condition values.

                          I need to write including with condition values

                          • 10. Re: xsd issue. multiple records with different values.
                            PuneetRekhade

                            Yes, you can read spaces using the "nxsd:conditionValue" but make sure you edit "nxsd:length" attribute accordingly. If you have to create 2 files for header and details, then, you need to have 2 different native XSDs and read the same input file using those 2 different XSD's which will give you 2 different XML's.

                             

                            In case, you want to use values present inside the conditionValue, you'll have to hard-code them in your XSD, because they've already been read by the parser.

                            For example, if you want to refer the example from Oracle's document, you can use :

                            ==============================

                            <complexType name="POType">

                              <sequence>

                                <element name="OrderType" default="PO"/>

                                <element name="Date" type="string" nxsd:style="terminated"

                                   nxsd:terminatedBy="^" />

                            ==============================

                            • 11. Re: xsd issue. multiple records with different values.
                              950456

                              Hi,

                               

                              In the above statement i am not able to understand following statement: but make sure you edit "nxsd:length" attribute accordingly.

                              I am following simple xsd. on condition basis

                               

                              71 09/08/2013 field1 filed2 field3 field4

                              72 field1 field2 field3 field4

                              72 field1 field2 field3 field4

                              72 field1 field2 field3 field4

                              73 09/08/2013 field1 filed2 field3 field4

                              74 field1 field2 field3 field4

                              74 field1 field2 field3 field4

                              74 field1 field2 field3 field4

                              73 09/08/2013 field1 filed2 field3 field4

                              74 field1 field2 field3 field4

                              74 field1 field2 field3 field4

                              74 field1 field2 field3 field4

                              71 09/08/2013 field1 filed2 field3 field4

                              71 09/08/2013 field1 filed2 field3 field4

                                   09/08/2013 field1 filed2 field3 field4

                              72 field1 field2 field3 field4

                              72 field1 field2 field3 field4

                              72 field1 field2 field3 field4

                               

                              Lets consider my sample as shown above.

                              My xsd is as fallows.

                               

                              <?xml version="1.0" encoding="UTF-8" ?>

                               

                              <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

                                          xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"

                                          xmlns:tns="http://TargetNamespace.com/InboundService"

                                          targetNamespace="http://TargetNamespace.com/InboundService"

                                          elementFormDefault="qualified"

                                          attributeFormDefault="unqualified"

                               

                                          nxsd:version="NXSD"

                                          nxsd:stream="chars"

                                          nxsd:encoding="US-ASCII"

                              >

                               

                               

                                <xsd:element name="Root-Element">

                                  <xsd:complexType>

                                    <xsd:choice maxOccurs="unbounded" nxsd:choiceCondition="fixedLength" nxsd:length="2">

                                      <xsd:element name="Header" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="(== 71) or (== 73)"/>

                                      <xsd:element name="Records" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="(== 72) or (== 74) ""/>

                               

                                   

                               

                                    </xsd:choice>

                                  </xsd:complexType>

                                </xsd:element>

                               

                              </xsd:schema>

                               

                              I need to read sapces. can you help me in modifying the xsd inorder to read sapces and write data to target with condition values

                              • 12. Re: xsd issue. multiple records with different values.
                                PuneetRekhade

                                <xsd:element name="Root-Element">

                                    <xsd:complexType>

                                      <xsd:choice maxOccurs="unbounded" nxsd:choiceCondition="fixedLength" nxsd:length="3">

                                        <xsd:element name="Header" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="(== 71 ) or (== 73 )"/>

                                        <xsd:element name="Records" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="(== 72 ) or (== 74 )"/>

                                 

                                Note the change in "nxsd:length" and "space" after "71", "73", "72" and "74".

                                 

                                Try this out..

                                • 13. Re: xsd issue. multiple records with different values.
                                  950456

                                  can you help me in writing the condition value along with the data. As i can see the condition values are missing while writing it to the file  71,73,72,74

                                  • 14. Re: xsd issue. multiple records with different values.
                                    950456

                                    hi

                                     

                                    can you view sample record with following value

                                     

                                         09/08/2013 field1 filed2 field3 field4

                                     

                                    from which starting record 71,73 are missing as in other records. record is having space. i need to read the space value instead of 71&73. (last fourth row in sample file)

                                     

                                    As you mentioned in above xsd. xsd length 3. i am facing issue with it. The issue is in my original file after 71 the records goes on 7100089 as on.

                                    with xsd lenght 3, 710 does not match with particular condition value mentioned choice condition.

                                    1 2 Previous Next