1--TEST--
2DOM\HTMLDocument::createFromString() - line and column test
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = DOM\HTMLDocument::createFromString(<<<HTML
9<!doctype html>
10<html>
11    <head>
12        <title>foo</title>
13    </head>
14    <body>
15        <div id="mydiv" x="foo">
16            <p>
17                <strong>This is my paragraph</strong>
18                <!-- my comment -->
19            </p>
20        </div>
21    </body>
22</html>
23HTML);
24
25$xpath = new DOM\XPath($dom);
26
27foreach ($xpath->query("//*") as $element) {
28    echo "Element: '", $element->tagName, "', ", $element->getLineNo(), "\n";
29}
30
31foreach ($xpath->query("//*[name()='strong']") as $element) {
32    echo "Text: '", $element->textContent, "', ", $element->firstChild->getLineNo(), "\n";
33}
34
35foreach ($xpath->query("//*[name()='div']") as $element) {
36    foreach ($element->attributes as $attribute) {
37        echo "Attribute: '", $attribute->nodeName, "', ", $attribute->getLineNo(), "\n";
38    }
39}
40
41foreach ($xpath->query("//comment()") as $comment) {
42    echo "Comment: '", $comment->data, "', ", $comment->getLineNo(), "\n";
43}
44
45?>
46--EXPECT--
47Element: 'HTML', 1
48Element: 'HEAD', 2
49Element: 'TITLE', 3
50Element: 'BODY', 5
51Element: 'DIV', 6
52Element: 'P', 7
53Element: 'STRONG', 8
54Text: 'This is my paragraph', 8
55Attribute: 'id', 6
56Attribute: 'x', 6
57Comment: ' my comment ', 9
58