[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML attributes again!!



Hi,

1) can someone explain how to get the element tag names and the attribute tag
names with their values .
in the following code.
for  eg if
      <uid loginName="ozone" passwd="ozone" firstName="xyz">
I want to get the attribute tag names "loginName" without hardcoding the tag
name itself as in
 Node _attlist1 = _attr.getNamedItem("loginName"); 
how to use the node interface to get  Attr interface (use getTagName()).

In the below function when u are passing a node object it is not possible to
get either the element objects or Attr objects and use the method
Attr.getName() to get the TagName ???.

static void list(Node node) {
                
        _name = node.getNodeName();
        NamedNodeMap _attr = node.getAttributes();
  
        // gets the attributes of a Node//
        if (_attr != null){
       
            Node _attlist = _attr.getNamedItem("uid"); //get the uid
attribute
            Node _attlist1 = _attr.getNamedItem("loginName"); // get the
loginName attribute
            Node _attlist2 = _attr.getNamedItem("passwd"); // get the passwd
attribute
            Node _attlist3 = _attr.getNamedItem("firstName"); // get the
firstName attribute
            Node _attlist4 = _attr.getNamedItem("lastName");//get the lastName
attribute
            Node _attlist5 = _attr.getNamedItem("groupIDValue");//get the
groupID attribute
      
	 }     
           
}


reply at the earliest,
Many thanks
bye
prashanth


____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1