Skip to content

Selecting nodes by attribute values #1

@GarryGaller

Description

@GarryGaller
let htmldoc ="""
<html>
<body>
<a href="12345.txt">12345.txt</a>
<a href="12346.txt">12346.txt</a>
<a href="12347">12347</a>
</body>
</html>
"""

echo q(htmldoc).select("a[href=12345.txt]")
#output: @[<a href="12345.txt">12345.txt</a>, <a href="12346.txt">12346.txt</a>, <a href="12347">12347</a>]

let htmldoc2 ="""
<html>
<body>
<a href="12345">12345</a>
<a href="12346">12346</a>
<a href="12347">12347</a>
</body>
</html>
"""

echo q(htmldoc2).select("a[href=12347]") 
#output:  @[<a href="12345">12345</a>, <a href="12346">12346</a>, <a href="12347">12347</a>]

let htmldoc3 ="""
<html>
<body>
<a href="a12345">a12345</a>
<a href="a12346">a12346</a>
<a href="a12347">a12347</a>
</body>
</html>
"""
# Correctly working soon:
echo q(htmldoc3).select("a[href=a12347]")
#output: @[<a href="a12347">a12347</a>]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions