Not a developer? Go to MovableType.com

Plugin and Theme Directory

XmlScraper v0.33

By sandman
Posted June 1, 2014, in Utilities.

Details

A plugin that scrapes XML/HTML files from MT templates and retrieves nodes in XPath format.

Example Usage

  • Reflect XML file information on the web
  • Share group site information over different servers

Block Tag

**MTXtmlScraper**
Block tag used for reading XML files *Useable attributes:* * url:the URL you want to scrape (cannot be used with files) * file:the file path you want to scrape (cannot be used with URLs). Include does not work, and AllowFileInclude has no effect. * charset:Typically auto identifies, but can be used to specify if text becomes garbled
**MTHtmlScraper**
Same function as MTXtmlScraper, but used to read HTML files.
**MTChildNodes**
Loops the child node specified in a file's xpath *Useable Attributes:* * xpath:Specify a file's objective nodes using xpath format (using XML::Xpath library format) * lastn:Specify the maximum number of entries to display表

Function Tag

**MTNodeValue**
Retrives the value of the Xpath selected *Useable Attributes* * xpath:Specify a file's objective nodes using xpath format (using XML::Xpath library format)
**MTNodeValue**
Returns the currently selected node

Template Examples

Reading Local Files

Remove the title tag value from the HTML file

<mt:htmlScraper file="/home/xxx.jp/public_html/index.html">

  <mt:ChildNodes xpath='//title'>*   <:nodeValue xpath="./text()"$>
</mt:htmlScraper>`</pre>

#### Reading Yahoo News

<pre>`<mt:htmlScraper url="http://www.yahxx.jp" charset="utf-8">
<dl>
  <mt:ChildNodes lastn="5" xpath='//div[@id="topicsfb"]//ul[@class="emphasis"]//a'>
  <dt><:nodeValue xpath="./text()"$></dt>
  <dd><:nodeValue xpath="./@href"$></dd>
  </mt:ChildNodes>
</dl>
</mt:htmlScraper>

Plugin Settings

  • User Agent: Specifies the user agent
  • Timeout (seconds): Specifies the time limit when retrieving a file before time out occurs

Disclaimer

  1. We do not accept liability for damage that might occur from use of this plugin.
  2. Available for commercial / modified / resale.
  3. Resale is only available if offered for free or less than $10.
  4. Support is not available for this plugin.
  5. Any bugs with the plugin will be fixed in subsequent versions.
  6. Please contact us if you want to discuss customizing this plugin for your specific needs.

Requirements

  • XML::XMLPath
  • LWP::UserAgent

Compatibility

Movable Type versions: 5.05.15.26.0 Japanese only

Language Note

XmlScraper or its documentation is not fully localized into English. If you are interested in using XmlScraper but require additional translation, please let us know by e-mailing webmaster@movabletype.org.

License

Commercial,Other


Back