Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

XSD Validation, checking for required elements

573589Apr 20 2007 — edited May 13 2008
I'm using the FTP Adapter to retrieve a flat file in a format like this -

H|1|1234|5-APR-2007
L|1|33123|2
L|1|12345|1
L|1|6969|5
S|1|Milton Park, Abingdon, OX142NF

I have generated an XSD file using the built in wizard that looks like this -

<?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"
targetNamespace="http://bpelns.corp.rmd.org/complex"
xmlns:tns="http://bpelns.corp.rmd.org/complex"
elementFormDefault="qualified"
attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:stream="chars" nxsd:version="NXSD">
<xsd:element name="order">
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded" nxsd:choiceCondition="terminated" nxsd:terminatedBy="|">
<xsd:element name="HEADER" minOccurs="1" maxOccurs="1" nillable="false" nxsd:conditionValue="H">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ORDERID" nillable="false" minOccurs="1" maxOccurs="1" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
</xsd:element>
<xsd:element name="CUSTOMERID" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
</xsd:element>
<xsd:element name="ORDERDATE" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LINEITEM" minOccurs="1" maxOccurs="unbounded" nxsd:conditionValue="L">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ORDERID" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
</xsd:element>
<xsd:element name="PRODUCTCODE" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
</xsd:element>
<xsd:element name="QUANTITY" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SHIPPING" minOccurs="1" maxOccurs="1" nxsd:conditionValue="S">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ORDERID" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy="|" nxsd:quotedBy="&quot;">
</xsd:element>
<xsd:element name="ADDRESS" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>


I added the various minOccurs & maxOccurs attributes. I would like to be able to state that the element HEADER is required. However, despite the min & max values it carries straight through to the next point in the BPEL flow. I cannot use the required attribute type, as JDeveloper does not recognise this.

How can I acheive the validation I require ? Is the XSD the right place to be doing it (I thought so, as it is the schema definition) ? If I cannot do this with the XSD how else might I acheive it in a concise way, ie not using a big switch operation to test various elements.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 10 2008
Added on Apr 20 2007
8 comments
1,900 views