is possible create a XML document in VBS?

Re: How to create a XML Document by Roland

Roland
Tue Mar 15 05:52:12 CST 2005

"Tarllem" wrote in message news:eH%236V5UKFHA.2996@TK2MSFTNGP10.phx.gbl...
: is possible create a XML document in VBS?

'with', yes. In? Perhaps if you're referring to an XML Data Island.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp




Re: How to create a XML Document by Tarllem

Tarllem
Tue Mar 15 06:53:22 CST 2005

Excuse me my sintax, I'm referring 'with' ;)

"Roland Hall" <nobody@nowhere> escribió en el mensaje
news:e9yEuVVKFHA.3652@TK2MSFTNGP10.phx.gbl...
> "Tarllem" wrote in message news:eH%236V5UKFHA.2996@TK2MSFTNGP10.phx.gbl...
> : is possible create a XML document in VBS?
>
> 'with', yes. In? Perhaps if you're referring to an XML Data Island.
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -
> http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>
>



Re: How to create a XML Document by Nic

Nic
Tue Mar 15 07:40:40 CST 2005

> is possible create a XML document in VBS?

The document itself, persisted as a textfile, is just text conforming to the
XML validation rules of the parser that will process it.

Therefore you can do simple string building, or use an XML parser to create
the document.

If using MSXML, do a search on Load, LoadXML, selectSingleNode,
CreateAttribute & CreateElement to get you started.

Nic Roche

"Tarllem" <no@no.no> wrote in message
news:eH%236V5UKFHA.2996@TK2MSFTNGP10.phx.gbl...
> is possible create a XML document in VBS?
>



Re: How to create a XML Document by ljb

ljb
Tue Mar 15 09:07:01 CST 2005


"Tarllem" <no@no.no> wrote in message
news:eH%236V5UKFHA.2996@TK2MSFTNGP10.phx.gbl...
> is possible create a XML document in VBS?
>
>

Try this
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xmconworkingwithxmldocumentparts_attributes.asp

My variation of the above works fine.

Set xmlDoc = CreateObject("Msxml2.DOMDocument")

xmlDoc.appendChild(xmlDoc.createProcessingInstruction("xml",
"version=""1.0"""))

Set rootElement=xmlDoc.createElement("memo")
xmlDoc.appendChild(rootElement)

rootElement.setAttribute "author","Pat Coleman"

Set theElement=xmlDoc.createElement("to")
Set theElementText=xmlDoc.createTextNode("Carole Poland")
rootElement.appendChild(theElement)
theElement.appendChild(theElementText)

Set theElement=xmlDoc.createElement("subject")
Set theElementText=xmlDoc.createTextNode("big layoff coming")
rootElement.appendChild(theElement)
theElement.appendChild(theElementText)

'Dim docFragment As IXMLDOMDocumentFragment
Set docFragment = xmlDoc.createDocumentFragment()
docFragment.appendChild xmlDoc.createElement("node1")
docFragment.appendChild xmlDoc.createtextnode("node1 value")

docFragment.appendChild xmlDoc.createElement("node2")
docFragment.appendChild xmlDoc.createElement("node3")
MsgBox docFragment.xml
xmlDoc.documentElement.appendChild docFragment
MsgBox xmlDoc.xml


xmldoc.save "test1.xml"