I think that one can not claim to be a REBOL programmer unless one can use "parse."
Anyway, let's say I have an html page that contains a form, part of which is shown below.
I want to do a little experimenting with generating python code, so I want to obtain all the "name" attributes for the "input" items on the form. That would be "almform-house," "almform-street," and "almform-submit."
I am able to parse off the "form" part of the html page, as shown in the sample below. After that, I can't even parse off one name, let alone all of them, and I have no idea how to proceed.
I wonder if someone can offer guidance.
Thank you. Code samples follow.
<html>
<head>
<title>Demo form</title>
</head>
<body>
<FORM action="http://%%fab-apploc%%/FAB/addalm.py" method="post">
<TABLE WIDTH="100%" BORDER="0">
<TR>
<TD>House number:</TD>
<TD><INPUT type="text" size="8" name="almform-house"></TD>
<TD>Required: The house number part of the alarm address</TD>
</TR>
<TR>
<TD>Street name:</TD>
<TD><INPUT type="text" size="30" name="almform-street"></TD>
<TD>Required: The street name part of the alarm address</TD>
</TR>
</TABLE>
<INPUT type="submit" name="almform-submit" value="Add new alarm" ID="updatebutton">
</FORM>
</body>
</html>
R E B O L [
Title: "Parse html form for input names"
]
;; -- Read the html file
HTMLFILE: %rtest-buildmarkup.html
HTMLTEXT: read HTMLFILE
;; -- Pick off the html form embedded somewhere in the html file
HTMLFORM: copy ""
parse HTMLTEXT [thru "<form" copy HTMLFORM to "</form"]
;; -- Get the names of all input fields...but how?
;; -- Parsing for the name tag returns nothing.
;; -- And how would I do more than one anyway?
INPUTNAMES: copy ""
parse HTMLFORM [thru "<name=" copy INPUTNAMES to ">"]
;; -- Stop for probing
halt