OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Fwd: Re: [xml-dev] DOM

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: Fwd: Re: [xml-dev] DOM
  • From: Seetha Rama Krishna <ram_kurra@yahoo.co.in>
  • Date: Fri, 28 Oct 2005 13:15:26 +0100 (BST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Zjms/u7SaAU2OAcK3vOFwyCVOJIrfofhpvwoYgsvOFCPX9RUQQSSZh0wKZIwoWuscfhiwhZXmptfeYw4US7DA07hsM9s7Mjv4el5D3UIpwcmjYQcH7zG3S9evDwl7tGJaC8XvDtM29jOe/MBHEAddGWI2aR51xbPvMwL+POkgyM= ;

Hi sk,
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
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
 
soundars@ecs.csus.edu wrote:
Date: Thu, 27 Oct 2005 10:13:28 -0700 (PDT)
From: soundars@ecs.csus.edu
To: xml-dev@lists.xml.org
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



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS