Generating Schema for existing xml file
Posted: Thu Apr 22, 2021 3:41 pm
Dear Oxygen Users,
I have an xml file which looks like follows
I used the oxygen tool Creating Schema and got this:
After that, I want to validate the existing xml file against the newly created schema:
I get the error message that <figure> and <figDesc> are in the wrong place. Can anyone tell me what my mistake is?
Thank you!
I have an xml file which looks like follows
Code: Select all
<body>
<figure><figure><figDesc>1950er Jahre</figDesc></figure></figure></body>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="body">
<xs:complexType>
<xs:sequence>
<xs:element ref="figure"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="figure">
<xs:complexType>
<xs:sequence minOccurs="0">
<xs:element ref="figure"/>
<xs:element ref="figDesc"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="figDesc" type="xs:string"/>
</xs:schema>
Code: Select all
<body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DRG14test.xsd">
<figure><figure><figDesc>1950er Jahre</figDesc></figure></figure></body>
Thank you!