472,992 Members | 3,482 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

"Type Defintion Cannot be Abstract"

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 xmlns="http://www.w3.org/2001/XMLSchema" xmlns:this="this"
targetNamespace="this" elementFormDefault="qualified">

<complexType name="abstractAnswerType" abstract="true"/>

<complexType name="yesWithDescType">
<complexContent>
<extension base="this:abstractAnswerType">
<sequence>
<element name="description" type="string" />
</sequence>
<attribute name="answer" type="string" fixed="yes"
use="required"/>
</extension>
</complexContent>
</complexType>

<complexType name="noType">
<complexContent>
<extension base="this:abstractAnswerType">
<attribute name="answer" type="string" fixed="no"
use="required"/>
</extension>
</complexContent>
</complexType>

<element name="root">
<complexType>
<sequence>
<element name="question" type="this:abstractAnswerType" />
</sequence>
</complexType>
</element>

</schema>

When I generate a document using my IDE (oXygen), the following
instance document is created:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="this"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="this file:/C:/variableContent.xsd">
<question/>
</root>

Which is not valid as "Type Defintion Cannot be Abstract for element
question". I thought my IDE had just failed to perform the type
substition but when I manually create the following instance document:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="this"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="this file:/C:/variableContent.xsd">
<question answer="yes">
<description>Some text</description>
</question>
</root>

This too is not valid because "Attribute 'answer' is not allowed to
appear in element 'question'." and "Element 'question' must have no
character or element information item [children], because the type's
content type is empty.". So again it appears as if the validator is
failing to realise that "yesWithDescType" is a valid substitution for
"abstractAnswerType".

I should mention that I can get this to work when I use element
substitution instead of type substitution.

Any thoughts? I feel I am missing something obvious.

Cheers

Lord0

Feb 26 '07 #1
3 3412
On Feb 26, 12:24 pm, "Lord0" <l...@hotmail.co.ukwrote:
I am trying to implement variable content containers
using an abstract type and type substitution.
[...]
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="this"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="this file:/C:/variableContent.xsd">
<question answer="yes">
<description>Some text</description>
</question>
</root>

This too is not valid because "Attribute 'answer' is not
allowed to appear in element 'question'." and "Element
'question' must have no character or element information
item [children], because the type's content type is
empty.". So again it appears as if the validator is
failing to realise that "yesWithDescType" is a valid
substitution for "abstractAnswerType".
I believe XML Schema Part 0: Primer SE, 4.7 explains why
this doesn't work. There doesn't seem to be anything to
help you achieve what you want, though. (I doubt you would
want to use xsi:type, and there doesn't seem to be any
other way to make it work.)

--
Pavel Lepin

Feb 26 '07 #2
I believe XML Schema Part 0: Primer SE, 4.7 explains why this doesn't work

Thanks for the link - it was very useful.
. There doesn't seem to be anything to
help you achieve what you want, though. (I doubt you would
want to use xsi:type, and there doesn't seem to be any
other way to make it work.)

xsi:type does indeed allow it to work! But you're right - I wouldn't
want to use it.
Feb 26 '07 #3
Looking at the doc mentioned above there are examples such as

"<complexType name="US-Address" base="ipo:Address"
derivedBy="extension">"

However according to my parser "base" and "derivedBy" are not valid
attributes for element complexType.

Thoughts?

Feb 26 '07 #4

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

Similar topics

19
by: Roger | last post by:
How can I pass parameters to a style sheet? I have noticed a couple of sites are now passing variables to the style sheet, which appear to be substituted at run time. For example: <link...
0
by: Dave | last post by:
Hi everyone, (I already posted this to the VS.NET IDE news group without any responses, so I'm attempting one more time in this group) The issue I'm having is occuring in the IDE of VS.NET...
2
by: Bill Zhao | last post by:
Dear all, Sorry for i did not paste original propreity codes See below the fake codes for what I cannot understand. =============================================== lass A { public: virtual...
2
by: Ben Fidge | last post by:
I've got a couple of UserControls that are derived from a common base-class. When I try to open them in the IDE, the following error is displayed in a dialog window: "The file failed to load in...
2
by: PKuhne | last post by:
When pasting this code from the MS small Business Accounting Beta Concepts manual: DIM skdAssembly as = .LoadFrom(installpath.ToString()) the IDE shows : "Type 'Assembly' not defined" and...
0
by: Ken Varn | last post by:
I have the following code that I cannot get to compile. I get the error "A Sealed class cannot be abstract." public __value struct DVRAVIFileHeader : public ISerializable { double EventID;...
0
by: Jeff Louie | last post by:
Robert.. You can use interfaces or an abstract base class to abstract out the functionality of the plug ins. You then program to the abstraction. In the case of an interface, you program to the...
18
by: Stephan Beal | last post by:
Hi, all! Before i ask my question, i want to clarify that my question is not about the code i will show, but about what the C Standard says should happen. A week or so ago it occurred to me...
2
by: JonathanSFL | last post by:
BEGIN; DROP TYPE structure.format_list2table_rs CASCADE; CREATE TYPE structure.format_list2table_rs AS ( "item" VARCHAR(4000) ); END;
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.