Next in thread →
Next in month →
Fwd: Re: [xml-dev] DOM
Hi sk,
Thanx s for u r reply. Here i am sending the code.
Thanx s for u r reply. Here i am sending the code.
My idea is take two list's value list n name list n whenever value list point's to 1 I shoud get name list one.
But problem is combo box ( list.toarray()) is the only one constructor.
How can I pass 2 arguments to combobox constructor.
can any one guide me.
Here I am attaching my code
Here I am attaching my code
public static List getContent(Document doc) {
List listInGetContentMethod = new ArrayList();
List valueListGetContentMethod = new ArrayList();
Element root = doc.getDocumentElement();
NodeList childList = root.getElementsByTagName("name");
NodeList chList = root.getElementsByTagName("value");
System.out.println("xxxx" + chList.getLength());
for (int j = 0; j < chList.getLength(); j++) {
Node valueNode = chList.item(j);
root = (Element) valueNode;
System.out.println("eachelemet"+ root.getFirstChild().getNodeValue());
valueListGetContentMethod.add(root.getFirstChild().getNodeValue());
}
int n = childList.getLength();
System.out.println("Child Nodes" + n);
for (int i = 0; i < n; i++) {
Node titleNode = childList.item(i);
root = (Element) titleNode;
System.out.println("eachelemet"+ root.getFirstChild().getNodeValue());
listInGetContentMethod.add(root.getFirstChild().getNodeValue());
}
return listInGetContentMethod;
}
In my code I getting elements by using tag name. Here I am making two array list , one for value tag n one for name tag.
so whenever I get price in the name tage I should get 6.
How can I solve this problem.
Can any body guide me.
Is there any alternative solution rather than taking 2 arrayList's??
Looking forward for solutions.
Thanx(inadvance),
ramu
[email protected] wrote:
Date: Thu, 27 Oct 2005 10:13:28 -0700 (PDT)
From: [email protected]
To: [email protected]
Subject: Re: [xml-dev] DOM
Hi Ram,
I dont think this is really a DOM question. Its a logic issue. You can
parse the file and store your values as a list objects and get the values
when needed using getters and setters.
- SK.
> Hello techies,
> I am using reading xml file by using DOM in java. My problem is i
> have to read the xml file n the values b/w the tags n < value>
> i have to take.
> Here is the my xml file
>
> PRICE
> 6
>
>
> SIZE
> 13
>
> I am using jcombo box to display price n display. when i select price
> i should get 6 n when i select size i should get 13.
> how can i do this one.
> Any one suggest the solution
>
>
>
> regards,
> ramu
>
>
>
> ---------------------------------
> Enjoy this Diwali with Y! India Click here
-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org , an
initiative of OASIS
The list archives are at http://lists.xml.org/archives/xml-dev/
To subscribe or unsubscribe from this list use the subscription
manager:
Enjoy this Diwali with Y! India Click here
Next in thread →
Next in month →