Parse XML tag With Space in ASP Classic

amenadiel

New Member
I understand this is not according to standard, however a partner is passing XML to our app that contains spaces in the tags, like so:\[code\]<RESPONSE> <XYZZYS> <XYZZY TAG="INFO">123abc</FIELD> <XYZZY TAG="MOAR_INFO">123456abcdef</FIELD> <XYZZY TAG="EVEN_MOAR_INFO">1</FIELD>\[/code\]Normally I would load the XML into an object via getElementsByTagName("*") and get the tag names with item(index).nodeName. The problem is that since spaces aren't supposed to be there, item(index).nodeName ends up being simply XYZZY. This is of course a problem since each of them began with XYZZY.
  • For kicks I tried to replace() the "XYZZY " in item(index).nodeName, but predictably this spawned a 500 error.
  • ResponseXML.preserveWhiteSpace doesn't help.
  • I've thought about manipulating the XML as a string to do the replace, but am not sure if I can load it back into an MSXML object... and it seems a little needlessly-complicated...
  • ...as does simple text-string parsing.
Is there a simple solution I've been unable to find? Links to resources are very much appreciated!
 
Back
Top