Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

XMLElement with sub-elements?

  • To: mathgroup at
  • Subject: [mg68322] XMLElement with sub-elements?
  • From: "AngleWyrm" <anglewyrm at>
  • Date: Tue, 1 Aug 2006 06:59:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

I want to extract a couple pieces of info from an XML record. I can get just 
one XMLElement child element easily enough, but how to get several?

For example, an xml record set
  <name>Basic Factory</name>
 <-- more records -->

To get all industry values, I can gather all cases where the XMLElement 
contains an XMLElement "Industry", like so:

improvements = Import[ filename, "XML"];
factories = Cases[improvements, XMLElement[_, _,
{___, XMLElement["Industry", _, {industry_}], ___}
] -> {industry}, Infinity]

How would I get the names AND industry values into a list? 

  • Prev by Date: Re: need to make a special function
  • Next by Date: Re: need to make a special function
  • Previous by thread: Re: Using implicit information about row indices
  • Next by thread: Re: XMLElement with sub-elements?