Look at the logs. IT should tell you more.

*Thanks and Regards,
Kumar Bibek*
*
http://techdroid.kbeanie.com
http://www.kbeanie.com*



On Fri, Sep 30, 2011 at 2:05 PM, Dancing Fingers <[email protected]> wrote:

> Hi Guys,
> I'm trying to convert an old JAVA Applet to Android using an standard
> DOM parser and the same files.  I put the file in /res/raw ( and
> tried /res/xml) and changed my InputStream.  It always crashes my
> app.  So I tried to run the debugger and it keeps openning some Delvic
> type file and says source not found.  Huh?
>
> Any thoughts would be appreciated.
>
> Chris
>
>        private void parseCharXmlFile(){
>                Chars myCh;
>                try {
>                    InputStream iStrm =
> getResources().openRawResource(R.xml.chars);
>                    DocumentBuilderFactory docBuilderFactory =
> DocumentBuilderFactory.newInstance();
>                    DocumentBuilder docBuilder =
> docBuilderFactory.newDocumentBuilder();
>                    //Document doc = docBuilder.parse (new File(xFile));
>                    Document doc = docBuilder.parse (iStrm);
>
>                    // normalize text representation
>                    doc.getDocumentElement ().normalize ();
>
>                    NodeList wdList = doc.getElementsByTagName("ChPair");
>                    int totalWords = wdList.getLength();
>
>                    for(int s=0; s<wdList.getLength() ; s++){
>
>                        Node firstWordNode = wdList.item(s);
>                        if(firstWordNode.getNodeType() ==
> Node.ELEMENT_NODE){
>
>                            Element firstWordElement =
> (Element)firstWordNode;
>
>                            myCh = new Chars();
>
>                            //-------
>                            NodeList firstWordList =
> firstWordElement.getElementsByTagName("ch");
>                            Element firstWDElement =
> (Element)firstWordList.item(0);
>
>                            NodeList textWDList =
> firstWDElement.getChildNodes();
>                            char ci =
> (char)textWDList.item(0).getNodeValue().trim().charAt(1);
>                            myCh.setTheChar(ci);
>
>                            //-------
>                            NodeList countList =
> firstWordElement.getElementsByTagName("ct");
>                            Element countElement =
> (Element)countList.item(0);
>
>                            NodeList textCTList =
> countElement.getChildNodes();
>                            int ct =
> Integer.parseInt(((Node)textCTList.item(0)).getNodeValue().trim());
>                            myCh.setCount(ct);
>                            chars.add(myCh);
>
>                        }//end of if clause
>
>                    }//end of for loop with s var
>
>                }catch (SAXParseException err) {
>                        System.out.println ("** Parsing error" + ", line "
>                             + err.getLineNumber () + ", uri " +
> err.getSystemId
> ());
>                        System.out.println(" " + err.getMessage ());
>
>                }catch (SAXException e) {
>                        Exception x = e.getException ();
>                        ((x == null) ? e : x).printStackTrace ();
>
>                }catch (Throwable t) {
>                        t.printStackTrace ();
>                }
>
>        }
>
> --
> 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

-- 
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