Results 1 to 2 of 2

Thread: getElementsByTagName????

  1. #1
    Join Date
    Dec 1969

    Default getElementsByTagName????

    when i use this <BR><BR><BR>Set objLst = xmlDoc.getElementsByTagName("img")<BR>numNodes = objLst.Length<BR><BR><BR>it counts all nodes with image and returns 11<BR><BR>but i want to count all nodes with image withing the current parent node.<BR><BR>tried this but it dosent work.<BR><BR>Set objLst = xmlDoc.getElementsByTagName("img").item(1)<BR>numN odes = objLst.Length<BR><BR>this is what im doing so far<BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;%<BR>xmlfile = Request.QueryString("xml")<BR> Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument")<BR> xmlDoc.async = false<BR> xmlDoc.validateOnParse = false<BR> &#039;xmlDoc.setProperty "SelectionLanguage", "XPath"<BR> xmlDoc.setProperty "ServerHTTPRequest", true<BR> xmlDoc.load ""&xmlfile&""<BR> iCount = xmlDoc.documentElement.childNodes.length<BR> &#039;Response.Write iCount<BR><BR>%&#062;<BR>&#060;% <BR>node = iCount<BR>minusnode = node -1<BR>For count = 0 To minusnode <BR>response.write count &"<BR><BR>" <BR>firsttest = xmlDoc.documentElement.childNodes(count).text<BR>r esponse.write firsttest&"<BR><BR>"<BR><BR>nodename = xmlDoc.documentElement.childNodes(count).nodename< BR>response.write "Status ="&nodename&"<BR>"<BR><BR>status1 = xmlDoc.selectSingleNode("propertyList/"&nodename&"["&count&"]/@status").text<BR>response.write "status ="&status1&"<BR>"<BR><BR>agentID = xmlDoc.selectSingleNode("propertyList/residential["&count&"]/agentID").text<BR>response.write "Agent id ="&agentID&"<BR>"<BR><BR>Set objLst = xmlDoc.getElementsByTagName("img").item(1)<BR>numN odes = objLst.Length<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: getElementsByTagName????

    Well, which node are you wanting to search?!<BR><BR>Do you want:<BR>Set objLst = xmlDoc.documentElement.childNodes(count).getElemen tsByTagName("img")<BR>?<BR>Or:<BR>Set objLst = xmlDoc.selectSingleNode("propertyList/residential[" & count & "]/agendID").getElementsByTagName("img")<BR><BR>You can use the getElementsByTagName() method on any valid XML element, I believe. You just need to figure out which one you want to search through.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts