You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

parse()

Usage

parse(source, selector)

Description
Parses the given source using a Microformats parser. This method will try to parse the given source string according to the Microformats specification and return a Structr object with the resulting data. It is often used in conjunction with GET() to fetch semantic data from plain HTML sources. The selector parameter will be used to select the parseable elements from the response; for a format specification, see the JSOUP Cookbook.

parse() returns a Structr object that can be accessed using the dot notation (e.g. result.type[0] or result.location.name).

Note
The below example is the textbook example for the use of the cache() function: the request to the infrequently changing Lanyrd profile page can easily be cached for 24 hours.

Example

${parse(cache('profile', 86400, GET('http://lanyrd.com/profile/amorgner/')), 'li.vevent')[0]}

results in

{type=[conference, vevent, interactive-listing], url=/2015/graphconnect/, summary=GraphConnect Europe 2015, location={name=[England, London], flag-small=England, flag-uk=England}, date={dtstart=7th May 2015}, attendee-status={name=Axel Morgner, speaking=spoke, status-indicator=spoke}}

Search results for "parse()"

We could not find anything matching "parse()" in our documentation. Please rephrase your search.

You can also ask your questions in the Structr Google Group or create a free account in the Structr Support Portal.
Click here to send feedback to the Structr team.