473,673 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

circular references in schemas

I have created an xml format for describing a custom user interface. My
application successfully parses and displays the UI described in xml files
created in that format.

Before today we were using Visual Studio .net 2002. I created a schema file
to describe my xml so that I could use the fancy xml editing capabilities in
the Visual Studio enviroment. With this schema referenced, I could
auto-complete while scripting xml for my user interface while editing in
DevStudio. A pretty neat feature, even though it wasn't really necessary.

Today we upgraded to Visual Studio .net 2003. One of the changes seems to be
that schema files are compiled instead of interpreted directly. The compiler
gives the following error on compile: "DataSet doesn't allow the circular
reference in the ComplexType named 'Window'". So no more fancy editing. :(

This isn't a Microsoft-specific problem, I get a similar error if I try to
use an application I downloaded via w3.org to validate xml using my schema.

My script allows you to create windows with child windows, which can also
have children. A pretty standard windowing system, I think. But it doesn't
seem legal xml to make a window element a child of a window element. I'm not
really familiar with all the logic and theory behind xml, I just thought it
was a convenient way to script our UI. I would like to understand why these
"circular references" are not allowed in the schema, and what alternatives a
proper xml guru might suggest for my situation.

Below is a simple schema that has this problem

<schema targetNamespace ="test.xsd" elementFormDefa ult="qualified"
xmlns=http://www.w3.org/2001/XMLSchema xmlns:ui="test. xsd">
<element name="test">
<complexType>
<sequence>
<element name="window" type="ui:Window " />
</sequence>
</complexType>
</element>
<complexType name="Window">
<sequence>
<element name="children" >
<complexType>
<sequence>
<element name="childWind ow"
type="ui:Window " />
</sequence>
</complexType>
</element>
<element name="testStrin g" type="string" />
</sequence>
</complexType>
</schema>


