I've bloody done it!

You wouldn't believe that I couldn't find a single example on the web
that does even remotely does what I need, it's all .."almost that" but
"not quite" and the other "almost that" that does the "not quite"
doesn't work with the first "almost that"!?
The answer is always...roll up the sleves and dig into the poo! 

I mean..what's all this XML stuff anyway...just bloody nested property
lists...and why complicating peoples' lifes by inventing
multidimensional arrays and other big words when we can make them even
more complicated...

Hey I have an idea...lets make everything as a big text file and put
everything in <> and call that nested tags and then make loads of tools
that can write that and more parsers that can read that
and..and..and...my assssss!

Huh...hehehe...pfffffff....anyway, if anyone needs a basic VB Script
code that "simply" steps through an XML doc or http post and gets the
names and values so you can do something with them ...here it is, it
goes only 2 levels through the nests...bloody 8 hours on Saturday for
these few lines...sob

-----------------------------------------------------
<[EMAIL PROTECTED]"VBSCRIPT" CODEPAGE="1252"%>
<% 
set docReceived = Server.CreateObject("MSXML2.DOMDocument")
docReceived.async = False 
docReceived.load Request 'this bit is only when the XML data was posted
to this script

pString = ""
Set baseList = docReceived.documentElement

 pCount1 = baseList.childNodes.length-1
 
  For y = 0 To pCount1 
   pCount2 = baseList.childNodes.item(y).childNodes.length 
   set objAttributes = baseList.childNodes.item(y).attributes
  
  'this bit just grabs any "attributes", whatever they can be...

   for each attr in objAttributes 
    pString = pString & attr.name & "=" & attr.value & "<br>"
   next
   
   for x = 0 to pCount2 -1
        pName = baseList.childNodes.item(y).childNodes.item(x).nodeName 
        pVal = baseList.childNodes.item(y).childNodes.item(x).text
        pString = pString & nodeType & " " & pName & "=" & pVal & "<br>"
   next
 next
  response.write pString
%> 
------------------------------------------------------

Thats'it from me today, off to the boozer...

Pedja

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to