---
name: "RDF::TrineX::Parser::RDFa"
section: "3pm"
platform: "linux"
package: "librdf-rdfa-parser-perl"
version: "1.097-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/RDF::TrineX::Parser::RDFa"
---

# RDF::TrineX::Parser::RDFa(3pm)

RDF::Trine::Parser-compatible interface for RDF::RDFa::Parser

## NAME

RDF::TrineX::Parser::RDFa - RDF::Trine::Parser-compatible interface for RDF::RDFa::Parser

## DESCRIPTION

While RDF::RDFa::Parser is a good RDFa parser, its interface is a tad... shall we say... crufty.

RDF::TrineX::Parser::RDFa provides a much nicer interface, and is a subclass of RDF::Trine::Parser, so you get super-polymorphic benefits. Yay!

### Class Method

- "parse\_url\_into\_model($url, $model, %args)"

  As per the method of the same name in RDF::Trine::Parser, this retrieves the URL and parses it into a model.

  Unlike RDF::Trine::Parser, this method always assumes you're trying to parse some variety of RDFa.

### Constructor

- "new(%options)"

  Constructs a new RDF::TrineX::Parser::RDFa parser.

  The two important options are flavour (which defaults to 'xhtml') and version (which defaults to '1.1'). Other options are documented in RDF::RDFa::Parser::Config.

  Let's imagine that you want to parse RDFa 1.1 in HTML5, and you want to also parse the `"role"`, `"longdesc"` and `"cite"` attibutes (which are not strictly part of RDFa, but nevertheless often interesting). Then you'd use:

  ```
    my $parser = RDF::TrineX::Parser::RDFa->new(
      flavour        => 'html5',
      version        => '1.1',
      role_attr      => 1,
      longdesc_attr  => 1,
      cite_attr      => 1,
    );
  ```

### Object Methods

The following methods are supported, as documented in RDF::Trine::Parser.

- "parse\_into\_model($base\_uri, $data, $model \[,context =\> $context\])"

  - "parse($base\_uri, $data, \\&handler)"

  - "parse\_file\_into\_model($base\_uri, $fh, $model \[,context =\> $context\])"

  - "parse\_file($base\_uri, $fh, \\&handler)"

  The following additional methods are supported:

- "rdfa\_flavour"

  Returns the RDFa host language being used.

- "rdfa\_version"

  Returns the RDFa version number being used.

### Subclasses

The following subclasses of RDF::TrineX::Parser::RDFa exist:

- RDF::TrineX::Parser::XHTML\_RDFa10

  - RDF::TrineX::Parser::HTML32\_RDFa10

  - RDF::TrineX::Parser::HTML4\_RDFa10

  - RDF::TrineX::Parser::HTML5\_RDFa10

  - RDF::TrineX::Parser::XHTML5\_RDFa10

  - RDF::TrineX::Parser::Atom\_RDFa10

  - RDF::TrineX::Parser::DataRSS\_RDFa10

  - RDF::TrineX::Parser::SVG\_RDFa10

  - RDF::TrineX::Parser::XML\_RDFa10

  - RDF::TrineX::Parser::OpenDocument\_RDFa10

  - RDF::TrineX::Parser::XHTML\_RDFa11

  - RDF::TrineX::Parser::HTML32\_RDFa11

  - RDF::TrineX::Parser::HTML4\_RDFa11

  - RDF::TrineX::Parser::HTML5\_RDFa11

  - RDF::TrineX::Parser::XHTML5\_RDFa11

  - RDF::TrineX::Parser::Atom\_RDFa11

  - RDF::TrineX::Parser::DataRSS\_RDFa11

  - RDF::TrineX::Parser::SVG\_RDFa11

  - RDF::TrineX::Parser::XML\_RDFa11

  - RDF::TrineX::Parser::OpenDocument\_RDFa11

  By using these classes, you can skip the need to pass the 'flavour' and 'version' options to the constructor. For example:

```
  my $parser = RDF::TrineX::Parser::HTML5_RDFa11->new(
    role_attr      => 1,
    longdesc_attr  => 1,
    cite_attr      => 1,
  );
```

Note that these are classes, but they are not modules. You should not attempt to load them with `"require"` or `"use"`.

## SEE ALSO

RDF::Trine::Parser, RDF::RDFa::Parser, RDF::RDFa::Parser::Config.

\<http://www.perlrdf.org/\>, \<http://rdfa.info/\>.

## AUTHOR

Toby Inkster \<tobyink@cpan.org\>.

## COPYRIGHT AND LICENCE

Copyright 2012 Toby Inkster

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

## DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
