Generating Schema for existing xml file
This should cover W3C XML Schema, Relax NG and DTD related problems.
			- 
				Nickmaster90
 - Posts: 2
 - Joined: Thu Apr 22, 2021 3:32 pm
 
Generating Schema for existing xml file
Post by Nickmaster90 »
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!
- 
				tavy
 - Posts: 396
 - Joined: Thu Jul 01, 2004 12:29 pm
 
Re: Generating Schema for existing xml file
Hello,
The generation does not work properly in this case. I think you need change the generated schema and set the "figure" and "figDesc" elements optional. Something like this:
Best Regards,
Octavian
			
			
									
									The generation does not work properly in this case. I think you need change the generated schema and set the "figure" and "figDesc" elements optional. Something like this:
Code: Select all
<xs:element ref="figure" minOccurs="0"/>
<xs:element ref="figDesc" minOccurs="0"/>
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
						<oXygen/> XML Editor
http://www.oxygenxml.com
- 
				Nickmaster90
 - Posts: 2
 - Joined: Thu Apr 22, 2021 3:32 pm
 
Re: Generating Schema for existing xml file
Post by Nickmaster90 »
Thank you for your help, now it works!
			
			
									
									
						
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
 - ↳ Feature Request
 - ↳ Common Problems
 - ↳ DITA (Editing and Publishing DITA Content)
 - ↳ Artificial Intelligence (AI Positron Assistant add-on)
 - ↳ SDK-API, Frameworks - Document Types
 - ↳ DocBook
 - ↳ TEI
 - ↳ XHTML
 - ↳ Other Issues
 - Oxygen XML Web Author
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Content Fusion
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen JSON Editor
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen PDF Chemistry
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Feedback
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen XML WebHelp
 - ↳ Feature Request
 - ↳ Common Problems
 - XML
 - ↳ General XML Questions
 - ↳ XSLT and FOP
 - ↳ XML Schemas
 - ↳ XQuery
 - NVDL
 - ↳ General NVDL Issues
 - ↳ oNVDL Related Issues
 - XML Services Market
 - ↳ Offer a Service