Greetings -
Below you'll find a sample of my schema. What I'm trying to accomplish
is for any xml file created against this schema not to validate with
only element1.
<xsd:element name="PSD" type="RootDocum entType"/>
<xsd:complexTyp e name="RootDocum entType">
<xsd:sequence >
<xsd:element name="element1"/>
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
<!-- another attempt -->
<xsd:element name="PSD" type="someOther Type"/>
<xsd:group name="E234">
<xsd:sequence >
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:group>
<xsd:complexTyp e name="someOther Type">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="element1"/>
<xsd:group ref="E234"/>
</xsd:sequence>
</xsd:complexType >
For example:
<!-- not valid -->
<PSD>
<element1/>
</PSD>
<!-- valid -->
<PSD>
<element1/>
<element2/>
<element3/>
<element4/>
</PSD>
<!-- valid -->
<PSD>
<element1/>
<element3/>
</PSD>
.... and so on. I don't know if it's possible, I'm hoping someone can
prove me wrong. I'm sure it's something simple I'm missing. 4 1295
Hi Noiroi,
You can write the content model as below, in order to force one of the
element2, element3 or element4 to appear after element1:
e1, (
(e2, e3*, e4*)|
(e3+, e4*) |
e4+
)
In XML Schema syntax that will be
<xsd:sequence >
<xsd:element name="element1"/>
<xsd:choice>
<xsd:sequence >
<xsd:element name="element2" type="someTypes "/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
<xsd:sequence >
<xsd:element name="element3" type="someTypes "
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
<xsd:element name="element4" type="someTypes "
maxOccurs="unbo unded"/>
<xsd:choice>
</xsd:sequence>
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
Noiroi wrote:
Greetings -
Below you'll find a sample of my schema. What I'm trying to accomplish
is for any xml file created against this schema not to validate with
only element1.
<xsd:element name="PSD" type="RootDocum entType"/>
<xsd:complexTyp e name="RootDocum entType">
<xsd:sequence >
<xsd:element name="element1"/>
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
<!-- another attempt -->
<xsd:element name="PSD" type="someOther Type"/>
<xsd:group name="E234">
<xsd:sequence >
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:group>
<xsd:complexTyp e name="someOther Type">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="element1"/>
<xsd:group ref="E234"/>
</xsd:sequence>
</xsd:complexType >
For example:
<!-- not valid -->
<PSD>
<element1/>
</PSD>
<!-- valid -->
<PSD>
<element1/>
<element2/>
<element3/>
<element4/>
</PSD>
<!-- valid -->
<PSD>
<element1/>
<element3/>
</PSD>
... and so on. I don't know if it's possible, I'm hoping someone can
prove me wrong. I'm sure it's something simple I'm missing.
Hi George -
Thank you for your input. I can see where you're going with your
example. I've tried it that way, but still e1 can validate on it's own.
Here are the allowed combinations:
e1, (
(e3*) |
(e2?) |
(e4*) |
(e2?, e3*) |
(e2?, e4*) |
(e3*, e4*) |
(e2?, e3*, e4*)
)
In your schema example, it was a choice of sequences. The problem that
I'm running in to is that the elements are optional within the
sequences. I can't figure out how to enforce a selection of optional
elements so that e1 is never alone. Any ideas?
Keeping the Faith-
Franklyn
George Bina wrote:
Hi Noiroi,
You can write the content model as below, in order to force one of the
element2, element3 or element4 to appear after element1:
e1, (
(e2, e3*, e4*)|
(e3+, e4*) |
e4+
)
In XML Schema syntax that will be
<xsd:sequence >
<xsd:element name="element1"/>
<xsd:choice>
<xsd:sequence >
<xsd:element name="element2" type="someTypes "/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
<xsd:sequence >
<xsd:element name="element3" type="someTypes "
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
<xsd:element name="element4" type="someTypes "
maxOccurs="unbo unded"/>
<xsd:choice>
</xsd:sequence>
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
Noiroi wrote:
Greetings -
Below you'll find a sample of my schema. What I'm trying to accomplish
is for any xml file created against this schema not to validate with
only element1.
<xsd:element name="PSD" type="RootDocum entType"/>
<xsd:complexTyp e name="RootDocum entType">
<xsd:sequence >
<xsd:element name="element1"/>
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
<!-- another attempt -->
<xsd:element name="PSD" type="someOther Type"/>
<xsd:group name="E234">
<xsd:sequence >
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:group>
<xsd:complexTyp e name="someOther Type">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="element1"/>
<xsd:group ref="E234"/>
</xsd:sequence>
</xsd:complexType >
For example:
<!-- not valid -->
<PSD>
<element1/>
</PSD>
<!-- valid -->
<PSD>
<element1/>
<element2/>
<element3/>
<element4/>
</PSD>
<!-- valid -->
<PSD>
<element1/>
<element3/>
</PSD>
... and so on. I don't know if it's possible, I'm hoping someone can
prove me wrong. I'm sure it's something simple I'm missing.
Ok, I took another look at what you were describing and came up with:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="unqualifie d">
<xs:import namespace="http ://www.w3.org/XML/1998/namespace"/>
<xs:include schemaLocation= "AttrTypes. xsd"/>
<xs:element name="PSD">
<xs:complexType >
<xs:sequence>
<xs:element ref="e1"/>
<xs:choice>
<xs:sequence>
<xs:element ref="e3" minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="e2" minOccurs="0"/>
<xs:element ref="e3" minOccurs="0" maxOccurs="unbo unded"/>
<xs:element ref="e4" minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="e3" minOccurs="0" maxOccurs="unbo unded"/>
<xs:element ref="e4" minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="e4" minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="e2" minOccurs="0"/>
<xs:element ref="e3" minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="e2" minOccurs="0"/>
<xs:element ref="e4" minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="e2" minOccurs="0"/>
</xs:sequence>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="e1" type="attrTypes "/>
<xs:element name="e3" type="attrTypes "/>
<xs:element name="e2" type="attrTypes "/>
<xs:element name="e4" type="attrTypes "/>
</xs:schema>
Which would work great, but I'm missing something simple here. I get an
error referring to the second e3 stating that it's not unique... I'm
not trying to redefine e3, just use it in another sequence. So, the
thought of using an abstract type comes to mind, but I'm thinking I'm
going to get the same results... any ideas?
-F
Hi,
Look again into my example, it does not allow element1 alone. See that
all starting elements in each sequence must appear at least once.
The content model as you wrote it
e1, (
(e3*) |
(e2?) |
(e4*) |
(e2?, e3*) |
(e2?, e4*) |
(e3*, e4*) |
(e2?, e3*, e4*)
)
allows e1 alone. All the content that can be generated by the above
model plus the restriction that e1 should not be alone can be also
generated by the content model from my initial example.
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
Noiroi wrote:
Hi George -
Thank you for your input. I can see where you're going with your
example. I've tried it that way, but still e1 can validate on it's own.
Here are the allowed combinations:
e1, (
(e3*) |
(e2?) |
(e4*) |
(e2?, e3*) |
(e2?, e4*) |
(e3*, e4*) |
(e2?, e3*, e4*)
)
In your schema example, it was a choice of sequences. The problem that
I'm running in to is that the elements are optional within the
sequences. I can't figure out how to enforce a selection of optional
elements so that e1 is never alone. Any ideas?
Keeping the Faith-
Franklyn
George Bina wrote:
Hi Noiroi,
You can write the content model as below, in order to force one of the
element2, element3 or element4 to appear after element1:
e1, (
(e2, e3*, e4*)|
(e3+, e4*) |
e4+
)
In XML Schema syntax that will be
<xsd:sequence >
<xsd:element name="element1"/>
<xsd:choice>
<xsd:sequence >
<xsd:element name="element2" type="someTypes "/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
<xsd:sequence >
<xsd:element name="element3" type="someTypes "
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
<xsd:element name="element4" type="someTypes "
maxOccurs="unbo unded"/>
<xsd:choice>
</xsd:sequence>
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
Noiroi wrote:
Greetings -
>
Below you'll find a sample of my schema. What I'm trying to accomplish
is for any xml file created against this schema not to validate with
only element1.
>
<xsd:element name="PSD" type="RootDocum entType"/>
<xsd:complexTyp e name="RootDocum entType">
<xsd:sequence >
<xsd:element name="element1"/>
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:complexType >
<!-- another attempt -->
<xsd:element name="PSD" type="someOther Type"/>
<xsd:group name="E234">
<xsd:sequence >
<xsd:element name="element2" type="someTypes " minOccurs="0"/>
<xsd:element name="element3" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
<xsd:element name="element4" type="someTypes " minOccurs="0"
maxOccurs="unbo unded"/>
</xsd:sequence>
</xsd:group>
<xsd:complexTyp e name="someOther Type">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="element1"/>
<xsd:group ref="E234"/>
</xsd:sequence>
</xsd:complexType >
>
For example:
<!-- not valid -->
<PSD>
<element1/>
</PSD>
>
<!-- valid -->
<PSD>
<element1/>
<element2/>
<element3/>
<element4/>
</PSD>
>
<!-- valid -->
<PSD>
<element1/>
<element3/>
</PSD>
>
... and so on. I don't know if it's possible, I'm hoping someone can
prove me wrong. I'm sure it's something simple I'm missing.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael Wein |
last post by:
Hello,
does anyone know of a tool that automatically anonymizes a DTD or XML
Schema? By anonymizing I mean renaming all elements/type definitions but
still containing the structure, esp. the references/dependencies.
Background: we have problems handling an XML Schema with our XML editor and
the vendor requires the schema for debugging purposes. But unfortunately
the XML Schema comes from a different company and contains confident...
|
by: Atif |
last post by:
Hi
I have read about XML and its use for transferring data. I have alot
of mis conceptions. Let's take an example
I have database at two locations L1 and L2, both locations are using
different DBMSs but having same schema(datatypes and other rules). If
i want to transfer data from L1 to L2, it 's not a web based
application. More precisely, i would make connection with L2 and will
request data through SQL query into the recordset. Would...
|
by: Matt McMinn |
last post by:
I'm trying to have an XML file validate against an inline schema. The
declarations follow:
<PLMXML xmlns="http://www.plmxml.org/Schemas/PLMXMLSchema"
xmlns:data="x-schema:#inLineSchema">
<Schema name="inLineSchema"
targetNamespace="http://www.plmxml.org/Schemas/PLMXMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema"
elementFormDefault="qualified"
|
by: Ed Trembicki-Guy |
last post by:
Does anyone know of an existing tool or template to merge the contents
of a base schema and an extension schema that uses the <redefine> tag
to extend the base schema?
I need to extract a subset of a very large schema so that I can use it
with JAXB. I have created an xslt template to do this, and it works
as long as the entire schema is in one file. The trouble is, I need
to work with an extended schema, and xslt does not recognize the...
|
by: Andy Dingley |
last post by:
I'm writing XSLT to transform fntg-schema (our own project's document
schema) into PartnerML, a HTML-like XML dialect used for mobile
phones. I'm using XMLSPy 4.4 to do this.
The schema for PartnerML is supplied in several modules, brought
together by <xs:include> and <xs:import> statements. My understanding
(and experiment) suggests that XMLSpy can't work with such a
modularized schema.
As a result, my XSLT documents have a header...
| |
by: David Laub |
last post by:
The following valid XSD schema can NOT be successfully read by the
ReadXMLSchema method of the DataSet object - it errors out with a
"NonEmptyString not defined" error. This schema is more complex than a
plain vanilla schema, but doesn't strike me as obscenely complex.
Are there general rules for what can an can not be mapped between any XSD
schema & a .net DataSet?
Thanks
|
by: Aray |
last post by:
There were some different type elements. each of the type has arbitary
amount of Elements, and all those Elements is in ramdon order, How Can I
write the Schema file?
|
by: Grant Robertson |
last post by:
If I use the 'any' element in my schema to allow elements from another
schema to be used in instance documents based on my schema, is there a
way to force that the contents of that element must be an entire,
complete instance document for that other schema?
Let's say I have the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="BogusElement"...
|
by: SBearss |
last post by:
Does anyone know how to specify a dataset ( or diffgram) as an element
in a schema?
For example and empty schema is defined as
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="NewDataSet" xmlns="" xmlns:xsd="http://www.w3.org/2001/
XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xsd:complexType>
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |