phamcong / rdfquery

Automatically exported from code.google.com/p/rdfquery
0 stars 0 forks source link

Error when parsing empty string literals #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Running the following javascript:

$(document).ready(function() {
    var rdf = '\
<?xml version="1.0" encoding="UTF-8"?>\
<!DOCTYPE rdf:RDF [\
    <!ENTITY ex "http://example.org/">\
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">\
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">\
]>\
<rdf:RDF xmlns:ex="&ex;" xmlns:rdf="&rdf;">\
    <ex:Thing rdf:about="&ex;1">\
        <ex:label rdf:datatype="&xsd;string"></ex:label>\
    </ex:Thing>\
</rdf:RDF>\
';

    var data = (new DOMParser()).parseFromString(rdf, 'text/xml');
    var db = $.rdf().databank.load(data);
});

Or parsing any RDFXML which contains an empty xsd:string literal (I've not 
tried RDFa parsing, only full RDF documents).

The problem doesn't occur if the node contains any text.

If the node doesn't have the rdf:datatype property, then having an empty node 
doesn't cause a problem either.

What is the expected output? What do you see instead?

The expected output is nothing, and the javascript console should show no 
errors (the databank should contain data though).

Instead (in the javascript console), I get the error message:

in firefox:
p.childNodes[0] is undefined 

in chrome:
Uncaught TypeError: Cannot read property 'nodeValue' of undefined

this occurs in:
jquery.rdfquery.core-1.0.js

on line 1813

What version of the product are you using? On what operating system?
rdfQuery 1.0, occurs in FireFox and Chrome on Ubuntu Linux.

Original issue reported on code.google.com by sui...@gmail.com on 25 Nov 2010 at 11:52