SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
May 2, 2007, 11:24 #1
- Join Date
- Feb 2003
- Location
- Knoxville, TN
- Posts
- 531
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Retrieving Attribute Data from Parent Node
my xml file is basically laid out like this...
Code:<mystuff name="test"> <box boxname="mybox1" version="2" weight="2"> <bag bagname="mybag1" weight="5"> <bag bagname="mybag1.1" weight="4"></bag> <bag bagname="mybag1.2" weight="3"></bag> </bag> </box> <box boxname="mybox2" version="2" weight="4"></box> </mystuff>
Code://box[@weight='4'] | //bag[@weight='4'
as i loop through those elements, i'd like to also retrieve the parent names (if any) of those elements. how can i do this?
-
May 2, 2007, 12:13 #2
- Join Date
- Feb 2003
- Location
- Knoxville, TN
- Posts
- 531
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
nevermind...got it...
mynode.parentNode.getAttribute("att_name");
easy enough :P
Bookmarks