Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

VB Script Parsing XML Attributes

bhaskarvphanibhaskarvphani Posts: 3Member
HI,

I am trying to develop a script which can parse all nodes/elements and its attributes of an XML.

I am able to read all nodes/elements but not attributes of it like


Can you please help me to going in parse all elements/attributes of XML given below

My XML:
------


<?xml version="1.0"?>





Nature
474
7353
20110630


5445441
0028-0836
1476-4687
2011Nature Publishing Group, a division of Macmillan Publishers Limited. All Rights Reserved.

10.1038/474544c

Biology Algal synchronized swimming

Suspensions of swimming algal cells form intricate mottled patterns that are governed by a complex interplay between light, gravity and fluid dynamics. The patterns (pictured) change with shifting lighting conditions, which could one day be exploited to improve the yields of bioreactors that use algae to produce biofuel.

Rosie Williams and Martin Alan Bees of the University of Glasgow, UK, studied the patterns formed by suspensions of Chlamydomonas augustae cells in response to changes in the orientation and intensity of the light source. As overhead white light grew brighter, dense groups of cells first moved apart, then drew closer together. When the algae were lit from below, brighter light resulted in a shortening and then a levelling off of distances between dense cell groups.

Such pattern changes could be exploited to increase the penetration of light and nutrients to cell suspensions, and to concentrate cells for harvesting.

J. Exp. Biol. 24, 2398–2408 (2011) 10.1242/jeb.051094



M. A. BEES

My VB script Code:
------------------

Dim goFS
Set goFS = CreateObject( "Scripting.FileSystemObject" )
Dim sDir
sDir = "C:work"
Dim oXDoc
Set oXDoc = CreateObject( "Msxml2.DOMDocument" )
oXDoc.async = False
Dim oFile
For Each oFile In goFS.GetFolder( sDir ).Files
WScript.Echo "looking at", oFile.Name
WScript.Echo "will load", oFile.Path
If oXDoc.load( oFile.Path ) Then
WScript.Echo "successfully loaded", oFile.Name
End If
Next
Set ndlEventId = oXDoc.documentElement.selectNodes("//*")
for i = 0 to ndlEventId.length-1
WScript.Echo ndlEventId(i).nodeName & " :: " &ndlEventId(i).text
If ndlEventId(i).text="" Then
s=ndlEventId(i).nodeName
WScript.Echo s
Set attrvalue=oXDoc.getAttribute(s)
WScript.Echo attrvalue
End if
Next


Thanks in advance
Bhaskar



Sign In or Register to comment.