summaryrefslogtreecommitdiff
path: root/rdflib/plugins/serializers/rdfxml.py
diff options
context:
space:
mode:
authorNicholas Car <nicholas.car@csiro.au>2020-04-16 23:19:22 +1000
committerNicholas Car <nicholas.car@csiro.au>2020-04-16 23:19:22 +1000
commit56d0d74c6becdfa22a193c98293314bd6ee9dde1 (patch)
tree6c44e0328ee76bc665e6dc72c8c416a96e64d174 /rdflib/plugins/serializers/rdfxml.py
parent26710b0bbd8ed9c8c950479f61ae9dec0a504e2e (diff)
downloadrdflib-issue_1003.tar.gz
inverted precedence of base: graph wins over adding base to serialize(). Added RDF/XML, TriX & 1/2 TriG (incomplete)issue_1003
Diffstat (limited to 'rdflib/plugins/serializers/rdfxml.py')
-rw-r--r--rdflib/plugins/serializers/rdfxml.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/rdflib/plugins/serializers/rdfxml.py b/rdflib/plugins/serializers/rdfxml.py
index 631c8fe0..0da1cccd 100644
--- a/rdflib/plugins/serializers/rdfxml.py
+++ b/rdflib/plugins/serializers/rdfxml.py
@@ -46,7 +46,11 @@ class XMLSerializer(Serializer):
yield prefix, namespace
def serialize(self, stream, base=None, encoding=None, **args):
- self.base = base
+ # if base is set for the graph use that, if not and a base is given here, use that
+ if self.store.base is not None:
+ self.base = self.store.base
+ else:
+ self.base = base
self.__stream = stream
self.__serialized = {}
encoding = self.encoding
@@ -60,8 +64,8 @@ class XMLSerializer(Serializer):
write('<rdf:RDF\n')
# If provided, write xml:base attribute for the RDF
- if "xml_base" in args:
- write(' xml:base="%s"\n' % args['xml_base'])
+ if self.base:
+ write(' xml:base="%s"\n' % self.base)
# TODO:
# assert(
# namespaces["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=='rdf')