On Tuesday, March 23, 2004, at 09:21 AM, Mark Brownell wrote:
-- put PNLPgetAttribute("name", tZap) into theAttribute function PNLPgetAttribute tAttribute, strngToSearch
strngToSearch should be parsed from an element tag set ("<bob", "</bob>", tZap) first in order to parse that element's attributes. (Note: "<bob" is missing the ">" on the start tag. This is to allow for the attributes to follow.) In other words it's only a pull-parser for attributes after it is separated out from its element as the new strngToSearch. This is probably another case of bad explanations or comments in my code. On the other hand it could be broken. I just put up an example using the element version:
-- put PNLPgetElement("<record>", "</record>", tZap) into theElement
function PNLPgetElement tStTag, tEdTag, stngToSch
to make an XML table. I should have explained that parsing attributes is a two step process.
Thanks for showing me this Wouter.
Mark
This is the latest that works, and thanks to Wouter it also fixes attributes that begin different but end the same. I forgot about space and SGML requirements.
Example tag set: <BODY TEXT="#000000" BGCOLOR="#F8D0B8" LINK="#999999" VLINK="#000000" ALINK="#FF0000">blab here website</BODY>
New:
-- put PNLPgetAttribute("name", tElementFound) into theAttribute
function PNLPgetAttribute tAttribute, strngToSearch
put empty into zapA
put quote into Qx
if char 1 of tAttribute = space then
put tAttribute & "=" & Qx into tAttributeX
else
put space & tAttribute & "=" & Qx into tAttributeX
end if
put the number of chars in tAttributeX into dChars
put offset(tAttributeX,strngToSearch) into tNum1
if tNum1 < 1 then
return "error"
exit PNLPgetAttribute
end if
put tNum1 + dChars into tNumX
put offset(Qx,strngToSearch,tNumX) into tNumZ
if tNumX < 1 then
return "error"
exit PNLPgetAttribute
end if
if tNumZ < 1 then
return "error"
exit PNLPgetAttribute
end if
put char tNumX to (tNumX + (tNumZ - 1)) of strngToSearch into zapA
return zapA
end PNLPgetAttributeMark
_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
