The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Meta::Lang::Xml - help you with xml related tasks.

COPYRIGHT

Copyright (C) 2001 Mark Veltzer; All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

DETAILS

MANIFEST: Xml.pm PROJECT: meta

SYNOPSIS

package foo; use Meta::Lang::Xml qw(); my($object)=Meta::Lang::Xml-new();> my($result)=$object-method();>

DESCRIPTION

This class will help you with xml related tasks. 0. checking an xml file for correctness according to dtd.

EXPORTS

get_prefix() get_search_list($) setup($) setup_path() fail_check($) check($$$) c2deps($) c2chun($) odeps($$$$) resolve_dtd($) resolve_xml($) get_type($)

FUNCTION DOCUMENTATION

get_prefix()

This method returns the prefix for xml related material in the baseline.

get_search_list($)

This method gives you the search list for XML processing. The input is the original path.

setup($)

This method gets a path and sets up the search path according to this path.

setup_path()

This method will setup path for validating parsers accoding to the baseline.

fail_check($)

This method will be called by the XML::Checker::Parser if there is an error. We just print the error message and thats it. We dont die!!! (remmember we dont die in any routine as it is bad practice...).

check($)

This method checks an XML file for structure according to a DTD. This is achieved by using the XML::Checker::Parser class which is a validating parser to parse the file. The parser will print the errors to STDERR if any are encountered (which is good for us) and will return the number of errros encountered via the global varialbe $errors.

c2deps($)

This method reads a source xml file and produces a deps object which describes the dependencies for that file. This method uses an Expat parser to do it which is quite cheap.

c2chun($)

This method receives an XML file and removes the DOCTYPE declarations from it so it could be included in another SGML file.

odeps($$$$)

This method reads a source xml file and produces a deps object which describes the dependencies for that file. This method is doing it using a DOM parser which is quite expensive (it stores the entire docbument in RAM and other problems...).

resolve_dtd($)

This method recevies a system id of a dtd file and resolves it to a physical file. This method should (potentialy) also check that the dtd is a member of the project.

resolve_xml($)

This method recevies a system id of an xml file and resolves it to a physical file. This method should (potentialy) also check that the xml is a member of the project.

get_type($)

This method receives a file name of an XML document and returns the type of the document (the highest element in it).

BUGS

None.

AUTHOR

Mark Veltzer <mark2776@yahoo.com>

HISTORY

None.

SEE ALSO

Nothing.

TODO

-the way im counting errros here is not nice since I'm using a global variable. This could be pretty bad for multi-threading etc... Try to make that nicer and dump the global var. You could see the errors global variable in the vars section.