[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Fwd: Re: DOM

  • To: xml-dev@l...
  • Subject: Fwd: Re: DOM
  • From: Seetha Rama Krishna <ram_kurra@y...>
  • 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= ;

dom get name
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@e... wrote:
Date: Thu, 27 Oct 2005 10:13:28 -0700 (PDT)
From: soundars@e...
To: xml-dev@l...
Subject: Re: 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 http://in.promos.yahoo.com/fabmall/index.html

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.