-
Notifications
You must be signed in to change notification settings - Fork 577
Open
Labels
bugSomething isn't workingSomething isn't workingconcept: namespaceformat: RDF/XMLRelated to the RDF/XML format.Related to the RDF/XML format.serializationRelated to serialization.Related to serialization.
Description
Whilst the following works as expected
from rdflib import Graph
g = Graph(bind_namespaces='none').parse(data='prefix ex: <http://example.org/> ex:a ex:b "test"@en .')
g.print(format="xml")
output:
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:ex="http://example.org/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<rdf:Description rdf:about="http://example.org/a">
<ex:b xml:lang="en">test</ex:b>
</rdf:Description>
</rdf:RDF>
the following one does not (due to ns1: and ns2:):
from rdflib import Graph
g = Graph(bind_namespaces='none').parse(data='prefix ex: <http://example.org/> ex:a ex:b "test"@en .')
g.print(format="pretty-xml")
output:
<?xml version="1.0" encoding="utf-8"?>
<ns1:RDF
xmlns:ex="http://example.org/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<ns1:Description ns1:about="http://example.org/a">
<ex:b ns2:lang="en">test</ex:b>
</ns1:Description>
</ns1:RDF>
It seems like the culprit is in how the namespaces are registered in case bind_namepaces='none'
is set, as removing it makes both of them work identically.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingconcept: namespaceformat: RDF/XMLRelated to the RDF/XML format.Related to the RDF/XML format.serializationRelated to serialization.Related to serialization.