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

WriteAttributeString

I'm trying to write out an XML file from VB and have it
mostly done, but I need the following header and can't
seem to get the right syntax for the WriteAttributeString
methods to get this result.

<fsaAtlasData xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
xsi:noNamespaceSchemaLocation="d:/fsaATLAS/XML/SASStudent.
xsd">

I tried the following but got the error shown below it.

.WriteStartElement("fsaAtlasData")
.WriteAttributeString
("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-
instance")
.WriteAttributeString
("xsi", "noNamespaceSchemaLocation", "d:/fsaATLAS/XML/SASS
tudent.xsd")
Unhandled Exception: System.ArgumentException:
The 'xmlns' attribute is bound to the reserved
namespace 'http://www.w3.org/2000/xmlns/'.
at System.Xml.XmlTextWriter.WriteStartAttribute(Strin g
prefix, String localName, String ns)
at System.Xml.XmlWriter.WriteAttributeString(String
localName, String ns, String value)
at fsaXML.fsaXML.Main(String[] args) in C:\My
Projects\fsaXML\fsaXML.vb:line 72

Nov 11 '05 #1
2 11647
Bill wrote:
I'm trying to write out an XML file from VB and have it
mostly done, but I need the following header and can't
seem to get the right syntax for the WriteAttributeString
methods to get this result.

<fsaAtlasData xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
xsi:noNamespaceSchemaLocation="d:/fsaATLAS/XML/SASStudent.
xsd">

I tried the following but got the error shown below it.

.WriteStartElement("fsaAtlasData")
.WriteAttributeString
("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-
instance") You are trying to bind "xmlns" prefix to "xsi" namespace URI, that's wrong and
after all forbidden, because "xmlns" is special reserved attribute name and
cannot be bound to any namespace URI other than "http://www.w3.org/2000/xmlns/".
.WriteAttributeString
("xsi", "noNamespaceSchemaLocation", "d:/fsaATLAS/XML/SASS
tudent.xsd")


C# code:

writer.WriteAttributeString("xmlns", "xsi", null,
"http://www.w3.org/2001/XMLSchema-instance");
writer.WriteAttributeString("xsi", "noNamespaceSchemaLocation",
"http://www.w3.org/2001/XMLSchema-instance",
"d:/fsaATLAS/XML/SASStudent.xsd");

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
Worked great, thanks much.
Nov 11 '05 #3

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

Similar topics

1
by: SenthilSS | last post by:
The WriteAttributeString() method(s) of System.Xml.XmlWriter Class is embedding the Value parameter within double quotes. Is it possible to change this behaviour such that the Value is instead put...
5
by: jk | last post by:
I'm having trouble converting a datatable into xml, with resonse.write to aspx. I'm basically converting vb code that saved a recordset into a stream into c#, but the format is wrong. I've tried...
1
by: petterl | last post by:
I try to write out some data to an xml file but it stopped with the message "An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional...
0
by: andreww | last post by:
Hi I'm fairly new to .net development, and am chucking myself right in at the deep end. I'm writing a web service to query a product called ArcIMS (ESRI), which chats a language called ArcXML. ...
7
by: Scott M. Lyon | last post by:
Quick (hopefully easy) question for you guys. What is going to be the quickest/easiest way to generate XML from VB.NET? Note: I don't mean an XML file, but XML in memory somehow (an...
3
by: dhurwitz | last post by:
I am trying to create an XML spreadsheet for use with Excel. I first saved a simple spreadsheet as an XML file, and now I am trying to recreate that file in code, using .NET 2.0. The beginning of...
3
by: moipoimonpon | last post by:
I have the following information continent | country | Placeof interest Asia | India |agra,mumbai,delhi asia |...
0
by: schlumpfger | last post by:
Hi, I´d like to create a XML Header like this: <?xml version="1.0" encoding="utf-8"?> <XDOMEA xmlns="http://www.xdomea.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
12
by: G.S. | last post by:
Is it acceptable to use { } blocks to improve readability and maintainability of the code? Example: //add the checkbox column DataGridViewCheckBoxColumn column = new...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.