I figured it out.  It was a combination of not accessing the correct
Android resources and faulty data structure.  The correct code follows
(hope this helps someone else):


        public void parseCharXmlFile(){
                Chars myCh;
                String nameTag= "";

                try {
                        Resources res = getResources();
                        int eventType = parser.getEventType();
                        boolean done = false;

                        while (eventType != XmlPullParser.END_DOCUMENT && !done 
){
                                switch (eventType){
                        case XmlPullParser.START_DOCUMENT:
                                chars.clear();
                                break;
                        case XmlPullParser.START_TAG:
                                nameTag = parser.getName();
                                System.out.println("Reading start tag " + 
nameTag);
                                if (nameTag.equalsIgnoreCase("ch") ) {
                                        myCh = new Chars(' ',0);
                                        
myCh.setTheChar(parser.nextText().charAt(1));
                                                }  else if 
(nameTag.equalsIgnoreCase("count")) {
                                        
myCh.setCount(Integer.parseInt(parser.nextText()));
                                                }
                             break;
                                        case XmlPullParser.END_TAG:
                                nameTag = parser.getName();
                                if (nameTag.equalsIgnoreCase("Chars") ){
                                    done = true;
                                } else if (nameTag.equalsIgnoreCase("ChPair"))
{
                                            chars.add(myCh);
                                }
                                break;
                }  // event switch end
            eventType = parser.next();
                        } // end while
        } catch (XmlPullParserException ex) {
                        System.out.println(ex);
        } catch (IOException e) {
                        System.out.println(e);
            }
        }

Chris

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to