in reply to Accessing dotted tags with Mojo::DOM

$dom->at("com\\.cloudbees\\.hudson\\.plugins\\.folder\\.properties\\.A +uthorizationMatrixProperty")

Replies are listed 'Best First'.
Re^2: Accessing dotted tags with Mojo::DOM
by Fletch (Bishop) on Dec 07, 2022 at 03:46 UTC

    Well foo . . . I thought I’d tried that but it certainly works w/9.30. Serves me right first SoPW in 21 years and it’s PEBKAC.

    #!/usr/bin/env perl use 5.034; use Mojo::DOM; my $xml_src = do { local $/; <DATA>; }; my $dom = Mojo::DOM->new->xml(1); $dom->parse( $xml_src ); my @targets = ( qq{com\\.cloudbees\\.hudson\\.plugins\\.folder\\.proper +ties\\.AuthorizationMatrixProperty}, qq{\Qcom.cloudbees.hudson.plugins.folder.properties.Aut +horizationMatrixProperty}, ); for my $tgt (@targets) { say qq{tgt: $tgt}; say $dom->at( $tgt )->all_text; } exit 0; __END__ <?xml version="1.0" encoding="UTF-8"?> <foo> <com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixP +roperty> <bar>Test text</bar> </com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrix +Property> </foo>

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.