I am creating an xmldatadocument from an acess database with visual basic.
Here is the header code I am using:
Dim xmldcl As XmlDeclaration = myDoc.CreateXmlDeclaration("1.0", "UTF-8",
"yes")
Dim newElem As XmlElement = myDoc.CreateElement("sender")
newElem.SetAttribute("schemaVersion", "1.0")
newElem.SetAttribute("xmlns", "http://www.somewhere.org")
newElem.SetAttribute("xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance")
newElem.SetAttribute("xsi:schemaLocation", "http://www.somewhere.org
filename.xsd")
newElem.SetAttribute("name", "NewFile")
myDoc.AppendChild(newElem)
myDoc.InsertBefore(xmldcl, newElem)
The xml file created leaves off the :xsi prefix from the schema location.
The document then fails validation.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sender schemaVersion="1.0" xmlns="http://www.somewhere.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://www.somewhere.org filename.xsd" name="Filename">
So close - but not right... what am I doing wrong?
Sincerely,
Jean