473,513 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(XmlSchema->targetNamespace) error while writing xsd

Hello,

I am trying to write an xsd file using .NET System.Xml.Sxhema Class Library.

(1) I get an error while writitng if the XSD has a taregetnamespace.
(II) for any xsd with no targetnamespace the program works fine.

I want to create an xsd with the following namespaces

<xsd:schema targetNamespace"http://www.homedepot.com/HD"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:hd="http://www.homedepot.com/HD">

Following is the code

XmlSchema* schema = new XmlSchema();
XmlNamespaceManager* nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
nsmgr->AddNamespace("hd", "http://www.homedepot.com/HD");
schema->TaregetNamspace = "http://www.homedepot.com/HD";
System::IO::FileStream* fs = new FileStream("XSDWrite.xsd",
FileMode::OpenOrCreate);
schema->Write(fs, nsmgr); ///UNKNOWN EXCEPTION WHILE writing

(111) Is there a limitation that the targetnamespace cannot be in the
namespace manager???
I am unable to find out the problem here

Thanks,
Maansi




Nov 17 '05 #1
1 1328
Maansi,

must be something else in your code. I just tried it out (fixing the syntax
errors) and it worked just fine, no exception.

--
Tomas Restrepo
to****@mvps.org
http://www.winterdom.com/
"Maansi Sanghi" <ma**********@abosoftware.com> wrote in message
news:O2**************@tk2msftngp13.phx.gbl...
Hello,

I am trying to write an xsd file using .NET System.Xml.Sxhema Class
Library.

(1) I get an error while writitng if the XSD has a taregetnamespace.
(II) for any xsd with no targetnamespace the program works fine.

I want to create an xsd with the following namespaces

<xsd:schema targetNamespace"http://www.homedepot.com/HD"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:hd="http://www.homedepot.com/HD">

Following is the code

XmlSchema* schema = new XmlSchema();
XmlNamespaceManager* nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
nsmgr->AddNamespace("hd", "http://www.homedepot.com/HD");
schema->TaregetNamspace = "http://www.homedepot.com/HD";
System::IO::FileStream* fs = new FileStream("XSDWrite.xsd",
FileMode::OpenOrCreate);
schema->Write(fs, nsmgr); ///UNKNOWN EXCEPTION WHILE writing

(111) Is there a limitation that the targetnamespace cannot be in the
namespace manager???
I am unable to find out the problem here

Thanks,
Maansi



Nov 17 '05 #2

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

Similar topics

1
6047
by: Heinz | last post by:
Hello, I have a project that is used by other project in my solution. This common project is also used by a VB6 application (so it is placed in GAC). Since I did this (this is what I...
0
6103
by: JC | last post by:
I am using Mysql version: 4.0.18-max-log and trying to populate a database from a text file using source option from inside the mysql environment. The population run OK but when creating the...
2
1877
by: Rick | last post by:
Has anybody run across the following error when creating a new J# project? "Error writing the project file. Error loading type library/DLL." I think the same problem also causes the...
2
329
by: Paul P | last post by:
I am having a problem writing errors to the application log on a Windows 2003 server running IIS 6 The error message is "InvalidOperationException: Cannot open log for source {0}." I have created...
0
1690
by: piyushc | last post by:
Hi, I am having problem creating new project using VS.Net 2003. Whenever I am trying to create new project (any type) it shows error message "Error writing the project file. Error loading...
5
1643
by: djharrison | last post by:
Greetings, I am developing an application that writes values from an Access 2000 database to an SQL 7.0 server using DAO and linked tables. It seems to work fine for the first 26 of 108 tables,...
3
7006
by: Jennifer | last post by:
On an ASP page I've got some code that is supposed to "export" data in a grid to an Excel file. What I'm doing is writing all the data to a text file, separating the fields by commas. Then I'll...
0
1691
by: amit | last post by:
I am getting following error when I click ok. I have got this error while writting images in windows application.I am using visual studio 2005 I tried to get the exact error by putting my...
9
10983
by: Jerry C | last post by:
I am trying to write to the errorlog and I am getting the error Cannot open log for source 'Application'. You may not have write access. This is the code: Dim Logevent As New...
1
2239
by: =?Utf-8?B?SGFycmlzb24gU2Nob2ZpbGw=?= | last post by:
I've got a developer who is running into problems getting a web app to write to a SQL database. I am posting his error message. Any ideas? Server Error in '/CTRS Web' Application....
0
7260
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,...
0
7537
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...
1
7099
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
5685
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
4746
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...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
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...

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.