Parsing a weather feed in XML, and have questions on two situations. My best guess is that it involve lookaheads, but although I've read some tutorials, I can't seem to come up with the answers.
First, a section like this:where a complete <warnings>...</warnings> section may exist, or it may be empty as shown above. The desired behaviour is to have the <warnings> section always captured, even if it is an empty string, in order that the number of captures does not vary.
The second situation is similar, but not identical:where the <precipitation> section may exist, or it may be entirely absent, but again, there should still be a capture, even if empty, so that the number of captures remains the same.
Any help or examples appreciated.
First, a section like this:
Code:
<previoussection . . .> . . .</previoussection><warnings/><nextsection . . .> . . .</next section>
The second situation is similar, but not identical:
Code:
<winds . . .> . . .</winds><precipitation . . .> . . .</precipitation><uv . . .> . . .</uv . . .>
Any help or examples appreciated.
Statistics: Posted by qwerky — Today, 8:43 pm — Replies 2 — Views 31