Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing external content into a graph #6

Open
betehess opened this issue Jul 15, 2015 · 3 comments
Open

Parsing external content into a graph #6

betehess opened this issue Jul 15, 2015 · 3 comments

Comments

@betehess
Copy link

My goal is to parse some external content into a graph, and to have some control over the graph implementation being used.

So I have tried the following in the Chrome console, from the test harness:

var input = '<html><head><title>titleTest</title></head><body> <div vocab="http://schema.org/" typeof="Invoice">  <h1 property="description">January 2015 Visa</h1>  <link property="url" href="http://acmebank.com/invoice.pdf" />Invoice PDF  <div property="broker" itemscope typeof="http://schema.org/BankOrCreditUnion">    <b property="name">ACME Bank</b>  </div>  <span property="accountId">xxxx-xxxx-xxxx-1234</span>  <div property="customer" typeof="http://schema.org/Person">    <b property="name">Jane Doe</b>  </div>  <span property="paymentDue">2015-01-30</span>  <div property="minimumPaymentDue" typeof="http://schema.org/PriceSpecification">    <span property="price">15.00</span>    <span property="priceCurrency">USD</span>  </div>  <div property="totalPaymentDue" typeof="http://schema.org/PriceSpecification">    <span property="price">200.00</span>    <span property="priceCurrency">USD</span>  </div>  <meta property="billingPeriod" content="2014-12-21/P30D" />starts:2014-12-21 30 days  <span property="paymentStatus">payment due</span></div> </body></html>'
undefined

var parser=new DOMParser();
undefined

var foo = parser.parseFromString(input, 'text/html')
undefined

GreenTurtle.attach(foo)
Uncaught Bad URI value, no scheme:

GreenTurtle.attach(foo, {baseURI: 'http://example.com'})
Uncaught Bad URI value, no scheme:

I have a few additional questions:

@betehess
Copy link
Author

I actually tried again today and it worked this time. I must have made some mistake yesterday. Sorry for the confusion.

@betehess
Copy link
Author

My bad. There is an issue. I had replaced line 606 of RDFa.js and I had forgotten about it:

var base = this.parseURI('http://example.com');

That's where the issue was.

@betehess betehess reopened this Jul 15, 2015
@betehess
Copy link
Author

There is a similar issue in RDFaProcessor.prototype.process. When it gets called with a node resulting from a call to DOMParser.parseFromString, then node.baseURI is null and the subsequent call to removeHash blows up when trying to find the "#".

This should look into options.baseURI instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant