Hi all,
I am parsing an xml file (long story) and was wondering if there was a way to easily delete content between certain tags. For example, let's say I want to not display a "speed" column, I can do a replace statements such as:
strData = replace(strData, "<speed>", "") and strData = replace(strData, "</speed>", "")
but that leaves everything in the middle. Or I could replace them with <div style='visibility:hidden> tags (which is actually what I'm doing at the moment). But what I really want to do is get rid of them completely - since this string is over 2 million characters, I'd really like to trim it down some. I also tried looping through with a counter like:
For i=1 to iDataLength
iSpeed = InStr(i, strData, "<speed", 1)
strTempData = Mid(strData,iSpeed,43) '43 will almost always be the length of what I want pulled here, but this could be variable other places
strWeatherData = Replace(strData, strTempData, "")
i += 43
Next
But this is not only lethargic, it's often wrong. What would be best is if there was someway to specify a wildcard for the replace statement such as strData = replace(strData, "<speed>*</speed>", ""). If someone knows of a good way to do this, please do tell! Thanks!
I am parsing an xml file (long story) and was wondering if there was a way to easily delete content between certain tags. For example, let's say I want to not display a "speed" column, I can do a replace statements such as:
strData = replace(strData, "<speed>", "") and strData = replace(strData, "</speed>", "")
but that leaves everything in the middle. Or I could replace them with <div style='visibility:hidden> tags (which is actually what I'm doing at the moment). But what I really want to do is get rid of them completely - since this string is over 2 million characters, I'd really like to trim it down some. I also tried looping through with a counter like:
For i=1 to iDataLength
iSpeed = InStr(i, strData, "<speed", 1)
strTempData = Mid(strData,iSpeed,43) '43 will almost always be the length of what I want pulled here, but this could be variable other places
strWeatherData = Replace(strData, strTempData, "")
i += 43
Next
But this is not only lethargic, it's often wrong. What would be best is if there was someway to specify a wildcard for the replace statement such as strData = replace(strData, "<speed>*</speed>", ""). If someone knows of a good way to do this, please do tell! Thanks!