473,772 Members | 3,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading multiple schemas doesn't clear XmlSchema.Schem aTypes.Values

Has anyone else run into this? The problem is that I'm loading one
schema at a time, to be displayed in a TreeView. Each node in the
tree points to an item in the schema via the Tag property. When
I load the second schema, the collection of SchemaTypes.Val ues
still contains the first schema's types.

This doesn't happen when I write schemas to the console.

I'm explicitly clearing the Tag property on each node in the
tree before I load a new schema, as well as clearing the schema
variable. But either there's a reference hanging around, or
a bug.

These pertinent code bits show all the interactions between
the treeview and the schema. I'm running this with .Net 1.0.
public void FillTree(string filePath, TreeView loadingTree) {
ValidationEvent Handler veh =
new ValidationEvent Handler(throwSc hemaError);
XmlTextReader xtr = null;
myXmlSchema = null;
try {
xtr = new XmlTextReader(f ilePath);
myXmlSchema = XmlSchema.Read( xtr, veh);
myXmlSchema.Com pile(veh);
WalkSchema(load ingTree);
} catch (Exception e) {
// ...;
} finally {
if (xtr != null) {
xtr.Close();
}
}
}

private TreeNode CreateElementTr eeNode(XmlSchem aElement et) {
TreeNode thisElementNode =
new TreeNode(et.Qua lifiedName.ToSt ring(), 0, 0);
thisElementNode .Tag = new TreeNodeElement Tag(et);
return thisElementNode ;
}
public class TreeNodeElement Tag : IDisposable {
private XmlSchemaElemen t et;
public TreeNodeElement Tag(XmlSchemaEl ement et_) {
et = et_;
}
public void Dispose() {
et = null;
}
public XmlSchemaElemen t ElementNode {
get {
return et;
}
}
}

// On the client side

private void BreakSchemaRefs (TreeNode tn) {
TreeNodeElement Tag tneTag = (TreeNodeElemen tTag) tn.Tag;
if (tneTag != null) {
tneTag.Dispose( );
tn.Tag = null;
}
if (tn.Nodes.Count > 0) {
foreach (TreeNode childNode in tn.Nodes) {
BreakSchemaRefs (childNode);
}
tn.Nodes.Clear( );
}
}
private void LoadSchema(stri ng filePath, TreeView loadingTree) {
SchemaWalker mySchemaWalker = new SchemaWalker();
if (loadingTree.No des.Count > 0) {
foreach (TreeNode childNode in loadingTree.Nod es) {
BreakSchemaRefs (childNode);
}
loadingTree.Nod es.Clear();
}
mySchemaWalker. FillTree(filePa th, loadingTree);
}
Nov 11 '05 #1
0 1544

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

Similar topics

4
1693
by: anonymous | last post by:
When I use the schema collection to apply many schemas to one XML instance document, I get an error if I do not qualify every element with the appropriate namespace. Both the W3C site and this article (http://www.xfront.com/ZeroOneOrManyNamespaces.html) imply that I can submit an XML instance without having to qualify each element. How do I accomplish this while still using .Net & the
2
2193
by: Che | last post by:
Greetings, I am writing an application that uses an extendible XML file. in order to validate that XML I use a main XSD and in additional - few more extensions XSD's that uses the types in the main XSD as base types. my clients can define their own XSD's extensions and use my generic application to process their XML's. The problem:
0
1577
by: Deep Purple | last post by:
I started with the following error... ------------------------------------------------------- An error occured while loading the schema with TargetNamespace 'http://www.w3.org/2001/XMLSchema' referenced in this document. The value for the 'base' attribute is invalid - 'xsd:string' is an invalid value for the 'base' attribute. An error occured at the file:///C:Program Files/Microsoft Visual Studio .NET 2003...
3
6510
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service07162002.asp) but I don't want clients to have to add two web references and then manually have to edit the proxy classes. After doing some searching I found that putting references to multiple web services in a .disco...
5
5402
by: Jeff | last post by:
We are using .Net and the wsdl Utility to generate proxies to consume web services built using the BEA toolset. The data architects on the BEA side create XML schemas with various entities in separate files for ease of maintainability. These schemas are all part of the same namespace. When defining a web service that access more than one of these entities, the wsdl file generated by BEA contains multiple schema elements with the same...
3
11695
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works BEFORE: strCurrency = oSOAP.eServeSearch(CSTR(Request.Form("T1"))) until the WSDL file changed to have more <element name> T1 is just a field that accepts a STRING
1
2757
by: v4u2chat | last post by:
Do I need to extend any of classes from AXIS to return multiple values? I'm exposing the following method as web service through AXIS to return multiple values. public ContactAddress testService() { ContactAddress cAddr = new ContactAddress(); cAddr.setAddresses1("AAAAAAAAAAAAA"); cAddr.setAddresses2("BBBBBBBBBBBBB"); cAddr.setAddresses3("CCCCCCCCCCCCC");
0
2682
by: tanish2k | last post by:
hi. I am using c#, visual studio 2003. I need to validate a xml file against schema which itself has 2 more schema imported under it. i have following 2 xsd files : xsd1 ---> ------------------- <?xml version="1.0" encoding="UTF-8"?> <xs:schema
0
2251
by: vigneshrao | last post by:
Hi, I have been working on a script that loops through multiple records and sends data (one record per call) to a WS. I am supposed to make a new call for each record before sending the data. The problem I have is the first record gets processed fine where as the second record always; reason being the EAI expects it to be a seperate call Though I am creating/reseting a new service everytime within the foreach loop the data seems to be...
0
9620
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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
9912
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
8934
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
7460
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
5354
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...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2850
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.