|
-
Aug 19th, 2005, 09:26 AM
#1
Thread Starter
Lively Member
Including XML Schema reference when XML file is created
Hello All,
I am just getting into vb.net and XML, a daunting task.
I am creating an XML file from a recordset, but need to include references to XML schemas at the very beginning of the XML file.......how do I do that.
I used the following as a test, but need to include the references to the schemas somehow.
VB Code:
mywriter = New System.Xml.XmlTextWriter(Server.MapPath("myfoo666.xml"), System.Text.Encoding.UTF8)
With mywriter
'NEED SOMETHING IN HERE TO REFERENCE THE SCHEMA(.XSD) FILES...?????.....
.WriteStartElement("MyBooks")
.WriteStartElement("Book")
.WriteAttributeString("ISBN", "1861005652")
.WriteAttributeString("Title", "How to make XML Work")
.WriteElementString("Author", "A. N. Other")
.WriteEndElement() 'For Book
.WriteEndElement()
End With
mywriter.Flush()
mywriter.Close()
Please, has anyone any ideas, I am struggling a bit.
Many Thanks,
Al...
-
Aug 23rd, 2005, 09:44 AM
#2
Fanatic Member
Re: Including XML Schema reference when XML file is created
You need 2 attributes as shown below:
Code:
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd">
<node />
<node />
<node />
</root>
-
Aug 23rd, 2005, 09:47 AM
#3
Thread Starter
Lively Member
Re: Including XML Schema reference when XML file is created
Thanks Shunt,
But I need to know how, or even if, you can create this dynamically at the top of the document, as I stated in my original post.
I was thinking that maybe I could call a class, give it the physical path to my XSD file, and it would write it out at the top of my XML document, before I called the first WriteStartElement command.
Any ideas.....?????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|