473,511 Members | 12,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to inherit the child elements of base type

Hi guys,

Hope you can help me.I'm new in using C# and Xml Schema.
I have a problem in getting the child element of the base type..
Here is the sample of my xsd file:

<xs:complexType name="Magazine" abstract="true">
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="Editor" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="WomensMagazine">
<xs:complexContent>
<xs:extension base="Magazine">
<xs:sequence maxOccurs="unbounded">
<xs:element name="CosmeticsAdvert"
type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

I want that my output uld look like this:

struct WomensMagazine
{
string Title;
string Editor;
string CosmeticsAdvert;
};
Here is my code:
if (ct.ContentModel == null)
{
//Navigate to sequence particle of complex type without an
extension base
if (ct.Particle is XmlSchemaSequence)
{
//Get to sequence element and Walk through elements in
sequence tag
XmlSchemaSequence seq = (XmlSchemaSequence)ct.Particle;
foreach (XmlSchemaObject childElem in seq.Items)
{
idlContent += getStructField1(childElem, idlClass);
}
}
}
else
{
if (ct.ContentModel.Content is XmlSchemaComplexContentExtension)
{
XmlSchemaComplexContentExtension xscce =
ct.ContentModel.Content as
XmlSchemaComplexContentExtension;
//Navigate to a complex type with extension base
if (xscce.Particle is XmlSchemaSequence)
{
//Get to sequence element and Walk through elements in sequence tag
XmlSchemaSequence sequence= (XmlSchemaSequence)xscce.Particle;
foreach(XmlSchemaObject obj in sequence.Items)
{
idlContent += getStructField1(obj, idlClass); }
}
}
}

Mar 23 '07 #1
0 1137

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

Similar topics

6
2140
by: lawrence | last post by:
Is this a valid class definition? class McBase { // 06-14-04 - I may or may not later add something here. This will // be the top of the PDS content management system hierarchy. I'm //...
4
5739
by: Alfetta159 | last post by:
I've been setting up a schema with the XML Designer in VS .NET 2003. The designer lets me set up a lot of things including a complex type that contains an unnamed complex type called modified. ...
4
9762
by: james | last post by:
I have a custom UserControl, which can have many sub class levels derived from it. I want to be able to discover all the components at Load time, but the only components I can see from the base...
10
1514
by: Peter Oliphant | last post by:
Is there a way of defining a method in a base class such that derived classes will call their own version, EVEN if the derived instance is referred to by a pointer to the base class? Note that the...
7
1744
by: Frank | last post by:
Hi, a question probably asked before, but I can't find the answers. Base class X, classes A, B and C inherit class X. In class A I do not want to inherit property (or function or method) P1....
0
978
by: Zhi | last post by:
i have base form that contains a public imagelist. the image list has several images in it. my child forms inherit this base form and the imagelist. the inheritted imagelist contains all the images...
19
2411
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
5
4078
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like...
2
3870
by: GTalbot | last post by:
Hello fellow comp.infosystems.www.authoring.stylesheets colleagues, Imagine this situation: #grand-parent-abs-pos { height: 400px; position: absolute; width: 600px; }
0
7245
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
7144
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...
1
7085
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
5671
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,...
1
5069
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...
0
3227
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
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
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
449
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.