Jul 20 '05 #1
3 5643
"Christine McGavran" <cm*******@perp etualent.com> writes:
Today we upgraded to Visual Studio .net 2003. One of the
changes seems to be that schema files are compiled instead
of interpreted directly. The compiler gives the following
error on compile: "DataSet doesn't allow the circular
reference in the ComplexType named 'Window'". So no more
fancy editing. :(
Is that the entirety of the error message?
This isn't a Microsoft-specific problem, I get a similar
error if I try to use an application I downloaded via w3.org
to validate xml using my schema.
More details, please? Do you mean XSV? If so, what exactly is the
error code XSV is giving you? I don't get any schema error from XSV
on the sample schema you provided (although I do get errors on any
document I provide, for reasons which will become clear below).
My script allows you to create windows with child windows,
which can also have children. A pretty standard windowing system,
I think. But it doesn't seem legal xml to make a window element a
child of a window element.
Ouch! No! Don't think that!

There is nothing in XML or in XML Schema that makes such
recursion illegal. (And to be fair, note that the error message
you quote from Visual Studio doesn't actually say it's illegal
XML, or a schema error. It says there is something there that
Visual Studio doesn't support.)
I'm not really familiar with all the logic and theory behind xml,
I just thought it was a convenient way to script our UI. I would
like to understand why these "circular references" are not allowed
in the schema, and what alternatives a proper xml guru might suggest
for my situation.

Below is a simple schema that has this problem
I'll take you at your word, though I suspect you did not
paste this in direct from a schema document that got the
same error message you give above. (I suspect it because
the xmlns attribute is missing its required quotation marks,
and you should have gotten a well-formedness error long
before anyone started worrying about circularity.)
<schema targetNamespace ="test.xsd"
elementFormDefa ult="qualified"
xmlns=http://www.w3.org/2001/XMLSchema
er, "http://www.w3.org/2001/XMLSchema"
xmlns:ui="test. xsd">
<element name="test">
<complexType>
<sequence>
<element name="window" type="ui:Window " />
</sequence>
</complexType>
</element>
<complexType name="Window">
<sequence>
<element name="children" >
<complexType>
<sequence>
<element name="childWind ow"
type="ui:Window " />
</sequence>
</complexType>
</element>
<element name="testStrin g" type="string" />
</sequence>
</complexType>
</schema>


If Visual Studio is complaining about the same problem
I see with this schema, I have to say I'm moderately
impressed with its acuity.

Both XSV and Xerces J believe, as I do, that the schema
document you give is valid, once the xmlns attribute gets
its quotation marks. The only problem with it is that
there are no finite documents which conform to it.
The problem is not the recursion per se, it's the fact
that there is no bottom to it, just as in the following
instructions there is no way to reach step 5.

0 Start. Go to step 1.

1 You have a top-level element named 'test', which has
a required child named 'window'. Go to step 2.

2 The 'window' element, being of type ui:Window, has
required children named 'children' and 'testString'.
Go to step 3.

3 The 'children' element has exactly one required child
named 'childWindow'. Go to step 4.

4 The 'childWindow' element, being of type ui:Window, has
required children named 'children' and 'testString'.
Go to step 3.

5 Done.

If I change the schema so that the childWindow element is
optional, then I can create a finite document which conforms
to the schema. In practice, I suspect you also want to
specify that a window can have more than one childWindow
among its children. One way to do this is to change the
declaration for 'childWindow' thus:

<element name="childWind ow"
minOccurs="0"
maxOccurs="unbo unded"
type="ui:Window " />

There are other ways, of course.

Is this the problem with your real schema, or is the
absence of the minOccurs and maxOccurs an artifact of
the way you cut down the problem for presentation in
your post?

You asked what alternatives others might suggest. My
first suggestion is to correct the occurrence information.
My second would be to change the name of the child
window to 'window', to make the recursion even more
obvious, unless there is a strong reason to distinguish
top-level windows from others (in which case, I'd
probably use the names 'topWindow' and 'window'
rather than 'window' and 'childWindow' -- but naming
is a matter of taste, and you should suit yourself and
your collaborators, not me).

I hope this helps,

-C. M. Sperberg-McQueen
World Wide Web Consortium
Jul 20 '05 #2
> Is that the entirety of the error message?

yes
Do you mean XSV?
I'm not really sure what Microsoft uses, but I don't think it's XSV. The
tool is called "XML Data Proxy Generator."
I don't get any schema error from XSV
on the sample schema you provided
There is nothing in XML or in XML Schema that makes such
recursion illegal. Then maybe it's a Microsoft issue after all.. I've also posted to the
Microsoft group.
I'll take you at your word, though I suspect you did not
paste this in direct from a schema document that got the
same error message you give above. (I suspect it because
the xmlns attribute is missing its required quotation marks,
You know I did paste it directly, but the document I pasted from has the
quotation marks. Beats me why they got left out... probably some Outlook
thing. :P
If I change the schema so that the childWindow element is
optional, then I can create a finite document which conforms
to the schema. In practice, I suspect you also want to
specify that a window can have more than one childWindow
among its children. One way to do this is to change the
declaration for 'childWindow' thus:

<element name="childWind ow"
minOccurs="0"
maxOccurs="unbo unded"
type="ui:Window " /> Doing this doesn't change my results at all.
Is this the problem with your real schema, or is the
absence of the minOccurs and maxOccurs an artifact of
the way you cut down the problem for presentation in
your post?
I knew about the minOccurs/maxOccurs thing, but Microsoft seemed to ignore
them, at least in the old version of DevStudio, so I had left them out of my
test.
My second would be to change the name of the child
window to 'window', to make the recursion even more
obvious
My actual schema (not the test) does this, actually. I was just trying to be
clear for the test.
I hope this helps,


Wish it did. I do thank you for letting me know I'm not trying to do
something entirely weird.
Jul 20 '05 #3
Just to follow-up, I got the response below from the Microsoft group.

I did finally manage to get the smart editor to work on my test schema
without the compile step, so I guess the compile step isn't needed after all
for the editing feature (which is all I really cared about). My real schema
doesn't work yet, so I guess I just rebuild it step-by-step until I figure
out what it doesn't like, when I get some time.

--

that is a drawback of the Data View in vs.net, it would never lend
itself well to this type of implementation.

"The Visual Studio .NET XML Designer applies the Microsoft ADO.NET
schema inference rules to determine the schema information for the
source XML when it tries to generate Data view. The ADO.NET schema
inference rules in the RTM release of the Microsoft .NET Framework do
not permit a single table to be a child table in more than one
DataRelation. "


Jul 20 '05 #4

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

Similar topics

16
2829
by: Kiuhnm | last post by:
Is there an elegant way to deal with semi-circular definitions? Semi-circular definition: A { B }; B { *A }; Circular reference: A { *B }; B { *A }; The problems arise when there are more semi-circular definitions and
2
7975
by: Earth Worm Jim | last post by:
I have been able to get simple circular references to be serialized in xml by using the ImportTypeMapping method on the SoapReflectionImporter class. But I am unable to serialise circular references when the circular reference is contained with in a collection class, specifically I am using a custom ArrayList object. I keep getting a StackOverFlow Exception from the XmlSerializer class when attempting the serialisation. The classes...
12
7054
by: Frank Rizzo | last post by:
I have a circular reference between 2 classes in the same project (i.e. each class refers to the other). The app runs fine and I am seeing no issues, which kind of surprised me. Are there any issues that I am not seeing (performance wise or garbage collection wise) with circular references? Thanks.
5
6847
by: Gos | last post by:
Hi, It is known that .NET does not allow us to add circular references. Is there a way to workaround this problem by late-binding the objects at run time? Will this create any other problems? One solution to the problem is to re-architect the solution. But, I dont want to do this as there are many modules in the project which are already developed and nearing the release.
6
5069
by: Stephen Robertson | last post by:
We are currently in a dead end with a circular reference issue using vb.net, and are hoping someone might help us resolve it. Idea... We have frmmain calling frmperson (dim f as new frmperson) in search (no record) mode. When the search is executed, frmperson calls frmsearchresult (dim f as new frmsearchresult) which is a listing of persons. From frmsearchresults, frmperson is called (dim f as new frmperson) with the resulting...
2
2816
by: Lapu-Lapu | last post by:
I have authored a web service using ASP 2.0. The web services return objects that use generics and that also contain circular references. Programmatically, everything works well, as long as you use the web service proxy client generated by visual studio. However, the default test harness provided by the .asmx file errors out because it seems to use XmlSerialization and cannot handle circular references. I understand that the...
5
3798
by: Madhur | last post by:
Hello If I define two classes in the same cs file. And in each class, I define the object of other class as a member. Can anyone explain me how .NET or its compiler will resolve this kind of reference since one class would not be compiled unless other is compiled. This is kind of a deadlock. Isnt it ?
3
2915
by: =?Utf-8?B?UGF1bCBIYWxl?= | last post by:
Moving all User Controls to a single directory has solved my problem - Thanks Eliyahu. That said, I still got one Circular ref error yesterday, rebuilt again and the build was fine? Far far better than the amount of errors I was originally getting on builds before I consilidated by UC's though :-) "Paul Hale" wrote:
2
1854
by: Dansk | last post by:
Hi all, I am currently writing some code that explores assemblies dependencies. I start loading the first assembly with Assmebly.LoadFrom which gives me an Assembly instance. Then, I enumerate the AssemblyNames from the GetReferencedAssemblies() collection.
0
8953
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, 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...
0
8854
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8652
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,...
0
8704
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 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...
0
7484
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, 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...
1
6264
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 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...
0
5727
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();...
0
4253
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...
3
1851
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.