[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue-common/src/definitions GParser.py
From: |
Jan Ischebeck |
Subject: |
gnue-common/src/definitions GParser.py |
Date: |
Tue, 18 Nov 2003 17:03:26 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue-common
Branch:
Changes by: Jan Ischebeck <address@hidden> 03/11/18 17:02:51
Modified files:
src/definitions: GParser.py
Log message:
add error message for the case that a tag which isn't in the default
namespace is the root element
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/definitions/GParser.py.diff?tr1=1.67&tr2=1.68&r1=text&r2=text
Patches:
Index: gnue-common/src/definitions/GParser.py
diff -c gnue-common/src/definitions/GParser.py:1.67
gnue-common/src/definitions/GParser.py:1.68
*** gnue-common/src/definitions/GParser.py:1.67 Thu Apr 3 19:13:06 2003
--- gnue-common/src/definitions/GParser.py Tue Nov 18 17:01:25 2003
***************
*** 103,109 ****
dh.initValidation()
# Tell the parser to use our handler
! parser.setContentHandler(dh)
parser.parse(stream)
object = dh.getRoot()
--- 103,110 ----
dh.initValidation()
# Tell the parser to use our handler
! parser.setContentHandler(dh)
!
parser.parse(stream)
object = dh.getRoot()
***************
*** 189,199 ****
self._requiredTags = []
self._singleInstanceTags = []
self._tagCounts = {}
- try:
- self.__encoding = gConfig('textEncoding')
- except:
- self.__encoding = "iso8859-1"
-
#
# Called by client code to get the "root" node
--- 190,195 ----
***************
*** 240,245 ****
--- 236,242 ----
# a starting XML element/tag is encountered.
#
def startElementNS(self, qtag, qname, saxattrs):
+
ns, name = qtag
attrs = {}
loadedxmlattrs = {}
***************
*** 273,296 ****
else:
# Typecasting, anyone? If attribute should be int, make it an int
! try:
! attrs[attr] =
baseAttrs[attr].get('Typecast',GTypecast.text)(saxattrs[qattr].encode(self.__encoding))
loadedxmlattrs[attr] = attrs[attr]
except KeyError:
tmsg = _('Error processing <%s> tag [I do not recognize the "%s"
attribute')\
% (name, attr)
raise MarkupError, tmsg
! except UnicodeError:
! tmsg = _('Error processing <%s> tag [Encoding error: invalid
character in "%s" attribute;]')\
! % (name, attr)
! raise MarkupError, tmsg
!
! except StandardError, msg:
! raise
! tmsg = _('Error processing <%s> tag [invalid type for "%s"
attribute; value is "%s"]')\
! % (name, attr, saxattrs[qattr])
! raise MarkupError, tmsg
# If this attribute must be unique, check for duplicates
if baseAttrs[attr].get('Unique',0): # default
(baseAttrs[attr],'Unique',0):
--- 270,294 ----
else:
# Typecasting, anyone? If attribute should be int, make it an int
! try:
! attrs[attr] =
baseAttrs[attr].get('Typecast',GTypecast.text)(saxattrs[qattr])
loadedxmlattrs[attr] = attrs[attr]
except KeyError:
tmsg = _('Error processing <%s> tag [I do not recognize the "%s"
attribute')\
% (name, attr)
raise MarkupError, tmsg
! # this error shouldn't occure anymore
! #except UnicodeError:
! # tmsg = _('Error processing <%s> tag [Encoding error: invalid
character in "%s" attribute;]')\
! # % (name, attr)
! # raise MarkupError, tmsg
!
! #except StandardError, msg:
! # raise
! # tmsg = _('Error processing <%s> tag [invalid type for "%s"
attribute; value is "%s"]')\
! # % (name, attr, saxattrs[qattr])
! # raise MarkupError, tmsg
# If this attribute must be unique, check for duplicates
if baseAttrs[attr].get('Unique',0): # default
(baseAttrs[attr],'Unique',0):
***************
*** 339,345 ****
attrs[attr] = saxattrs[qattr]
loadedxmlattrs[attr] = saxattrs[qattr]
! object = self.xmlMasqueradeNamespaceElements(self.xmlStack[0])
object._xmltag = name
object._xmlnamespace = ns
object._listedAttributes = loadedxmlattrs.keys()
--- 337,349 ----
attrs[attr] = saxattrs[qattr]
loadedxmlattrs[attr] = saxattrs[qattr]
! try:
! object = self.xmlMasqueradeNamespaceElements(self.xmlStack[0])
! except IndexError:
! tmsg = _("Error processing <%s:%s> tag: root element needs to be in
default namespace") %\
! (ns,name)
! raise MarkupError, tmsg
!
object._xmltag = name
object._xmlnamespace = ns
object._listedAttributes = loadedxmlattrs.keys()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue-common/src/definitions GParser.py,
Jan Ischebeck <=