Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Problem creating XML from scratch with MSXML and VB 6 [Thread Next] Re: Problem creating XML from scratch with MSXML and VB 6To: NULL Date: 7/1/2005 6:48:00 AM Martin -
Worked perfectly.
Thanks a million for clearing that up.
"Martin Honnen" wrote:
>
>
> WHoit wrote:
>
> > I'm trying to create an xml file from scratch using MSXML and VB 6.
> > The result I'm after is this:
> > <myApp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:noNamespaceSchemaLocation="Schemas\mySchema.xsd">
> >
> > Using this code:
> > Set tmpXnode = xmlprs.createNode(NODE_ELEMENT, "myApp", "")
> > Set tmpAnode = xmlprs.createNode(NODE_ATTRIBUTE,
> > "xsi:noNamespaceSchemaLocation", "xsi")
> > tmpAnode.nodeTypedValue = "Schemas\mySchema.xsd"
> > tmpXnode.Attributes.setNamedItem tmpAnode
> >
> > I get this:
> > <myApp xmlns:xsi="xsi" xsi:noNamespaceSchemaLocation="Schemas\mySchema.xsd">
>
> Here is a VBScript example using the proper arguments to createNode:
>
> Dim XmlDocument, Element, Attribute
> Set XmlDocument = WScript.CreateObject("Msxml2.DOMDocument.4.0")
> Set Element = XmlDocument.createElement("myApp")
> Set Attribute = XmlDocument.createNode(2, "xmlns:xsi",
> "http://www.w3.org/2000/xmlns/")
> Attribute.nodeValue = "http://www.w3.org/2001/XMLSchema-instance"
> Element.setAttributeNode Attribute
> Set Attribute = XmlDocument.createNode(2,
> "xsi:noNamespaceSchemaLocation",
> "http://www.w3.org/2001/XMLSchema-instance")
> Attribute.nodeValue = "Schemas\mySchema.xsd"
> Element.setAttributeNode Attribute
> XmlDocument.appendChild Element
> WScript.Echo XmlDocument.xml
>
> Watch out for line breaks inserted by the news agent.
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
