[XML-SIG] xml-schema parsing using minidom.

Mariappan, MaharajanX m_mariappanX@trillium.com
Tue, 4 Dec 2001 05:53:53 -0800


-----Original Message-----
From: Sylvain Thenault [mailto:Sylvain.Thenault@logilab.fr]
Sent: Tuesday, December 04, 2001 2:01 PM
To: Mariappan, MaharajanX
Cc: 'Martin v. Loewis'; xml-sig@python.org
Subject: RE: [XML-SIG] xml-schema parsing using minidom.


On Mon, 3 Dec 2001, Mariappan, MaharajanX wrote:

> 2) There is another question on created list from return value of
> getAttribute() method.
> 
> See below function, which will collect all the enumeration values defined
> within specified simpleType element and return that result list.
> 
> def getSimpleTypeValues(dom,simpletypeName):
> 	enums = []
> 	simpletypes = dom.getElementsByTagName("xsd:simpleType")
> 	for simpletype in simpletypes:
> 		#print "%s" % simpletype.getAttribute("name")
> 		if simpletype.getAttribute("name") == simpletypeName:
> 			enumerations =
> simpletype.getElementsByTagName("xsd:enumeration")
> 			for enum in enumerations:
> 				enums.append(enum.getAttribute("value"))
> 	return enums
> 
> When I print using print "%s" % enums, It is printing like
> [u'enum1', u'enum2']
> 
> Any reason for that why print with u' ' aling with list elements?
 
this means that it's an Unicode string (try "type(u'')" vs "type('')" in 
the python interpreter).

Another thing: when you use DOM with namespaces, you should use the NS
interface of DOM, i.e. replace getAttribute("value") with
getAttributeNS(NO_NS, "value" where NO_NS is None or empty string,
depending on the dom implementation you are using (This have been fixed
in the CVS, now the empty namespace is None, independantly from the dom
implementation).
  
regards


Hi,

When I try getAttributeNS(None,"value") It is returning null sting.
I thing I've to apply the corresponding patch. Do you the correct patch.
Or wait for next offcial release of pyXml?

TIA,
Maharajan 


-- 
Sylvain Thenault

  LOGILAB           http://www.logilab.org