in my xml file,
i have same tag name used at different place (layer1 and layer2),
how can i differenciate tags named "<tile gid ="int">
" from layer1 and layer2 ?
i need to process them differently depending if they belong to layer1 or layer2...
here's a small sample of my parser and my xml file:
// =================
// xml parser sample
// =================
XmlResourceParser xrp = (XmlResourceParser) ctx.getResources().getXml(R.xml.castle);
while (xrp.getEventType() != XmlResourceParser.END_DOCUMENT)
{
if (xrp.getEventType() == XmlResourceParser.START_TAG)
{
String s = xrp.getName();
if (s.equals("tile"))
{
int a = xrp.getAttributeIntValue(null, "gid", 0);
// process a
}
}
}
// ===============
// xml file sample:
// ===============
<layer name="layer1">
<data>
<tile gid="1"/>
<tile gid="2"/>
...
</data>
</layer>
<layer name="layer2">
<data>
<tile gid="1"/>
<tile gid="2"/>
...
</data>
</layer>