473,667 Members | 2,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using IDREF and enumeration within Union

2 New Member
I'm trying to create a simple type that holds two different types. The first is IDREF and the second is an enumeration of string. When I generate a sample xml, I can enter any ID previously stated in the xml and validates correctly. When I try to use one of the enumeration in the drop down list, the xml will not validate.
When I validate the xml in xmlspy, i get the error message "IDREF 'endofprogam': referenced ID 'endofprogam' was not found."
Anyone knows a solution to having a union of enumeration and IDREF? I would appreciate any help.

<xs:simpleTyp e name="Persist_E num_Type">
<xs:annotatio n>
<xs:documentati on>Persist gives the UTR multiple options of lifetime</xs:documentatio n>
</xs:annotation>
<xs:union memberTypes="xs :IDREF">
<xs:simpleTyp e>
<xs:restricti on base="xs:string ">
<xs:annotatio n>
<xs:documentati on>
End of Program (EOP)
End of Children (EOC)
End of Lifetime (EOL)
Persist to Label (PTL)
</xs:documentatio n>
</xs:annotation>
<xs:enumerati on value="endofpro gram"/>
<xs:enumerati on value="endofchi ldren"/>
<xs:enumerati on value="endoflif etime"/>
<xs:enumerati on value="persistt olabel"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
May 18 '07 #1
1 2160
Dököll
2,364 Recognized Expert Top Contributor
I'm trying to create a simple type that holds two different types. The first is IDREF and the second is an enumeration of string. When I generate a sample xml, I can enter any ID previously stated in the xml and validates correctly. When I try to use one of the enumeration in the drop down list, the xml will not validate.
When I validate the xml in xmlspy, i get the error message "IDREF 'endofprogam': referenced ID 'endofprogam' was not found."
Anyone knows a solution to having a union of enumeration and IDREF? I would appreciate any help.

Expand|Select|Wrap|Line Numbers
  1. <xs:simpleType name="Persist_Enum_Type">
  2. <xs:annotation>
  3. <xs:documentation>Persist gives the UTR multiple options of lifetime</xs:documentation>
  4. </xs:annotation>
  5. <xs:union memberTypes="xs:IDREF">
  6. <xs:simpleType>
  7. <xs:restriction base="xs:string">
  8. <xs:annotation>
  9. <xs:documentation>
  10. End of Program (EOP)
  11. End of Children (EOC)
  12. End of Lifetime (EOL)
  13. Persist to Label (PTL)
  14. </xs:documentation>
  15. </xs:annotation>
  16. <xs:enumeration value="endofprogram"/>
  17. <xs:enumeration value="endofchildren"/>
  18. <xs:enumeration value="endoflifetime"/>
  19. <xs:enumeration value="persisttolabel"/>
  20. </xs:restriction>
  21. </xs:simpleType>
  22. </xs:union>
  23. </xs:simpleType>
  24.  
Hopefully you're still looking for this...

I sounds like MSXML.NET validates XML a bit better than XMLSpy. I am not sure how accurate this is, but I say give it a whirl. It was suggested that a good way to write it would be:

Expand|Select|Wrap|Line Numbers
  1. <union>
  2. <simpleType of enumeration>
  3. <simpleType of IDREF>
  4. </union>
  5.  
Hope this helps!
Jul 4 '07 #2

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

Similar topics

2
6923
by: Nicolas Bouillon | last post by:
Hi I am writing a schema and i want to have an element's attribute, which is an IDREF to an other type of element. For example <Type1 id="id1"/> <Type2 id="id2"/>
10
2655
by: Christopher Benson-Manica | last post by:
Why can't I use a class destructor in a using declaration: using MyClass::~MyClass; ? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
5
5414
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not create duplicate XML representations of the shared object, but instead use IDREFs to refer to the shared object. The XML I'm trying to produce is as follows (where "href" is an IDREF): <?xml version="1.0" encoding="utf-8"?> <MyRootClass...
27
2661
by: Ben Finney | last post by:
Antoon Pardon wrote: > I just downloaded your enum module for python > and played a bit with it. IMO some of the behaviour makes it less > usefull. Feedback is appreciated. I'm hoping to provide a "one obvious way" to do enumerations in Python. > >>> from enum import Enum > >>> day = Enum('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')
13
5011
by: Kantha | last post by:
Hi all, I have declared an Union as follows typedef union { struct interrupt_bits { unsigned char c_int_hs_fs_status : 1, c_setup_intflag : 1,
2
2022
by: jacquesh | last post by:
HI all I'm looking for different ways to using idref with more than one XML file ?? My case :: 2 xml files {labo.xml, contact.xml} I found a method which use an include via '<!ENTITY...' like
3
9922
by: Eric Lilja | last post by:
Sorry for asking so many questions, but I've just started and need to get some things working so I can do the task that is before me. Consider this (validating) schema: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="myns" xmlns="myns" elementFormDefault="qualified"> <xs:element name="books"> <xs:complexType> <xs:sequence>
0
1754
by: varun aggarwal | last post by:
Hi i am very new to XML ( just started yesterday). I am confused that how can IDREF will know which ID to refer to for example <!ELEMENT take1 (takeID1)> <!ELEMENT takeID1 EMPTY> <!ATTLIST takeID1 takeIDAttribute1 ID #REQUIRED> and
2
2015
by: Luigi | last post by:
Hello! I'm writing a schema where an element has got a reference to another element via IDREF. The problem is that I would restrict the possible references to the sole elements of a specific type, or, in other words, to those element with a specific tag name. For instance: <xs:element name="A"> <xs:complexType> <xs:attribute name="id" type="xs:ID"/>
0
8365
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,...
0
8883
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...
1
8563
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
8646
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
7390
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...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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.