Page 1 of 1

Using pgFetch() to get a section of XML

PostPosted: Thu Nov 21, 2024 1:30 pm
by Clifton
GOAL: To retrieve a portion of an XML and manipulate the results.

XML that contains menu HTML code used as a boilerplate

XML for the menu page that loads the above code using pgFetch()
  • pgFetch() is called with the notify parameter set to this.name to send a user event to the object that called the function.
  • pgFetch() is called with the loadPage parameter set to a section tag of the XML called <theMenu>. Since this tag contains only string data, pgFetch() will return only the string (or in this case the HTML boilerplate code). Otherwise, if <theMenu> contained other tags and functions definitions, the return from pgFetch() would've been an XML document. If one of the sub-tags was <theCode>, then it could be accessed as
    [e.data]["theCode"]
    in the user event function.

RESULT when loaded . . .
     
    Image