473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to use abstract element in schema?

Leo
In my XML file, I have to elements: "person" and "organization", which
are exchangable. Since these two elements are nearly identical, I plan
to write an abstract element "agent" in my schema and let "person" and
"organization" inherit from "agent". However, my schema is invalid.
Can anyone please point out what my problem is. Thanks a million in
advance!

Leo

The following is my XML instance file:
<datacreator>
<organization>
<orgname>...</orgname>
<address>...</address>
<contact>...</address>
</organization>
</datacreator>
<publisher>
<person>
<personname>
<firstName>...</firstName>
<lastName>...</lastName>
</personname>
<address>...</address>
<contact>...</address>
</person>
</publisher>
The following is my schema:

<xs:element ref="MyNS:datacreator"/>
<xs:element ref="MyNS:publisher"/>

<xs:element name="datacreator">
<xs:complexType>
<xs:sequence>
<xs:element ref="MyNS:agent"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="publisher">
<xs:complexType>
<xs:sequence>
<xs:element ref="MyNS:agent"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="agent">
<xs:complexType>
<xs:sequence>
<xs:element ref="MyNS:address"/>
<xs:element ref="MyNS:contact"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="organization">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="MyNS:agent">
<xs:sequence>
<xs:element ref="MyNS:orgname"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>

<xs:element name="person">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="MyNS:agent">
<xs:sequence>
<xs:element ref="MyNS:personname"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
Jul 20 '05 #1
0 1322

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

Similar topics

4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
0
by: XSD-optimist | last post by:
I am trying to generate the classes for an XSD schema using the Microsoft XSD Object Code Generator (XSDObjGen). I am having a schema that contains the definition of the following: 1. a complex...
1
by: mflll | last post by:
How does one say in one schema that one wants an element defined in another schema. For example, I want to include in the Employee definition, an Address element defined in the schema...
0
by: Jiho Han | last post by:
I have an abstract class and a couple of derived classes. I didn't like the default schema exposed by wsdl, so I decided to implement XmlSchemaProvider. The schema is exposed properly for the...
0
by: Jiho Han | last post by:
I have a web method that accepts an abstract class. The abstract class includes an XmlIncludeAttribute that specifies derived classes. Wsdl gets generated fine that includes both schema for the...
0
by: shreya | last post by:
Hi, I am new to wsdl.I am using weblogic server to generate a wsdl. I am writting my own inner abstract classes using schemas and then generating a wsdl file.In my schema I have a value as...
3
by: Lord0 | last post by:
I am trying to implement variable content containers using an abstract type and type substitution. My schema is as follows: <?xml version="1.0" encoding="UTF-8"?> <schema...
0
by: Jason Cavett | last post by:
I'm attempting to create a schema where I have an abstract model from which all other nodes "extend" the model (so I don't need to retype the same information repeatedly). Something like this... ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.