Skip to Main Content

DevOps, CI/CD and Automation

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!

XML Compare with XSD template(xml copy editor)

841964Apr 1 2011 — edited Apr 6 2011
Hi,

I've define one xml based on certain rules and validations. After that my xml file needs to be validated through 'xml copy editor' tool. In this tool I've one pre-defined .xsd template which it will validates the naming conventions and type of the element.

Now my xml file has few number of records, when I am validating with .xsd for one record it is showing the validation successful. If I happen to keep three records then it is throwing me this error in the status bar.

Validation stopped at line 40, column 32: Element 'DETAILS' is not valid for content model: '(HEADER,DETAILS)'

Can somebody please guide as whether this .xsd template only validates single record are for the entire records will it validates. I am in state of confusion how to treat that.

this is sample file
--------------------------------------
<?xml version="1.0" encoding="UTF-8"?><GEBIZ_ACCOUNT_SEGMENT_MASTER>
<HEADER>
<MINISTRY_CODE>RPO</MINISTRY_CODE>
<DEPARTMENT_CODE>000</DEPARTMENT_CODE>
<FINANCIAL_SYSTEM>
<GENERAL_LEDGER_BUSINESS_UNIT>RP</GENERAL_LEDGER_BUSINESS_UNIT>
</FINANCIAL_SYSTEM>
</HEADER>
<DETAILS>
<SEGMENT>
<NUMBER>5</NUMBER>
<CODE>5</CODE>
<DESCRIPTION>Office Refreshments</DESCRIPTION>
<START_DATE>2004-05-22</START_DATE>
<END_DATE>2011-02-28</END_DATE>
<STATUS>NEW</STATUS>
<DISABLE_FLAG>N</DISABLE_FLAG>
</SEGMENT>
</DETAILS>
<DETAILS>
<SEGMENT>
<NUMBER>6</NUMBER>
<CODE>6</CODE>
<DESCRIPTION>CPD-(STA) Gamelan Course (Intermediate)</DESCRIPTION>
<START_DATE>2004-05-22</START_DATE>
<END_DATE/>
<STATUS>NEW</STATUS>
<DISABLE_FLAG>N</DISABLE_FLAG>
</SEGMENT>
</DETAILS>
<DETAILS>
<SEGMENT>
<NUMBER>4</NUMBER>
<CODE>4</CODE>
<DESCRIPTION>NYC YEP Funding-Service-learning projects</DESCRIPTION>
<START_DATE>2004-05-22</START_DATE>
<END_DATE/>
<STATUS>NEW</STATUS>
<DISABLE_FLAG>N</DISABLE_FLAG>
</SEGMENT>
</DETAILS>
</GEBIZ_ACCOUNT_SEGMENT_MASTER>
--------------------------------------------------

And here is my .xsd template
----------------------
<?xml version="1.0" encoding="UTF-8"?>

<!--
Account Segment
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="GEBIZ_ACCOUNT_SEGMENT_MASTER">
<xs:complexType>
<xs:sequence>
<xs:element ref="HEADER" />
<xs:element ref="DETAILS" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="HEADER">
<xs:complexType>
<xs:sequence>
<xs:element ref="MINISTRY_CODE" />
<xs:element ref="DEPARTMENT_CODE" />
<xs:element ref="FINANCIAL_SYSTEM" maxOccurs="1"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="MINISTRY_CODE" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="DEPARTMENT_CODE" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="FINANCIAL_SYSTEM">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="1"
ref="GENERAL_LEDGER_BUSINESS_UNIT" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="GENERAL_LEDGER_BUSINESS_UNIT" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="5" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="DETAILS">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="SEGMENT" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="SEGMENT">
<xs:complexType>
<xs:sequence>
<xs:element ref="NUMBER" />
<xs:element ref="CODE" />
<xs:element ref="DESCRIPTION" />
<xs:element ref="START_DATE" />
<xs:element ref="END_DATE" />
<xs:element ref="STATUS" />
<xs:element ref="DISABLE_FLAG" />
</xs:sequence>
</xs:complexType>
</xs:element>


<xs:element name="NUMBER" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
<xs:maxInclusive value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="CODE" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="DESCRIPTION" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="START_DATE" nillable="false" type="xs:date" />

<xs:element name="END_DATE" nillable="true" type="xs:date" />


<xs:element name="STATUS" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NEW" />
<xs:enumeration value="UPDATE" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="DISABLE_FLAG" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Y" />
<xs:enumeration value="N" />
</xs:restriction>
</xs:simpleType>
</xs:element>

</xs:schema>

------------------------------------

If I keep only record then it validates well against .xsd template, if multiple records exist then validation in the xml copy editor is throwing error for the same .xsd template.

Please give me inputs on this subject.

Thanks in advance.

Regards
Nagendra
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 4 2011
Added on Apr 1 2011
6 comments
820 views