W3C home > Mailing lists > Public > www-archive@w3.org > September 2002

Small cwm patch: fixing embedded RDF

From: Andrew Kuchling <akuchlin@mems-exchange.org>
Date: Wed, 11 Sep 2002 14:09:15 -0400 (EDT)
To: timbl@w3.org, connolly@w3.org, www-archive+n3bugs@w3.org
Message-Id: <E17pBv1-0000uh-00@ute.mems-exchange.org>




If you have RDF embedded in some larger XML document, cwm's rdf parser
raises an "Unknown RDF parser state 'Not RDF' in end tag" exception.  
For example, this little file won't be processed.

<?xml version="1.0"?>
<metadata  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:s="http://mems-exchange.org/schema/file/1.0/"
         xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>  This is non-RDF content </title>
  <rdf:RDF>
    <rdf:Description rdf:about="%s">
      <dc:Creator>%s</dc:Creator>
      <s:Run>45</s:Run>
    </rdf:Description>
  </rdf:RDF>
  <element />
</metadata>

The patch is simple, just ignoring the NOT_RDF state in the end
tag handler; see below.

--amk

Index: sax2rdf.py
===================================================================
RCS file: /sources/public/2000/10/swap/sax2rdf.py,v
retrieving revision 1.22
diff -u -r1.22 sax2rdf.py
--- sax2rdf.py	2002/08/06 01:36:09	1.22
+++ sax2rdf.py	2002/09/11 18:03:06
@@ -415,7 +415,8 @@
         elif self._state == STATE_DESCRIPTION:
             self._items.pop()
         elif self._state == STATE_NOVALUE or \
-             self._state == STATE_NO_SUBJECT:
+             self._state == STATE_NO_SUBJECT or \
+             self._state == STATE_NOT_RDF:
             pass
         else:
             raise RuntimeError, ("Unknown RDF parser state '%s' in end tag" % self._state, self._stack)
Received on Wednesday, 11 September 2002 20:24:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:17:22 GMT