Hi there, I have defined an XML schema for some information I am going
to import into a database.
What I do not know how to do in the schema is to ensure if
<numberOfItem s> is 6, then there has to be 6 entries of <item> under
<listOfItems> . Currently I am having to do this in my (Java)
application code.
<dataToImport >
<numberOfItems> 6</numberOfItems>
<listOfItems>
<item>GHY-098</item>
<item>GHY-108</item>
<item>GHY-109</item>
<item>GHY-112</item>
<item>GHY-113</item>
<item>GHY-999</item>
<listOfItems>
</dataToImport>
The XML above is valid when I put the following line in my schema
<xsd:element name="item" minOccurs="6" maxOccurs="6">
but not every <listOfItems> contains 6 <item> lines. I want a way of
saying that the minOccurs and maxOccurs equal the value in
<numberOfItems> , which in this case is 6 but also may be 8, or 4, or
any other number.
Can this be done in an XML Schema?
Although it is probably in this book "XML in a Nutshell, a Desktop
Quick Reference, 2nd Ed" I cannot find the information.
Thank you
Tony 1 1722
minOccurs="6" maxOccurs="6"
Bob Foster
"Antony" <to************ ****@hotmail.co m> wrote in message
news:37******** *************** ***@posting.goo gle.com... Hi there, I have defined an XML schema for some information I am going to import into a database.
What I do not know how to do in the schema is to ensure if <numberOfItem s> is 6, then there has to be 6 entries of <item> under <listOfItems> . Currently I am having to do this in my (Java) application code.
<dataToImport > <numberOfItems> 6</numberOfItems> <listOfItems> <item>GHY-098</item> <item>GHY-108</item> <item>GHY-109</item> <item>GHY-112</item> <item>GHY-113</item> <item>GHY-999</item> <listOfItems> </dataToImport>
The XML above is valid when I put the following line in my schema
<xsd:element name="item" minOccurs="6" maxOccurs="6">
but not every <listOfItems> contains 6 <item> lines. I want a way of saying that the minOccurs and maxOccurs equal the value in <numberOfItems> , which in this case is 6 but also may be 8, or 4, or any other number.
Can this be done in an XML Schema?
Although it is probably in this book "XML in a Nutshell, a Desktop Quick Reference, 2nd Ed" I cannot find the information.
Thank you Tony This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike |
last post by:
Note: My XML experience to date has (unfortunately) been limited to reading
and thinking, rather than implementation.
Anyway, I am in the process of trying to figure out the most efficient way
to validate and transform some very large (potentially over 100MB) XML
documents. This is related to another question I will post next, but for
now, I want to focus on one particular topic.
The data in question has particular business rules...
|
by: wumingshi |
last post by:
Hi,
When validating an XML instance, sometimes the schema is not enough to
expression the validation rules. Additional validation rules may be
expressed in an application-specific way. For example, using XPath or
Java method. So is there a concept and/or standard for post-schema
validation or application validation? Is there any hook in XML
standards that allow me to hook up with my customized validation?
Additionally and more...
|
by: Leonid Shprekher |
last post by:
Question to the Schema pro:
If nillable="False" is default for Schema element, why schema validation of
my XML doesn't fail if I don't provide any value for the tag?
Thanks,
Leonid.
|
by: Shone |
last post by:
I would like to perform a 2-pass XML reading from a stream. Once using
the Validating reader, just to confirm the validity against the
schema, and next time to do a reading to extract the data. Actually,
second time I do a deserialization, the data from XML is fed directly
to an object.
The problem I am experiencing is the error at the second reading
attempt, and error description implies that reader is winded to the
end of the XML and...
|
by: Dan Bass |
last post by:
There's an XML message I have, that has no namespace information.
Then there is a XSD schema that is must validate against, but this has a
targetNamespace and xmlns of "http://www.wbf.org/xml/b2mml-v02".
How do I get this XML to validate against the Schema in C#?
If I use XmlSpy (2005 home edition) to perform the validation, it first
inserts namespace and schema information into the XML before validating.
Validation then seems to work if...
| |
by: Stefano |
last post by:
Hi all,
what is the correct use of the "default" attribute in XML Schema?
For example:
<xs:element name="myProperty" type="xs:string" default="myDefaultValue"/>
What can I do with it? What is the meaning of <
....default="myDefaultValue" /> ?
|
by: Ali |
last post by:
I am having problem compiling schema contained in WSDL file when analyzing
schema types contained in it (for example
http://www.ebout.net/net/GoogleSearch.wsdl).
Following code demonstrates my problem:
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.Xml.Schema;
|
by: billa1972 |
last post by:
Hi,
I am trying to hook into Yellow Freight's rating webservice. Below is the
wsdl. When i try and create a proxy file with wsdl.exe i get the following
errors, see below.
Also, when i reference this wsdl in .NET it seems to do it fine, yet there
are no objects to reference except RateQuoteBeanService.
In the WSDL it looks like there should be getRateQuote, and QUOTEREQUEST, etc.
|
by: wolf_y |
last post by:
My question is simply: under what conditions will empty tags of the
form <MOM></MOM> pass schema validation? Of course, the mirror
question is: under what conditions will empty tags fail validation?
The former seems to be an easier question to answer.
XML files will arrive from around the world and must be schema
validated before further processing and loading into a database, so I'm
trying to foresee the various layouts that might be...
|
by: Mark Parter |
last post by:
I'm trying convert an XML Schema
(http://www.elframework.org/projects/xcri/efc_r1.0.xsd/view) to a VB.Net
class using the XSD tool provided with the .NET 2 SDK. However, it's failing
to generate the class and is outputting the following error(s);
Schema validation warning: Undefined complexType
'http://purl.org/dc/elements/1.1/:SimpleLiteral' is used as a base for
complex type extension. Line 433, position 5.
Schema validation warning:...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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.
| |