[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML attributes
Hi,
On Sam, 02 Aug 2036, you wrote:
> Hi,
>
> 1) can you please tell me as to how to get the element tag names and the
> attribute tag names with their values .
> 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()).
>
> 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
>
> }
>
> }
try something like the followig piece of code:
static void list (Node node) {
String _name = node.getNodeName ();
NameNodeMap _attributes = node.getAttributes ();
Node _attribute = null;
int i=0;
if (_attributes != null) {
while ((_attribute = _attributes.getItem (i++)) != null) {
if (_attribute.getNodeName().equals ("loginName")) {
// do something with the found login name
}
else {
// do something
}
}
}
}
but I don't know if this is what you want to do
> 2) can you get the ozone server URI address , _userName, _passwd using some
> method.
> ie ..after RemoteDatabase database = new RemoteDatabase();
> database.open ("URI", 3333, "_userName", "passwd");
> how do we get the parameters (URI,userName,passwd) from the remote database.
Regards,
Lars
--
________________________________________________________________
Lars Martin lars@softwarebuero.de
SMB - softwarebuero m&b http://www.softwarebuero.de