Xsd schema not returning wanted xml file

45 Views Asked by At

In OIC I read a file based on a xsd schema. The output of the file is not How I expected or wanted it to be.

I have this xsd schema.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
           xmlns:tns="http://supoc.oracle.com/RICEFData"
           targetNamespace="http://supoc.oracle.com/RICEFData"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           nxsd:stream="chars"
           nxsd:version="NXSD"
           nxsd:encoding="UTF8"
           nxsd:encodeLineTerminators="false"
>
    <xs:element name="Root">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="1" maxOccurs="unbounded" name="RICEFData">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:choice maxOccurs="unbounded">
                                <xs:element minOccurs="1" maxOccurs="unbounded" name="ENV" nxsd:startsWith='"ENV"|'>
                                    <xs:complexType>
                                        <xs:sequence>
                                            <xs:element name="C2" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C3" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C4" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C5" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C6" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C7" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C8" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C9" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C10" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C11" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
                                        </xs:sequence>
                                    </xs:complexType>
                                </xs:element>
                                <xs:element minOccurs="1" maxOccurs="unbounded" name="HDR" nxsd:startsWith='"HDR"|'>
                                    <xs:complexType>
                                        <xs:sequence>
                                            <xs:element name="C2" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C3" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C4" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C5" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C6" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C7" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C8" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C9" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C10" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C11" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C12" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C13" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C14" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C15" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C16" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C17" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C18" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C19" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C20" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C21" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C22" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C23" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C24" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C25" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C26" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C27" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C28" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C29" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C30" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C31" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C32" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C33" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C34" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C35" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C36" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C37" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C38" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C39" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C40" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C41" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C42" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C43" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C44" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C45" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C46" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
                                        </xs:sequence>
                                    </xs:complexType>
                                </xs:element>
                                <xs:element minOccurs="1" maxOccurs="unbounded" name="LIN" nxsd:startsWith='"LIN"|'>
                                    <xs:complexType>
                                        <xs:sequence>
                                            <xs:element name="C2" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C3" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C4" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C5" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C6" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C7" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C8" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C9" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C10" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C11" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C12" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C13" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C14" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C15" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C16" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C17" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C18" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C19" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C20" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C21" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C22" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C23" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C24" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C25" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C26" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C27" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C28" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C29" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C30" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C31" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C32" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C33" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C34" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C35" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C36" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C37" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C38" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C39" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C40" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C41" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C42" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C43" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C44" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C45" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C46" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C47" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C48" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C49" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C50" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C51" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C52" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C53" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C54" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C55" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C56" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C57" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C58" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C59" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C60" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C61" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C62" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C63" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
                                        </xs:sequence>
                                    </xs:complexType>
                                </xs:element>
                                <xs:element minOccurs="1" maxOccurs="unbounded" name="LTX" nxsd:startsWith='"LTX"|'>
                                    <xs:complexType>
                                        <xs:sequence>
                                            <xs:element name="C2" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C3" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C4" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C5" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C6" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C7" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="|"/>
                                            <xs:element name="C8" type="xs:string" minOccurs="0" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
                                        </xs:sequence>
                                    </xs:complexType>
                                </xs:element>
                            </xs:choice>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

It reads a csv file that contains different records with each a different amount of fields

Now the problem is as followed. Example file that is read:

"ENV"|........ "HDR"|........ "LIN"|........ "LTX"|........ "LTX"|........ "LIN"|........ "LTX"|........ "ENV"|........ "HDR"|........ "LIN"|........ "LTX"|........

See it as this. ENV contains ticket data HDR contains Ticket Details. Lin contains item data LTX contains item info.

So each ticket kan have multiple items.

How I want my output of the file:

<RicefData>
   <env>
      (All the data)
   </env>
   <HDR>
      (All the data)
   </HDR>
   <LIN>
      (All the data)
   </LIN>
   <LTX>
      (All the data)
   </LTX>
   <LTX>
      (All the data)
   </LTX>
   <LIN>
      (All the data)
   </LIN>
   <LTX>
      (All the data)
   </LTX>
</RicefData>
<RicefData>
   <env>
      (All the data)
   </env>
   <HDR>
      (All the data)
   </HDR>
   <LIN>
      (All the data)
   </LIN>
   <LTX>
      (All the data)
   </LTX>
</RicefData>

BUT this is how I get the output:

<RicefData>
   <env>
      (All the data)
   </env>
   <HDR>
      (All the data)
   </HDR>
   <LIN>
      (All the data)
   </LIN>
   <LTX>
      (All the data)
   </LTX>
   <LTX>
      (All the data)
   </LTX>
   <LIN>
      (All the data)
   </LIN>
   <LTX>
      (All the data)
   </LTX>
   <env>
      (All the data)
   </env>
   <HDR>
      (All the data)
   </HDR>
   <LIN>
      (All the data)
   </LIN>
   <LTX>
      (All the data)
   </LTX>
</RicefData>

What Do I need to change in my schema So I have multiple RicefData fields?

It will always be max 1 env and hdr in a ricefData block. and LIN and LTX can be unlimited.

0

There are 0 best solutions below