Skip to content

Tolerate invalid RDF in script tag #32

@fbacall

Description

@fbacall

I'm trying to parse an HTML document as RDFa that contains the following script tag (as well as some valid JSON-LD):

<script type="text/plain" cookie-consent="tracking">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
...
</script>

the text/plain content type causes ruby-rdf to load the NTriples reader, which fails with the exception:
RDF::ReaderError: Expected subject (found: "window.dataLayer = window.dataLayer || [];")

Is there a way that the RDFa reader could tolerate (and log) bad RDF in a script tag and continue reading the rest of the document?

Or, is there a good way to not load the NTriples reader for text/plain content?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions