473,803 Members | 3,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

having difficulties with 'choice'

3 New Member
Hi,

I'm currently busy writing an xsd at one point in time i whish that my xml must look like:
Expand|Select|Wrap|Line Numbers
  1. <object>
  2.     <loc>
  3.         <disk>
  4.             <drive>c</drive>
  5.             <path>temp\path</path>
  6.             <files>*.*</files>
  7.         </disk>
  8.     </loc>
  9.     <interval>
  10.         ...
  11.     </interval>
  12. </object>
or (choice)
Expand|Select|Wrap|Line Numbers
  1. <object>
  2.     <loc>
  3.         <network>
  4.             <server>localhost</server>
  5.             <path>temp\path</path>
  6.             <files>*.*</files>
  7.         </network>
  8.     </loc>
  9.     <interval>
  10.         ...
  11.     </interval>
  12. </object>
  13.  
or (another choice)
Expand|Select|Wrap|Line Numbers
  1. <object>
  2.     <loc>
  3.         <internet>
  4.             <uri>123.456.789.123</uri>
  5.             <path>temp\path</path>
  6.             <files>*.*</files>(optional (if webservice))
  7.             <port>8888</port>(optional)
  8.                 ....
  9.         </internet>
  10.     </loc>
  11.     <interval>
  12.         ...
  13.     </interval>
  14. </object>
  15.  
so the <loc> tag can contain (in my case) 5 different objects, which are all locations of some sorts. But the <loc> tag may only contain one (complex) child, which can be either an <internet>tag , a <network> tag or a <disk> tag.

How to get to my question: How do I pull this off in my XSD?

This is what I tried:
Expand|Select|Wrap|Line Numbers
  1. <xs:complexType name="Location">
  2.     <xs:sequence maxOccurs="1" minOccurs="1">
  3.         <xs:choice maxOccurs="1" minOccurs="1">
  4.             <xs:element name="localDisk" type="LocalDisk" maxOccurs="1" minOccurs="0" />
  5.             <xs:element name="networkLocation" type="NetworkLocation" maxOccurs="1" minOccurs="0" />
  6.             <xs:element name="internetSite" type="InternetSite" maxOccurs="1" minOccurs="0" />
  7.             <xs:element name="secureInternetSite" type="SecureInternetSite" maxOccurs="1" minOccurs="0" />
  8.             <xs:element name="ftpSite" type="FtpSite" maxOccurs="1" minOccurs="0" />
  9.         </xs:choice>
  10.     </xs:sequence>
  11. </xs:complexType>
  12.  
  13. <xs:complexType name="TextDataProvider">
  14.     <xs:sequence>
  15.         <xs:element name="location" type="Location" maxOccurs="1" minOccurs="1" />
  16.         <xs:element name="interval" type="Interval" maxOccurs="1" minOccurs="1" />
  17.         <xs:group ref="textSchema" maxOccurs="1" minOccurs="1" />
  18.     </xs:sequence>
  19.     <xs:attributeGroup ref="Identification" />
  20. </xs:complexType>
  21.  
  22. <xs:complexType name="Configuration">
  23.     <xs:sequence>
  24.         <xs:choice maxOccurs="3" minOccurs="1">
  25.             <xs:element name="textProviders" maxOccurs="unbounded" minOccurs="1" type="TextDataProviders" />
  26.             <xs:element name="csvProviders" maxOccurs="unbounded" minOccurs="0" type="CsvDataProviders" />
  27.             <xs:element name="xmlProviders" maxOccurs="unbounded" minOccurs="0" type="XmlDataProviders" />
  28.         </xs:choice>
  29.     </xs:sequence>
  30. </xs:complexType>
  31.  
  32. <xs:element name="configuration" type="Configuration"></xs:element>
  33.  
  34. <xs:complexType name="TextDataProviders">
  35.     <xs:sequence>
  36.         <xs:element name="dataprovider" type="TextDataProvider" minOccurs="0" maxOccurs="unbounded" />
  37.     </xs:sequence>
  38. </xs:complexType>
  39.  
But that doesn't do the trick, because when I'm forming an xml based on this xsd I can add as many locations of any kind within the location tag

I must be doing something wrong, I just can't see it at this time.

With kind regards,
- SL33PY
May 10 '06 #1
1 1501
SL33PY
3 New Member
I've been thinkering a bit, as well as reading some additional sources and I made a temp xsd and xml:

