SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Apr 2004
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Read XML Attribues using tag name

    Hi,

    I am working with an XML file. The objective is the test few tags and their values in the XML file. I have the list of tag name and their values in a datafile. Is there any xml property with which i can directly read the attributes of the tag by just using the tag name without really worrying about the parent or how many levels after it is a grand child?

  2. #2
    Member
    Join Date
    Aug 2005
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Read XML Attribues using tag name

    This might work for you:

    Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
    xmlDoc.load("C:\yourXMLFile.xml")
    Set getTag = xmlDoc.getElementsByTagName("yourTagNameHere")
    valueOfTag = getTag.context.Text

  3. #3
    Junior Member
    Join Date
    Apr 2004
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Read XML Attribues using tag name

    Sorry this did not work. Irrespective of what I give the tag name the valueOfTag has the same value. When I tried to debug its just displaying all the values my XML has. As suppose to getting me the value of just one TAG that I want. Can you please let me know if there is something wrong that I am doing. My code is

    Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
    xmlDoc.load("c:\aaa\311_1-1-116170624.xml")
    Set getTag = xmlDoc.getElementsByTagName("timestamp")
    valueOfTag = getTag.context.Text
    print valueOfTag

    The print result is: DOITT_DPR_push_12008-09-05 15:46:542008-09-0515:46:541-1-116170624INSERTINSERTN00Department of Parks and RecreationDPRNNTesting DPR IntegrationDamaged TreeDamaged TreeY59Y10006700011079043MANHATTAN2120000000ANONYM OUSesrmst@doitt.nyc.gov00ANONYMOUSADDRESSYANONYMOU SNY12563001010MAIDEN LANEBROADWAYBranch Cracked and Will FallBranch Cracked and Will FallYHanging from Other BranchesForestry - Manhattan OfficeNDPR ForestryDPR FORESTRYgINTERSECTIONYN/A13MANHATTANNEW YORKMANHATTAN District 101010E017700N/AMANHATTAN District 2NY98148119787810007N0015257NAdditional Location DetailsParkParkMAIDEN LANENManhattan SouthPrecinct 1N/A******Business TypeNThe Department of Parks and Recreation usually requires 8 days to inspect this issue and may take up to 45 days to resolve it, if warranted. Please note your Service Request number for future reference.NYN10/20/2008 15:38:59Days1-1-11617062409/05/2008 15:38:59Draft1-1-01X5XTS1-1-01X5XTSNNNNST102

  4. #4
    Senior Member
    Join Date
    Aug 2007
    Posts
    134
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Read XML Attribues using tag name

    Could you attach your xml file?

  5. #5
    Junior Member
    Join Date
    Apr 2004
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Read XML Attribues using tag name

    Never mind I got the solution. For anybody who needs this here is the code:

    Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
    xmlDoc.load("c:\test.xml")
    Set objNodeList = xmlDoc.getElementsByTagName("PutYourTagHere")

    For i = 0 To (objNodeList.length - 1)
    set str = objNodeList.Item(i)
    print str.text
    Next


    Thanks a lot for your help. Atleast I got the start from here.

  6. #6
    Junior Member
    Join Date
    Aug 2007
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Read XML Attribues using tag name

    Hi,
    I am trying to work on XML Or.
    My initial task is to get name of all node names/Attributes.
    I am not able to get name of node. Can anybody can please help in getting node name.
    I am attaching xml file for refrence.
    - <qtpRep:ObjectRepository xmlns:qtpRep="http://www.mercury.com/qtp/ObjectRepository">
    - <qtpRep:Objects>
    - <qtpRep:Object Class="Browser" Name="[thelist] [ASP] Excel">
    + <qtpRep:Properties>
    - <qtpRep:Property Name="title" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">[thelist] [ASP] Excel COM object reference</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="openurl" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">about:blank</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="opentitle" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    - <qtpRep:Property Name="openedbytestingtool" Hidden="1" ReadOnly="1" Type="BOOL">
    <qtpRep:Value RegularExpression="0">0</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="number of tabs" Hidden="1" ReadOnly="1" Type="NUMBER">
    <qtpRep:Value RegularExpression="0">0</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="name" Hidden="0" ReadOnly="0" Type="STRING">
    <qtpRep:Value RegularExpression="0">[thelist] [ASP] Excel COM object reference</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="micclass" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">Browser</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="hastoolbar" Hidden="1" ReadOnly="1" Type="BOOL">
    <qtpRep:Value RegularExpression="0">-1</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="hasstatusbar" Hidden="1" ReadOnly="1" Type="BOOL">
    <qtpRep:Value RegularExpression="0">-1</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="hasmenubar" Hidden="1" ReadOnly="1" Type="BOOL">
    <qtpRep:Value RegularExpression="0">-1</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="creationtime" Hidden="0" ReadOnly="0" Type="NUMBER">
    <qtpRep:Value RegularExpression="0">0</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="browserindex" Hidden="1" ReadOnly="1" Type="I2">
    <qtpRep:Value RegularExpression="0">1</qtpRep:Value>
    </qtpRep:Property>
    </qtpRep:Properties>
    - <qtpRep:BasicIdentification>
    <qtpRep:PropertyRef>name</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>micclass</qtpRep:PropertyRef>
    </qtpRep:BasicIdentification>
    + <qtpRep:SmartIdentification Algorithm="Mercury.TolerantPriority" Active="1">
    - <qtpRep:BaseFilter>
    <qtpRep:PropertyRef>micclass</qtpRep:PropertyRef>
    </qtpRep:BaseFilter>
    - <qtpRep:OptionalFilter>
    <qtpRep:PropertyRef>name</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>title</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>openurl</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>opentitle</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>hasstatusbar</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>hasmenubar</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>hastoolbar</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>openedbytestingtool&l t;/qtpRep:PropertyRef>
    <qtpRep:PropertyRef>number of tabs</qtpRep:PropertyRef>
    </qtpRep:OptionalFilter>
    </qtpRep:SmartIdentification>
    + <qtpRep:Comments>
    <qtpRep:Comment Name="miccommentproperty" />
    </qtpRep:Comments>
    <qtpRep:LastUpdateTime>Friday, March 20, 2009 12:19:08</qtpRep:LastUpdateTime>
    - <qtpRep:ChildObjects>
    - <qtpRep:Object Class="Page" Name="[thelist] [ASP] Excel">
    + <qtpRep:Properties>
    - <qtpRep:Property Name="user-input in post data" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    - <qtpRep:Property Name="user input in get data" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    - <qtpRep:Property Name="url without form data" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">http://lists.evolt.org/archive/Week-...pRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="url" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">http://lists.evolt.org/archive/Week-...pRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="title" Hidden="0" ReadOnly="0" Type="STRING">
    <qtpRep:Value RegularExpression="0">[thelist] [ASP] Excel COM object reference</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="non user-input in post data" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    - <qtpRep:Property Name="non user-input in get data" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    - <qtpRep:Property Name="micclass" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">Page</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="index" Hidden="1" ReadOnly="1" Type="NUMBER">
    <qtpRep:Value RegularExpression="0">10004</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="form data" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    - <qtpRep:Property Name="document size" Hidden="1" ReadOnly="1" Type="NUMBER">
    <qtpRep:Value RegularExpression="0">6579</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="all data in get method" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    </qtpRep:Properties>
    + <qtpRep:BasicIdentification>
    <qtpRep:PropertyRef>title</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>micclass</qtpRep:PropertyRef>
    </qtpRep:BasicIdentification>
    + <qtpRep:SmartIdentification Algorithm="Mercury.TolerantPriority" Active="1">
    - <qtpRep:BaseFilter>
    <qtpRep:PropertyRef>micclass</qtpRep:PropertyRef>
    </qtpRep:BaseFilter>
    - <qtpRep:OptionalFilter>
    <qtpRep:PropertyRef>title</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>url</qtpRep:PropertyRef>
    </qtpRep:OptionalFilter>
    </qtpRep:SmartIdentification>
    - <qtpRep:Comments>
    <qtpRep:Comment Name="miccommentproperty" />
    </qtpRep:Comments>
    <qtpRep:LastUpdateTime>Friday, March 20, 2009 12:19:14</qtpRep:LastUpdateTime>
    - <qtpRep:ChildObjects>
    + <qtpRep:Object Class="Link" Name="thelist at lists.evolt.org">
    - <qtpRep:Properties>
    - <qtpRep:Property Name="micclass" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">Link</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="visible" Hidden="1" ReadOnly="1" Type="BOOL">
    <qtpRep:Value RegularExpression="0">-1</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="text" Hidden="0" ReadOnly="0" Type="STRING">
    <qtpRep:Value RegularExpression="0">thelist at lists.evolt.org</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="name" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">thelist at lists.evolt.org</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="index" Hidden="0" ReadOnly="0" Type="NUMBER">
    <qtpRep:Value RegularExpression="0">0</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="html tag" Hidden="0" ReadOnly="0" Type="STRING">
    <qtpRep:Value RegularExpression="0">A</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="html id" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    - <qtpRep:Property Name="href" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0">mailto:thelist%20at%20lis ts.evolt.org</qtpRep:Value>
    </qtpRep:Property>
    - <qtpRep:Property Name="class" Hidden="1" ReadOnly="1" Type="STRING">
    <qtpRep:Value RegularExpression="0" />
    </qtpRep:Property>
    </qtpRep:Properties>
    - <qtpRep:BasicIdentification>
    <qtpRep:PropertyRef>micclass</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>text</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>html tag</qtpRep:PropertyRef>
    </qtpRep:BasicIdentification>
    - <qtpRep:SmartIdentification Algorithm="Mercury.TolerantPriority" Active="1">
    - <qtpRep:BaseFilter>
    <qtpRep:PropertyRef>micclass</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>html tag</qtpRep:PropertyRef>
    </qtpRep:BaseFilter>
    - <qtpRep:OptionalFilter>
    <qtpRep:PropertyRef>text</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>html id</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>class</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>name</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>href</qtpRep:PropertyRef>
    <qtpRep:PropertyRef>visible</qtpRep:PropertyRef>
    </qtpRep:OptionalFilter>
    </qtpRep:SmartIdentification>
    - <qtpRep:Comments>
    <qtpRep:Comment Name="miccommentproperty" />
    </qtpRep:Comments>
    <qtpRep:LastUpdateTime>Friday, March 20, 2009 12:19:21</qtpRep:LastUpdateTime>
    <qtpRep:ChildObjects />
    </qtpRep:Object>
    </qtpRep:ChildObjects>
    </qtpRep:Object>
    </qtpRep:ChildObjects>
    </qtpRep:Object>
    </qtpRep:Objects>
    <qtpRep:Parameters />
    <qtpRep:Metadata />
    </qtpRep:ObjectRepository>
    Attached Files Attached Files

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.68%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:29 AM.

Copyright BetaSoft Inc.