Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » XSD with a variable subtree definition(Define an XSD to validate an XMLs with a subtree which you cannot predict in advance its structure)
XSD with a variable subtree definition [message #1819654] Mon, 20 January 2020 13:35 Go to next message
Alessandro Corti is currently offline Alessandro CortiFriend
Messages: 1
Registered: January 2020
Junior Member
I'm trying to define an XSD to validate the XMLs with a "variable" subtree <DOR_DATA> which you cannot predict in advance its structure.

For example. The <DOR_DATA> subtree could be:

<DOR_DATA><banner>Y</banner></DOR_DATA>
<DOR_DATA><dati><formaGiur>100</formaGiur></dati></DOR_DATA>
<DOR_DATA><dati><banner>Y</banner><formaGiur>100</formaGiur></dati></DOR_DATA>

The following XSD is wrong and I cannot find the solution:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="...XMLSchema....">
<xsd:element name="DATA">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="DOCUMENTS" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="DOCUMENT" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1">
<xsd:element name="DOR_ID" minOccurs="1" maxOccurs="1" type="xsd:integer" />
<xsd:element name="DOR_DATA">
<xsd:complexType >
<xsd:sequence>
<xsd:any />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Re: XSD with a variable subtree definition [message #1819676 is a reply to message #1819654] Tue, 21 January 2020 06:45 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This forum is for asking questions about the use of Eclipse's XML Schema Definition model, not for general "help me author a schema" questions. Using wildcards seems the right general approach to what you state you are trying to achieve, but you haven't actually asked any question at all.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:XML
Next Topic:XSD file - Restriction from imported namespace
Goto Forum:
  


Current Time: Sat Apr 20 04:15:38 GMT 2024

Powered by FUDForum. Page generated in 0.02898 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top