From: Kenneth A. Larsen on 28 Jul 2010 18:19 "Don" <Don(a)discussions.microsoft.com> wrote in message news:E90B7DE2-F09D-4219-A774-0BE20DCF5A96(a)microsoft.com... > Right now I just want to be able to read (Echo out) the Value of "VALUE" > in > an XML element node, and eventually modify it. > > This will be run with the Windows Scripting Host from a Windows command > line. > > Here is the line of XML I want to read from: > > <IP_ADDRESS VALUE = "0.0.0.0"/> > > Here is the code I have right now. All I can get out of it now is tell me > the name of the Node and the fact that Type of node is an element. I want > it > to show me "0.0.0.0" > > The code I have now. > > <job id="SetIlofile"> > <script language="VBScript"> > '----- Open file ------------------------------------- > Set objXmlDoc = CreateObject("Microsoft.XMLDOM") > objXmlDoc.async = False > objXmlDoc.load("ilo.xml") > If Not objXmlDoc.load("ilo.xml") Then > WScript.Echo "Document failed to load." > WScript.Quit > End If > '------------------------------------------------- > Set colNodes = > objXmlDoc.selectNodes("/RIBCL/LOGIN/RIB_INFO/MOD_NETWORK_SETTINGS/IP_ADDRESS") > '---------------------------------------------------------------------------------- > For Each objNode in colNodes > WScript.Echo objNode.nodeName, objNode.nodeTypeString > Next > </script> > </job> > > And my test XML file: > > <!-- HPONCFG VERSION = "3.0.0.0" --> > <!-- Generated 06/17/10 15:03:06 --> > <RIBCL VERSION="2.1"> > <LOGIN USER_LOGIN="Administrator" PASSWORD="password"> > <DIR_INFO MODE="write"> > <MOD_DIR_CONFIG> > <DIR_AUTHENTICATION_ENABLED VALUE = "N"/> > <DIR_LOCAL_USER_ACCT VALUE = "Y"/> > </MOD_DIR_CONFIG> > </DIR_INFO> > <RIB_INFO MODE="write"> > <MOD_NETWORK_SETTINGS> > <SPEED_AUTOSELECT VALUE = "Y"/> > <NIC_SPEED VALUE = "10"/> > <IP_ADDRESS VALUE = "0.0.0.0"/> > </MOD_NETWORK_SETTINGS> > </RIB_INFO> > <USER_INFO MODE="write"> > </USER_INFO> > </LOGIN> > </RIBCL> > Now I'm currius. Did you type those files in MS-DOS Prompt?
|
Pages: 1 Prev: VBScript and Script Host Next: Retreaving a Page from a Master Web Site |