XML-Assert      v0.01
Test-XML-Assert v0.01
=====================

These two modules help you check that what you expect to be in an XML document
is actually there. You can do this via

The XML::Assert module exports the assert() function. This ...

* xpath_matches( xpath, value, msg );
* xpath_attr_is( xpath, attribute_name, value, msg ); # surely the xpath can include the @attr ?
* xpath_text_is( xpath, value, msg );

Examples:

* xpath_matches( '//NameServers/Server/IPV4Addr', 0, 'NameServer IPv4Addr is not present' )
* xpath_attr_is( '//TechnicalContact/Fax', 'CountryCode', 64, 'TechnicalContact Fax CountryCode is correct' );
* xpath_text_is( '//AuditText', 'Audit text s1c1', 'AuditText is correct' );

EXAMPLE XML ASSERTIONS
======================

For example, in the following document, you can assert a number of things, for
example, that you expect one <content> element in the document, and that it's
value is "Hello, World!":

    my $xml = <<'EOF';
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <message type="simple">
      <!-- comment node -->
      <content>Hello, World!</content>
    </message>
    EOF

    my $parser = XML::LibXML->new();
    my $doc = $parser->parse_string( $xml )->documentElement();
   
    my $xml_assert = XML::Assert->new();

    $xml_assert->is_xpath_count($doc, '//content', 1);
    $xml_assert->does_xpath_value_match($doc, '//content', 'Hello, World!')

INSTALLATION
============

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

DEPENDENCIES
============

This module requires these other modules and libraries:

XML::LibXML (>= 1.70)
Test::Simple (Test::More/Test::Builder -- core)

AUTHOR, COPYRIGHT AND LICENCE
=============================

Written by Andrew Chilton:

* andychilton@gmail.com
* andy@catalyst.net.nz

Hacked on by Sam Vilain:

* sam@vilain.net
* samv@catalyst.net.nz

This software development is sponsored and directed by New Zealand Registry
Services, http://www.nzrs.net.nz/

The work is being carried out by Catalyst IT, http://www.catalyst.net.nz/

Copyright (c) 2009, NZ Registry Services.  All Rights Reserved.  This software
may be used under the terms of the Artistic License 2.0.  Note that this
license is compatible with both the GNU GPL and Artistic licenses.  A copy of
this license is supplied with the distribution in the file COPYING.txt.
