I'm new so forgive this question please.
I'm creating a new XML document using the MSXML Dom object.
Code:
Set xmldoc = New MSXML2.DOMDocument40
xmldoc.async = False
xmldoc.validateOnParse = False
xmldoc.resolveExternals = False
xmldoc.preserveWhiteSpace = True
Set ProcInstr = xmldoc.createProcessingInstruction("xml", "version='1.0'")
xmldoc.appendChild ProcInstr
Set ProcInstr = Nothing
'Create the root element with 3 attributes
Set rootElement = xmldoc.createElement("marketlive")
Set xmldoc.documentElement = rootElement
Set rootatt = xmldoc.createAttribute("xmlns")
rootatt.Text = "rootElement.Attributes.setNamedItem rootatt
Set rootatt1 = xmldoc.createAttribute("xmlns:xsi")
rootatt1.Text = "rootElement.Attributes.setNamedItem rootatt1
Set rootatt2 = xmldoc.createAttribute("xsi:schemaLocation")
rootatt2.Text = " \\fileserver1\company\MSOFFI~1\access\478HOL~1\MarketLive_schema\MarketLive.xsd"
rootElement.Attributes.setNamedItem rootatt2
Set aElement = xmldoc.createElement("import")
Set aElement2 = xmldoc.createElement("import")
rootElement.appendChild aElement
my problem is when the file is created the "import" tag has an attribute called xmlns="" so when I validate the file against the schema it fails.
I know it has something to do with namesspace but I'm very new and still trying to get a handle on it.
Output:
<?xml version="1.0" ?>
- <marketlive xmlns=" xmlns:xsi=" xsi:schemaLocation=" \\fileserver1\company\MSOFFI~1\access\478HOL~1\MarketLive_schema\MarketLive.xsd">
- <import xmlns="">
I would really appreciate any help anyone can give.
Thanks,
Sara
I'm creating a new XML document using the MSXML Dom object.
Code:
Set xmldoc = New MSXML2.DOMDocument40
xmldoc.async = False
xmldoc.validateOnParse = False
xmldoc.resolveExternals = False
xmldoc.preserveWhiteSpace = True
Set ProcInstr = xmldoc.createProcessingInstruction("xml", "version='1.0'")
xmldoc.appendChild ProcInstr
Set ProcInstr = Nothing
'Create the root element with 3 attributes
Set rootElement = xmldoc.createElement("marketlive")
Set xmldoc.documentElement = rootElement
Set rootatt = xmldoc.createAttribute("xmlns")
rootatt.Text = "rootElement.Attributes.setNamedItem rootatt
Set rootatt1 = xmldoc.createAttribute("xmlns:xsi")
rootatt1.Text = "rootElement.Attributes.setNamedItem rootatt1
Set rootatt2 = xmldoc.createAttribute("xsi:schemaLocation")
rootatt2.Text = " \\fileserver1\company\MSOFFI~1\access\478HOL~1\MarketLive_schema\MarketLive.xsd"
rootElement.Attributes.setNamedItem rootatt2
Set aElement = xmldoc.createElement("import")
Set aElement2 = xmldoc.createElement("import")
rootElement.appendChild aElement
my problem is when the file is created the "import" tag has an attribute called xmlns="" so when I validate the file against the schema it fails.
I know it has something to do with namesspace but I'm very new and still trying to get a handle on it.
Output:
<?xml version="1.0" ?>
- <marketlive xmlns=" xmlns:xsi=" xsi:schemaLocation=" \\fileserver1\company\MSOFFI~1\access\478HOL~1\MarketLive_schema\MarketLive.xsd">
- <import xmlns="">
I would really appreciate any help anyone can give.
Thanks,
Sara