So I'm starting to suspect my XML file.  Here it is:

<?xml version="1.0" encoding="UTF-8"?>
<Chars>
  <ChPair>
          <ch>"E"</ch>
          <ct>175391</ct>
  </ChPair>

  <ChPair>
          <ch>"T"</ch>
          <ct>129899</ct>
  </ChPair>

  <ChPair>
          <ch>"A"</ch>
          <ct>110693</ct>
  </ChPair>

  <ChPair>
          <ch>"O"</ch>
          <ct>108786</ct>
  </ChPair>
</Chars>


I rewrote the method to use a XML pull parser:


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

                try {
                        InputStream iStrm = 
getResources().openRawResource(R.xml.chars);
                        XmlPullParser parser = Xml.newPullParser();
                        parser.setInput(iStrm, null);
                        int eventType = parser.getEventType();
                        boolean done = false;

                        while (eventType != XmlPullParser.END_DOCUMENT ){
                                switch (eventType){
                        case XmlPullParser.START_DOCUMENT:
                                chars.clear();
                                break;
                        case XmlPullParser.START_TAG:
                                nameTag = parser.getName();
                                if (nameTag.equalsIgnoreCase("ch") ) {
                                myCh.setTheChar(parser.nextText().charAt(0));
                                                }else if 
(nameTag.equalsIgnoreCase("count")) {
                                        
myCh.setCount(Integer.parseInt(parser.nextText()));
                                    chars.add(myCh);
                                }
                        break;
                }  // event switch end
                eventType = parser.next();
           }
                } catch (Exception e) {
                        throw new RuntimeException(e);
                }

           }


Every thing that I've read indicate that this should work.  Any
thoughts would be appreciated.

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