Giter VIP home page Giter VIP logo

xml-libxml-queryselector's Introduction

NAME
    XML::LibXML::QuerySelector - add querySelector and querySelectorAll
    methods to XML::LibXML nodes

SYNOPSIS
      use XML::LibXML::QuerySelector;
  
      my $document = XML::LibXML->load_xml(location => 'my.xhtml');
      my $warning  = $document->querySelector('p.warning strong');
      print $warning->toString if defined $warning;

DESCRIPTION
    This module defines a class (it has no constructor so perhaps closer to an
    abstract class or a role) XML::LibXML::QuerySelector, and sets itself up
    as a superclass (not a subclass) of XML::LibXML::Document,
    XML::LibXML::DocumentFragment and XML::LibXML::Element, thus making its
    methods available to objects of those classes.

    Yes, this is effectively monkey-patching, but it's performed in a
    *relatively* safe manner.

  Methods
    The methods provided by this module are defined in the W3C Recomendation
    "Selectors API Level 1" <http://www.w3.org/TR/selectors-api/>.

    `querySelector($selector)`
        Given a CSS selector, returns the first match or undef if there are no
        matches.

    `querySelectorAll($selector)`
        Given a CSS selector, returns all matches as a list, or if called in
        scalar context, as an XML::LibXML::NodeList.

CAVEATS
    *   When called on an element, `querySelectorAll` returns a static node
        list; not a live node list. (Called on a document or document
        fragment, it will return a live node list as specified in the W3C
        Recommendation.)

    *   Use on mixed-namespace documents is largely untested. The module is
        mostly intended for use with XHTML and HTML documents.

BUGS
    Please report any bugs to
    <http://rt.cpan.org/Dist/Display.html?Queue=XML-LibXML-QuerySelector>.

TODO
    *   Consider adding HTML5 DOM traversal methods including
        `getElementsByClassName`.

SEE ALSO
    HTML::Selector::XPath, XML::LibXML.

    <http://www.w3.org/TR/selectors-api/>.

AUTHOR
    Toby Inkster <[email protected]>.

THANKS
    Tatsuhiko Miyagawa and Max Maischein, for HTML::Selector::XPath, and for
    resolving <https://rt.cpan.org/Ticket/Display.html?id=73719> quickly.

COPYRIGHT AND LICENCE
    This software is copyright (c) 2012-2013 by Toby Inkster.

    This is free software; you can redistribute it and/or modify it under the
    same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES
    THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
    WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
    MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

xml-libxml-queryselector's People

Contributors

tobyink avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.