Source

p5-xrd-parser / example.pl

Full commit
use lib "lib";
use XRD::Parser;

my $xrd = <<XRD;
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xml:id="foo">
  <Expires>1970-01-01T00:00:00Z</Expires>
  <Property type="http://spec.example.net/type/person" />
  <Link rel="http://spec.example.net/auth/1.0"
    href="http://services.example.com/auth" />
  <Link rel="http://spec.example.net/photo/1.0" type="image/jpeg"
    href="http://photos.example.com/gpburdell.jpg">
    <Title xml:lang="en">User Photo</Title>
	 <Property type="http://something.com/">Comment</Property>
  </Link>
</XRD>
XRD

my $parser = XRD::Parser->new($xrd, "http://example.org/", {'tdb_service'=>1});
$parser->consume;
my $iter = $parser->graph->as_stream;

while (my $st = $iter->next)
{
	print $st->as_string . "\n";
}

#  <Subject>http://example.com/gpburdell</Subject>