Anyone know how to do this?
 
Given an element name, an attribute name and optionally an attribute value: what is the best way to quickly find that element in the DOM?
 
We have tryed getElementsByTagName (then searched the resulting list for attributes) but that turns out to be too slow.
 
Next we tryed using the special "ID" thing that can be used in DTDs, but xerces then failed to load the document. Our XML/DTD loads okay unless we try to specify ID in the DTD (as documented in our Wrox book).
 
thanks for any help,
Gerry
 

 
<?xml version="1.0"?>
<!DOCTYPE debugDocument [
<!ELEMENT debugDocument (name,description,events)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT events (event)*>
<!ELEMENT event (#PCDATA)>
<!ATTLIST event id ID #REQUIRED>
<!ATTLIST event name CDATA #REQUIRED>
<!ATTLIST event class CDATA #REQUIRED>
<!ELEMENT event (rules)>
<!ELEMENT rules (rule)*>
<!ELEMENT rule (#PCDATA)>
<!ATTLIST rule op CDATA #REQUIRED>
<!ATTLIST rule op1 CDATA #REQUIRED>
<!ATTLIST rule op2 CDATA #REQUIRED>
<!ATTLIST rule alert CDATA #REQUIRED>
<!ATTLIST rule event CDATA #REQUIRED>
<!ATTLIST rule lineNo CDATA #REQUIRED>
<!ATTLIST rule relate CDATA #REQUIRED>
]>
<debugDocument>
   <name>IDEAS Debug Information</name>
   <description>IDEAS Debug Info</description>
   <events>
   <event id="1" name="" class="">
  <rules>
  <rule op="" op1="" op2="" alert="" event="" lineNo="" relate="">
  </rule>
  </rules>
   </event>
   </events>
</debugDocument>