473,499 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSD.exe and nested attribute group

I need to group some attribute for use in different types, but if I
nest an attributegroup inside another one I miss the nested attribute
in class generated with xsd.exe.
For example if I use the following two schemas xsd.exe give me the same
class.

First Schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://example.org/"
targetNamespace="http://example.org/" elementFormDefault="qualified">

<xsd:attributeGroup name="Gruppo1">
<xsd:attribute name="attributo1" type="xsd:int" use="required"/>
<xsd:attribute name="attributo2" type="xsd:string"
use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="Gruppo2">
<xsd:attribute name="attributo3" type="xsd:int" use="required"/>
<xsd:attribute name="attributo4" type="xsd:string"
use="required"/>
</xsd:attributeGroup>

<xsd:complexType name="key">
<xsd:sequence>
<xsd:element name="key" type="xsd:string"/>
</xsd:sequence>
<xsd:attributeGroup ref="Gruppo1" />
</xsd:complexType>

<xsd:element name="key" type="key"/>
</xsd:schema>

Second Schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://example.org/"
targetNamespace="http://example.org/" elementFormDefault="qualified">

<xsd:attributeGroup name="Gruppo1">
<xsd:attributeGroup ref="Gruppo2" />
<xsd:attribute name="attributo1" type="xsd:int" use="required"/>
<xsd:attribute name="attributo2" type="xsd:string"
use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="Gruppo2">
<xsd:attribute name="attributo3" type="xsd:int" use="required"/>
<xsd:attribute name="attributo4" type="xsd:string"
use="required"/>
</xsd:attributeGroup>

<xsd:complexType name="key">
<xsd:sequence>
<xsd:element name="key" type="xsd:string"/>
</xsd:sequence>
<xsd:attributeGroup ref="Gruppo1" />
</xsd:complexType>

<xsd:element name="key" type="key"/>
</xsd:schema>

xsd.exe generate the same class:

//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.2032
//
// Changes to this file may cause incorrect behavior and will be
lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

//
// This source code was auto-generated by xsd, Version=1.1.4322.2032.
//
using System.Xml.Serialization;
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://example.org/")]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="http://example.org/",
IsNullable=false)]
public class key {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("key" )]
public string key1;

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public int attributo1;

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string attributo2;
}
I would like to have some both the attributes of both attributes group
in the same class.

Where is my error?

Thank you

Nov 12 '05 #1
0 1724

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4516
by: Paul Morrow | last post by:
I'm hoping that someone can explain why I get the following exception. When I execute the code... ###################################### class Parent(object): class Foo(object): baz = 'hello...
9
2148
by: OKB (not okblacke) | last post by:
For a variety of reasons, I'm interested in putting together some code that will allow me to created structures out of nested classes, something like: class class1: def methA(self): print...
12
3952
by: Jeff Lanfield | last post by:
First of all, I apologize if coalescing is not the right term to describe my problem. I have a tree where each node has the same set of attributes (is the same entity) but child nodes should...
8
1774
by: Ike | last post by:
I am hoping someone can help me with the proper syntax for this. I have an attribute, called, say "name," such that: <set name="something">thename</set> However, the value for name, is...
1
8307
by: Stanimir Stamenkov | last post by:
Here's an example: <form action="bogus" method="post"> <p> <a href="prev.cgi"><input type="submit" name="prev" value="< Back"></a> <a href="next.cgi"><input type="submit" name="next"...
4
4409
by: Vedanta Barooah | last post by:
greetings.... in a python nested class is it possible to change the value of the parent class's variable without actually creating an instance of the parent class, consider this code: class...
0
1413
by: Chris Birmele | last post by:
I am having difficulties maintaining table relationships when writing XML files, despite having set the relations property NESTED to TRUE. I assume therefore that something is wrong with my code. ...
37
2732
by: Tim N. van der Leeuw | last post by:
Hi, The following might be documented somewhere, but it hit me unexpectedly and I couldn't exactly find this in the manual either. Problem is, that I cannot use augmented assignment operators...
0
2775
by: jts2077 | last post by:
I am trying to create a large nested XML object using E4X methods. The problem is the, the XML I am trying to create can only have xmlns set at the top 2 element levels. Such as: <store ...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
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...
0
7180
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,...
1
6905
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...
0
7395
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...
0
5485
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,...
0
3108
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...
0
1429
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 ...
0
311
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...

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.