![]() |
parsing xml
I need to parse the contents of an xml file at runtime. Actually, I just need to parse the contents of a single line. The tag only exists once in the file, so I don't need to work down through nested nodes, just need to find the text in the file, preferably ignoring whitespace and newlines, as I can't be sure whether the newlines are form-feed only (as per xml spec) or windows' form-feed\newline combo and I don't know if there how many spaces, etc there are between things.
The line looks like this: <AppStart workingdir="param1" cmd="param2">param3</AppStart> or it might not have workingdir specified, so it might be: <AppStart cmd="param1">param2</AppStart> So I just need to get the parameters out of that line, regardless of where it is in the file. Any help? |
Basically, I'm looking for something similar to !searchparse except at runtime, i.e.
!searchparse '<AppStart ` UNPARSEDPARAM1 ` cmd="` PARAM2 `">` param3 `</AppStart>' StrCmp ${UNPARSEDPARAM1} "" +2 !searchparse ${UNPARSEDPARAM1} 'workingdir="` PARAM1 `"' just, replace !searchparse with a runtime alternative. I could figure out how to get just this line, probably with FileReadFromEnd, so I can treat the line as a string, I just need to parse it. |
Ok, so I've managed to get the line as a string and trim all whitespace and newline characters. So take the above line as a string stored as a variable, and I'm still looking for an easy alternative to !searchparse at runtime... I get the feeling it's going to somehow use WordFind, but I just don't understand the documentation for it :(
|
| All times are GMT. The time now is 17:27. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.