The temp xsd:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <xs:schema targetNamespace="XMLSchema1.xsd" elementFormDefault="qualified" xmlns="XMLSchema1.xsd"
  3.     xmlns:mstns="XMLSchema1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  4.     <xs:element name="Configuration">
  5.         <xs:annotation>
  6.             <xs:documentation>
  7.                 This tag describes the configuration of the system.
  8.                 It consists of maximum 3 childs representing the different kinds of
  9.                 providers that our application can process. Every child represents a group
  10.                 of data providers of a specific kind.
  11.             </xs:documentation>
  12.         </xs:annotation>
  13.         <xs:complexType>
  14.             <xs:choice minOccurs="1" maxOccurs="3">
  15.                 <xs:element name="TextProviders" maxOccurs="1" minOccurs="0" type="xs:string" /><!--type="TextProvidersType" />-->
  16.                 <xs:element name="CsvProviders" maxOccurs="1" minOccurs="0" type="xs:string" /><!--type="CsvProvidersType" />-->
  17.                 <xs:element name="XmlProviders" maxOccurs="1" minOccurs="0" type="xs:string" /><!--type="XmlProvidersType" />-->
  18.             </xs:choice>
  19.         </xs:complexType>
  20.     </xs:element>
  21. </xs:schema>
The temp xml:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Configuration xmlns="XMLSchema1.xsd">
  3.     <CsvProviders></CsvProviders>
  4.     <TextProviders></TextProviders>
  5.     <XmlProviders></XmlProviders>
  6. </Configuration>
  7.  
at this moment it works, but...

I adjusted my older xsd file and the xsd gets validated, still I cannot select it from the list (VS 2003) in the targetnamespace property field, I can select the xmlschema1.xsd but not my bigger one :confused:

I'll expand this test xsd and perhaps I can find out why the other doesn't work as intended. If anyone has hints/tips/more insight, please let me know asap

- SL33PY
May 10 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1504
by: James Bright | last post by:
I have set up custom Intellisense for our project. (In a nutshell, we will have ASP.NET controls based on many of the statndard WebControls, but with a few extensions that we will be adding). I've put a custom XSD in the schemas\xml directory and it works pretty great. It's largely based on the asp.xsd. My problem is that while this works great for most controls, providing Intellisense whenever I have: <foo:FooTextBox runat=server......
30
7451
by: aka | last post by:
Hi I have a DB2 v8.1 on AIX and DB2 Connect EE on Solaris wich is connected to OS/390 DB2 subsystems via APPC / SNA. I have cataloged the DB2 Connect instance as tcpip node and then the Host DB cataloged on that node...this works from v7.2 Fixpack 11 clients and servers, but with v8.1 server I get SQL1334N. Does anyone has an idea? Thanks
0
1220
by: Julia | last post by:
Hi, I am still having Charest conversion difficulties s when passing string from C# TO ASP and than to access using ADO I am using HttpWebRequest to POST some Multilanguage(Hebrew and English) to an ASP page which in turn uses ADO to save them to an access data base the access data base support(as I underatdn( UNICODE strings),I can insert Hebrew string fro access IDE)
15
1397
by: Edward Diener | last post by:
Why is it impossible to have a __value class instance variable in a __nogc class when it is possible to have a built-in type instance variable in a __nogc class ? __value class X { int a; }; __nogc class Y { X b; int c;}; // compiler error __nogc class Y { int c;}; // OK
9
1753
by: Jordan Tiona | last post by:
I can't get this code to work right. It seems to be skipping some of the cin functions. Can someone help me with this? ClassTrack.cpp: #include <iostream> #include "ClassTrack.h" using namespace std; const MAX_CLASSES = 12;
3
9996
by: jg.campbell.ng | last post by:
I'm beginning learning Python and OpenGL in Python. Python fine. But difficulties with OpenGL; presumably with the installation of OpenGL. OS = Linux FC5. Python program gl_test.py: from OpenGL.GLUT import *
1
1306
by: bau | last post by:
Hi everybody, I am using MS Access 2003 to prepare data for a scientific study. I have a table which look like that: "Customer" "Store" "Product" "Price" "week" "100" "Supermarket1" "XProduct" 2,20 $ 5 "101" "Supermarket2" "YProduct" 2,05 $ 2 "102" "Supermarket1" "ZProduct" 2,10 $ 1 "103" "Supermarket2" "XProduct" 2,05 $ 3
0
1038
by: RazSam | last post by:
Hi I am developing in c# .net 2,0 web forms and having some problems. Code is attached below. I have written code to export the contents of a Grid View to Excel, this works. The problem occurs when i change the contents of the datagrid such as apply a row filter to it. The new records have been binded to the datasource. I try to export those results to Excel but seem to the whole datagrid contents into Excel instead of the filtered...
2
7693
by: cmb3587 | last post by:
I am having a problem with the validation of the account number and password. The beginning of the program asks for users account # then pwd. The program is then supposed to go to a checkID method that checks the account number and pwd with 3 stored accounts (each account/pwd/balance is stored as one long string) so the checkID method breaks up the string into its seperate parts and then checks if the input matches. If it does match one of...
0
10550
Oralloy
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...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
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...
0
9125
agi2029
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...
1
7604
isladogs
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...
0
5501
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...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2972
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.