[XML-SIG] Using getElementById

Thomas B. Passin tpassin at comcast.net
Thu Oct 16 19:19:26 EDT 2003


Kamel Hamard (QC/EMC) wrote:
> 
> I'm using 4suite API and I know that I can't access to my element using this document's method.
> 
> To be able to do that, I use minidom. I have a xml file and a dtd file where I'm declaring which attivutes are considered as IDs. 
> 
> Here is the code to create the document:
> 
> import xml.dom.minidom
> 	file = "xml file path name"
> 	doc = xml.dom.minidom.parseString(open(file).read()) 
> 	print	doc.getElementById('myid')
> 
> 
> 
> I'm getting None as result. Any body has an Idea why?
> 
> Here is the sction of the DTD for the declaration:
> 
> <!ATTLIST ndp
> 	id ID #REQUIRED
> 	version CDATA #REQUIRED
> 
> 

Well, you did not show your xml source. The dtd only declares that 
attributes names "id" are of type ID, and you asked for.  If your source 
has no "id" attribute with a value 'myid', there will be nothing to return.

Cheers,

Tom P





More information about the XML-SIG mailing list