Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mkdoc::xml::tagger(3pm) [debian man page]

MKDoc::XML::Tagger(3pm) 				User Contributed Perl Documentation				   MKDoc::XML::Tagger(3pm)

NAME
MKDoc::XML::Tagger - Adds XML markup to XML / XHTML content. SYNOPSIS
use MKDoc::XML::Tagger; print MKDoc::XML::Tagger->process_data ( "<p>Hello, World!</p>", { _expr => 'World', _tag => 'strong', class => 'superFort' } ); Should print: <p>Hello, <strong class="superFort">World</strong>!</p> SUMMARY
MKDoc::XML::Tagger is a class which lets you specify a set of tag and attributes associated with expressions which you want to mark up. This module will then stuff any XML you send out with the extra expressions. For example, let's say that you have a document which has the term 'Microsoft Windows' several times in it. You could wish to surround any instance of the term with a <trademark> tag. MKDoc::XML::Tagger lets you do exactly that. In MKDoc, this is used so that editors can enter hyperlinks separately from the content. It allows them to enter content without having to worry about the annoying <a href="..."> syntax. It also has the added benefit from preventing bad information architecture such as the 'click here' syndrome. We also have plans to use it for automatically linking glossary words, abbreviation tags, etc. MKDoc::XML::Tagger is also probably a very good tool if you are building some kind of Wiki system in which you want expressions to be automagically hyperlinked. DISCLAIMER
This module does low level XML manipulation. It will somehow parse even broken XML and try to do something with it. Do not use it unless you know what you're doing. API
The API is very simple. my $result = MKDoc::XML::Tagger->process_data ($xml, @expressions); Tags $xml with the @expressions list. Each element of @expressions is a hash reference looking like this: { _expr => 'Some Expression', _tag => 'foo', attribute1 => 'bar' attribute2 => 'baz' } Which will try to turn anything which looks like: Some Expression sOmE ExPrEssIoN (etcetera) Into: <foo attr1="bar" attr2="baz">Some Expression</foo> <foo attr1="bar" attr2="baz">sOmE ExPrEssIoN</foo> <foo attr1="bar" attr2="baz">(etcetera)</foo> You can have multiple expressions, in which case longest expressions are processed first. my $result = MKDoc::XML::Tagger->process_file ('some/file.xml', @expressions); Same as process_data(), except it takes its data from 'some/file.xml'. NOTES
MKDoc::XML::Tagger does not really parse the XML file you're giving to it nor does it care if the XML is well-formed or not. It uses MKDoc::XML::Tokenizer to turn the XML / XHTML file into a series of MKDoc::XML::Token objects and strictly operates on a list of tokens. For this same reason MKDoc::XML::Tagger does not support namespaces. AUTHOR
Copyright 2003 - MKDoc Holdings Ltd. Author: Jean-Michel Hiver This module is free software and is distributed under the same license as Perl itself. Use it at your own risk. SEE ALSO
MKDoc::XML::Tokenizer MKDoc::XML::Token perl v5.10.1 2005-03-10 MKDoc::XML::Tagger(3pm)

Check Out this Related Man Page

Template::XML(3pm)					User Contributed Perl Documentation					Template::XML(3pm)

NAME
Template::XML - XML plugins for the Template Toolkit SYNOPSIS
[% USE XML; dom = XML.dom('foo.xml'); xpath = XML.xpath('bar.xml'); simple = XML.simple('baz.xml'); rss = XML.simple('news.rdf'); %] DESCRIPTION
The Template-XML distribution provides a number of Template Toolkit plugin modules for working with XML. The Template::Plugin::XML module is a front-end to the various other XML plugin modules. Through this you can access XML files and direc- tories of XML files via the Template::Plugin::XML::File and Template::Plugin::XML::Directory modules (which subclass from the Tem- plate::Plugin::File and Template::Plugin::Directory modules respectively). You can then create a Document Object Model (DOM) from an XML file (Template::Plugin::XML::DOM), examine it using XPath queries (Template::Plugin::XML::XPath), turn it into a Perl data structure (Tem- plate::Plugin::XML::Simple) or parse it as an RSS (RDF Site Summary) file. The basic XML plugins were distributed as part of the Template Toolkit until version 2.15 released in May 2006. At this time they were extracted into this separate Template-XML distribution and an alpha version of this Template::Plugin::XML front-end module was added. AUTHORS
Andy Wardley wrote the Template Toolkit plugin modules, with assistance from Simon Matthews in the case of the XML::DOM plugin. Matt Sergeant wrote the XML::XPath module. Enno Derksen and Clark Cooper wrote the XML::DOM module. Jonathan Eisenzopf wrote the XML::RSS mod- ule. Grant McLean wrote the XML::Simple module. Clark Cooper and Larry Wall wrote the XML::Parser module. James Clark wrote the expat library. COPYRIGHT
Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Template, Template::Plugins, Template::Plugin::XML, Template::Plugin::XML::DOM, Template::Plugin::XML::RSS, Template::Plugin::XML::Simple, Template::Plugin::XML::XPath perl v5.8.8 2008-03-01 Template::XML(3pm)
Man Page