Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] removing one child

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: luca <passani AT eunet.no>
  • To: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] removing one child
  • Date: Wed, 10 Nov 2004 13:25:29 +0100


Elliotte,

I need to build an utility for the WURFL to remove some of the capabilities:

WURFL snippet:

<device fall_back="root" id="generic" user_agent="">
<group id="product_info">
<capability name="brand_name" value=""/>
<capability name="model_name" value=""/>
</group>

I am trying to do something like this, but I'm stuck:

for(int k = 0; k < devices.size(); k++) {
Elements groups =
((Element)devices.get(k)).getChildElements("group");

//extra list to keep capabilities grouped by group
for (int i = 0; i < groups.size(); i++) {
Elements capaList =
groups.get(i).getChildElements("capability");
int numberOfCapabilities += capaList.size();
for (int j = 0; j < capaList.size(); j++) {
Element capa = capaList.get(j);
String capa_name = capa.getAttributeValue("name");
if (!capaAcceptedList.contains(capa_name)) {
//remove capability
}
}
//if group has no capability, remove group too
}
}

my problem is that there is no API to remove one single child at the time.
I only see:

removeChildren() = remove ALL children

is this because of syncronization issues? or maybe it would
be disruptive for the internal representation used by XOM?
would this impact size()?

Anyway, what's the right way to do what I wanna do?

thanks

Luca






Archive powered by MHonArc 2.6.24.

Top of Page