{
    "content": [
        {
            "type": "text",
            "text": "# XML::LibXML::Pattern (perldoc)\n\n## NAME\n\nXML::LibXML::Pattern - XML::LibXML::Pattern - interface to libxml2 XPath patterns\n\n## SYNOPSIS\n\nuse XML::LibXML;\nmy $pattern = XML::LibXML::Pattern->new('/x:html/x:body//x:div', { 'x' => 'http://www.w3.org/1999/xhtml' });\n# test a match on an XML::LibXML::Node $node\nif ($pattern->matchesNode($node)) { ... }\n# or on an XML::LibXML::Reader\nif ($reader->matchesPattern($pattern)) { ... }\n# or skip reading all nodes that do not match\nprint $reader->nodePath while $reader->nextPatternMatch($pattern);\n$pattern = XML::LibXML::Pattern->new( pattern, { prefix => namespaceURI, ... } );\n$bool = $pattern->matchesNode($node);\n\n## DESCRIPTION\n\nThis is a perl interface to libxml2's pattern matching support\n*http://xmlsoft.org/html/libxml-pattern.html*. This feature requires recent versions of libxml2.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (2 subsections)\n- **SEE ALSO**\n- **AUTHORS**\n- **VERSION**\n- **COPYRIGHT**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "XML::LibXML::Pattern",
        "section": "",
        "mode": "perldoc",
        "summary": "XML::LibXML::Pattern - XML::LibXML::Pattern - interface to libxml2 XPath patterns",
        "synopsis": "use XML::LibXML;\nmy $pattern = XML::LibXML::Pattern->new('/x:html/x:body//x:div', { 'x' => 'http://www.w3.org/1999/xhtml' });\n# test a match on an XML::LibXML::Node $node\nif ($pattern->matchesNode($node)) { ... }\n# or on an XML::LibXML::Reader\nif ($reader->matchesPattern($pattern)) { ... }\n# or skip reading all nodes that do not match\nprint $reader->nodePath while $reader->nextPatternMatch($pattern);\n$pattern = XML::LibXML::Pattern->new( pattern, { prefix => namespaceURI, ... } );\n$bool = $pattern->matchesNode($node);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 23,
                "subsections": [
                    {
                        "name": "new",
                        "lines": 12
                    },
                    {
                        "name": "matchesNode",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "XML::LibXML::Pattern - XML::LibXML::Pattern - interface to libxml2 XPath patterns\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use XML::LibXML;\nmy $pattern = XML::LibXML::Pattern->new('/x:html/x:body//x:div', { 'x' => 'http://www.w3.org/1999/xhtml' });\n# test a match on an XML::LibXML::Node $node\n\nif ($pattern->matchesNode($node)) { ... }\n\n# or on an XML::LibXML::Reader\n\nif ($reader->matchesPattern($pattern)) { ... }\n\n# or skip reading all nodes that do not match\n\nprint $reader->nodePath while $reader->nextPatternMatch($pattern);\n\n$pattern = XML::LibXML::Pattern->new( pattern, { prefix => namespaceURI, ... } );\n$bool = $pattern->matchesNode($node);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is a perl interface to libxml2's pattern matching support\n*http://xmlsoft.org/html/libxml-pattern.html*. This feature requires recent versions of libxml2.\n\nPatterns are a small subset of XPath language, which is limited to (disjunctions of) location\npaths involving the child and descendant axes in abbreviated form as described by the extended\nBNF given below:\n\nSelector ::=     Path ( '|' Path )*\nPath     ::=     ('.//' | '//' | '/' )? Step ( '/' Step )*\nStep     ::=     '.' | NameTest\nNameTest ::=     QName | '*' | NCName ':' '*'\n\nFor readability, whitespace may be used in selector XPath expressions even though not explicitly\nallowed by the grammar: whitespace may be freely added within patterns before or after any\ntoken, where\n\ntoken     ::=     '.' | '/' | '//' | '|' | NameTest\n\nNote that no predicates or attribute tests are allowed.\n\nPatterns are particularly useful for stream parsing provided via the \"XML::LibXML::Reader\"\ninterface.\n",
                "subsections": [
                    {
                        "name": "new",
                        "content": "$pattern = XML::LibXML::Pattern->new( pattern, { prefix => namespaceURI, ... } );\n\nThe constructor of a pattern takes a pattern expression (as described by the BNF grammar\nabove) and an optional HASH reference mapping prefixes to namespace URIs. The method returns\na compiled pattern object.\n\nNote that if the document has a default namespace, it must still be given an prefix in order\nto be matched (as demanded by the XPath 1.0 specification). For example, to match an element\n\"<a xmlns=\"http://foo.bar\"</a>\", one should use a pattern like this:\n\n$pattern = XML::LibXML::Pattern->new( 'foo:a', { foo => 'http://foo.bar' });\n"
                    },
                    {
                        "name": "matchesNode",
                        "content": "$bool = $pattern->matchesNode($node);\n\nGiven an XML::LibXML::Node object, returns a true value if the node is matched by the\ncompiled pattern expression.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "XML::LibXML::Reader for other methods involving compiled patterns.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Matt Sergeant, Christian Glahn, Petr Pajas\n",
                "subsections": []
            },
            "VERSION": {
                "content": "2.0134\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "2001-2007, AxKit.com Ltd.\n\n2002-2006, Christian Glahn.\n\n2006-2009, Petr Pajas.\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "This program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}