Here is the xml to be parsed. I want to use sax parser to parse this xml but it is
<Plans>
<Plan ID="1" Name="Plan-A">
<Plan ID="4" Name="Plan-A1">
<Content ID="1" Description="Testing plans 123"/>
<Content ID="2" Description="Testing plans 2222"/>
</Plan>
<Plan ID="5" Name="Plan-A2">
<Content ID="3" Description="Testing plans 55551111"/>
</Plan>
</Plan>
</Plans>
these plan tabs can go upto N-levels Can any one there help me find out how to parse it in SAX parser here is the PlansDTO i created for it.
public class PlansDTO {
String _id;
String _name;
String _child_id;
boolean _hasChild;
Vector _childIds;
Hashtable _plans;
Vector contentDTOs;
}
I am having difficulty in handling this tree through sax parser , can any one there help me ?
SAX is a context-free parser, so, if you need context, you have to do it by yourself : your parser should therefore have a reference to the last "plan" instance that has started.
You may also consider using another parser like DOM or JAXB : these parsers will keep the context for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.