473,402 Members | 2,046 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,402 software developers and data experts.

Howto: Adding includes to XsdSchema in dotnet?

Hello,

I am writing a program that generates automatically XSD schema's, based on
the definitions in our database. Everything works fine, except for one
thing.
The files contain a header, a body and a footer. As the header and footer
is the same for every document, I want to include them in my document
schema. When executing the included code, I get this exception:
System.InvalidCastException: Specified cast is not valid.
at System.Xml.Schema.XmlSchema.LoadExternals(XmlSchem aCollection
schemaCollection, XmlNameTable nameTable, SchemaNames schemaNames,
ValidationEventHandler validationEventHandler, XmlSchema schema, Hashtable
loadedSchemas)
at System.Xml.Schema.XmlSchema.Compile(XmlSchemaColle ction collection,
XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler
validationEventHandler, String targetNamespace, SchemaInfo schemaInfo,
Boolean compileContentModel, XmlResolver resolver)
at System.Xml.Schema.XmlSchema.Compile(ValidationEven tHandler
validationEventHandler)
This is my code.

Dim schema As New XmlSchema
schema.Version = "1.0"
schema.TargetNamespace = UMSNAMESPACE
schema.Namespaces = XsdHelper.GetSchemaNamespaces()

schema.Includes.Add(XmlSchema.Read(New IO.FileStream(headerFileName,
IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.ReadWrite), AddressOf
validation))
schema.Includes.Add(XmlSchema.Read(New IO.FileStream(bodyFileName,
IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.ReadWrite), AddressOf
validation))
schema.Includes.Add(XmlSchema.Read(New IO.FileStream(footerFileName,
IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.ReadWrite), AddressOf
validation))
schema.Items.Add(XsdHelper.getSchemaAppInfo("env_" + title.Text))
schema.Items.Add(XsdHelper.getSchemaDocumentation( "env_" + title.Text))
schema.Compile(AddressOf validation)
kind regards,
Sam Vanhoutte
Nov 12 '05 #1
0 1008

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

Similar topics

3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
2
by: dan | last post by:
hi ng. i have a asp.net application which is client of an asp.net webservice. now i want to configure a custom error page (in case the sewrvice throws an exception) that provides the...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
1
by: Geraldine Hobley | last post by:
Hello, I'm having a problem adding a manifest to a vb project in order to add visual styles to my vb.net application. I followed the steps outlined her...
5
by: Topper | last post by:
Hello! How to create WebService without IIS and ASP.NET? For example, create WebService for smart device client without ASP.NET/IIS techology. Without ASP.NET and IIS - is a key question!! ...
8
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do...
4
by: shonend | last post by:
I am trying to extract the pattern like this : "SUB: some text LOT: one-word" Described, "SUB" and "LOT" are key words; I want those words, everything in between and one word following the...
5
by: Josef Brunner | last post by:
Hi, I have an application that enables the user to switch between (so far) 2 different languages. Now I need to display a datetimepicker. How can I switch / control the language the...
7
by: Peted | last post by:
Hi, im hoping someone cane provide or point to a definitive accurate explantion of dotnet compilation when run and the best way to optimise peformace when dotnet code is run first time and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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
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,...
0
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...

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.