Hi,
If I define my schema as
<xs:choice>
<xs:sequence>
<xs:element ref="el_1" />
<xs:element ref="el_2" />
</xs:sequence>
<xs:sequence>
<xs:element ref="el_3" />
<xs:element ref="el_4" />
<xs:element ref="el_5" />
</xs:sequence>
<xs:choice>
and compile it with .Net 2003 xsd.exe, then I receive only one
[ ... choice element attributes ..]
public string Item;
// with the choice type one of the following:
public enum ItemChoiceType
{ el_1, el_2, el_3, el_4, el_5 }
So instead of choosing between two sequences, XmlSerialiser chooses between
the first two elements in those sequences, and the rest is just ignored!!!
I NEED the rest as well.
Can anyone please point me in the right direction on how to read the rest of
the sequences?
Thanks in advance,
Sergey 2 4349
The .NET framework 2.0 behavior is better: It flattens the choice, but it
still allows you to create and read valid instances:
public partial class test {
/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "e1")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e2")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e3")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e4")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e5")]
[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("Items ElementName")]
public string[] Items;
/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "ItemsElementNa me")]
[System.Xml.Seri alization.XmlIg noreAttribute()]
public ItemsChoiceType[] ItemsElementNam e; }
"Sergey Poberezovskiy" <Se************ *****@discussio ns.microsoft.co m> wrote
in message news:D7******** *************** ***********@mic rosoft.com... Hi,
If I define my schema as
<xs:choice> <xs:sequence> <xs:element ref="el_1" /> <xs:element ref="el_2" /> </xs:sequence> <xs:sequence> <xs:element ref="el_3" /> <xs:element ref="el_4" /> <xs:element ref="el_5" /> </xs:sequence> <xs:choice>
and compile it with .Net 2003 xsd.exe, then I receive only one
[ ... choice element attributes ..] public string Item; // with the choice type one of the following: public enum ItemChoiceType { el_1, el_2, el_3, el_4, el_5 }
So instead of choosing between two sequences, XmlSerialiser chooses
between the first two elements in those sequences, and the rest is just ignored!!!
I NEED the rest as well.
Can anyone please point me in the right direction on how to read the rest
of the sequences?
Thanks in advance,
Sergey
Zafar,
Unfortunately I have to live with 1.1 - but changing
public string Item;
to
public string[] Items;
worked!!! - the only thing is that I will have to manually modify the
generated file every time I need to change my schema - a small price to pay.
Thanks again.
Sergey
"Zafar Abbas" wrote: The .NET framework 2.0 behavior is better: It flattens the choice, but it still allows you to create and read valid instances:
public partial class test {
/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "e1")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e2")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e3")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e4")]
[System.Xml.Seri alization.XmlEl ementAttribute( "e5")]
[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("Items ElementName")]
public string[] Items;
/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "ItemsElementNa me")]
[System.Xml.Seri alization.XmlIg noreAttribute()]
public ItemsChoiceType[] ItemsElementNam e; } "Sergey Poberezovskiy" <Se************ *****@discussio ns.microsoft.co m> wrote in message news:D7******** *************** ***********@mic rosoft.com... Hi,
If I define my schema as
<xs:choice> <xs:sequence> <xs:element ref="el_1" /> <xs:element ref="el_2" /> </xs:sequence> <xs:sequence> <xs:element ref="el_3" /> <xs:element ref="el_4" /> <xs:element ref="el_5" /> </xs:sequence> <xs:choice>
and compile it with .Net 2003 xsd.exe, then I receive only one
[ ... choice element attributes ..] public string Item; // with the choice type one of the following: public enum ItemChoiceType { el_1, el_2, el_3, el_4, el_5 }
So instead of choosing between two sequences, XmlSerialiser chooses between the first two elements in those sequences, and the rest is just ignored!!!
I NEED the rest as well.
Can anyone please point me in the right direction on how to read the rest of the sequences?
Thanks in advance,
Sergey This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dgaucher |
last post by:
Hi,
I want to consume a Web Service that returns a choice, but my C++ client
always receives the same returned type. On the other hand, when I am using a
Java client, it is working fine (of course, the generated proxy is not the
same).
When I am looking at the C++ generated code, it seems fine, but when I am
executing the code, I always get the first choice type.
|
by: Sergey Poberezovskiy |
last post by:
Hi,
As part of my schema I need to ensure that at least one of two fields have
values. I defined my schema as follows:
....
<xs:choice>
<xs:element ref="el1"/>
<xs:element ref="el2"/>
<xs:sequence>
<xs:element ref="el1"/>
|
by: pawel.pabich |
last post by:
Hajo,
I know only one way of forcing element to have one or more childes:
<xs:element name="saleOrSupplyMethod"> <BR/>
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:element name="generalSale" type="emptyTagType" />
<xs:element name="prescription" type="emptyTagType"/>
|
by: rbarschaw |
last post by:
I have the following schema designed:
<xs:complexType name="AzzFeature-BoxType" mixed="true">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element ref="Sub-Head" minOccurs="1" maxOccurs="unbounded"/>
<xs:element ref="Title-Text" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Text" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Link-List" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
<xs:attribute...
|
by: SL33PY |
last post by:
Hi,
I'm currently busy writing an xsd at one point in time i whish that my xml must look like:
<object>
<loc>
<disk>
<drive>c</drive>
<path>temp\path</path>
<files>*.*</files>
</disk>
| |
by: Sjaakie |
last post by:
Hi all,
I used the xsd-util to turn the following XML-file into an .xsd and a class.
<?xml version="1.0" encoding="utf-8" ?>
<Settings>
<ApplicationTitle>...</ApplicationTitle>
<DebugEmail>...</DebugEmail>
<Proxy>
<Enabled>...</Enabled>
|
by: cmay |
last post by:
I am beginning to wonder if it is not possible to get this working.
I am trying to do:
<root>
<a/>
<b/>
<c/>
</root>
|
by: puffy |
last post by:
Hi, Everyone!
I'd need a little help. I understand this is not valid, but is there
an (easy) way to make it valid?
<xs:complexType name="control_Type">
<xs:sequence>
<xs:element name="id" type="id_Type"/>
<xs:element name="position" type="pos_Type"/>
<xs:element name="name" type="xs:string"/>
|
by: Peter Larsen |
last post by:
Is this really a valid schema design?
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="e1" minOccurs="0" />
|
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: 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,...
|
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: 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?
| |