Re: [android-developers] Re: Particular Tag Parsing
How to parse the tag by my order. Ex:- sample iphonenice/iphone Androidsuper/Android ipad excellent/ipad /sample In this XML file i need to get order as, android, iphone ipad. But i'm getting as iphone , android ipad. How to get like android, iphone ipad. On Tue, Feb 2, 2010 at 10:45 AM, Sasikumar.S sasikumar.it1...@gmail.comwrote: Hi Kevin, Which is more faster and easier to use?. I need to Parse a XML. That file contains more than 12000 lines. First i tried to use DOM but it is very slow. It is taking more than 10 minutes tom parse. Now i'm trying to use SAX. Which one is very fast whether SAX or XMLPull Parser ?.. On Tue, Feb 2, 2010 at 10:40 AM, Kevin Duffey andjar...@gmail.com wrote: Hari, as far as I know you'd usually parse the document into an object, do any updating of the object, then write it back out overwriting the previous version. SAX doesn't store the xml in memory, it streams it, like xmlpull does and you assemble an object tree from the xml as your needs require. You don't have to assmble an object tree that is identical to the xml as well. This is probably part of the reason DOM is so slow and requires as much as 8x the XML size in memory to store. Frankly, I'd go with xmlpull. It's vastly easier to work with and generally as fast if not faster than sax. On Mon, Feb 1, 2010 at 8:34 PM, Sasikumar.S sasikumar.it1...@gmail.comwrote: I don't know Hari. On Tue, Feb 2, 2010 at 10:03 AM, hari harish.cse...@gmail.com wrote: hi Sasikumar.S do you know how to update xml file using Sax parser. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
SAX Parsers, both push and pull, follow document order. Your problem is what makes programming fun. It takes creativity. There are many ways you could solve it, for example, by using java.util.SortedMap. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
Thank U for responding previous Questions. One more thing Guys. Now i'm getting one more doubt in that. I need to parse the below XML file: item 22item/2 33item/3 11item/1 44item/4 /item In that i'm fetching data from 1, 2,3 4. But i'm getting value as 2, 3, 1 4 in order wise. How to get in my wish order?. Please give some idea guy?.. On Mon, Feb 1, 2010 at 10:29 AM, Frank Weiss fewe...@gmail.com wrote: SAXParser does NOT parse line by line. That's incorrect. What you need is something like this: @Override public void characters(char[] ch, int offset, int count) { sb.append(ch, offset, count); } @Override public void endElement(String namespaceUri, String localName, String qName) { if (localName.equals(title)) title = sb.toString(); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
You will have to sort your data once you get it. You can't control the order it's processed. If you know for a fact that it will only be 4 items, you could create an array of size 4, then stick the data in the specific index spot of the array. Or you can add it to a list then sort it. That is an odd XML tho. I've not seen xml return something like that...are you responsible for the XML being returned, or have no control over it? On Mon, Feb 1, 2010 at 2:26 AM, Sasikumar.S sasikumar.it1...@gmail.comwrote: Thank U for responding previous Questions. One more thing Guys. Now i'm getting one more doubt in that. I need to parse the below XML file: item 22item/2 33item/3 11item/1 44item/4 /item In that i'm fetching data from 1, 2,3 4. But i'm getting value as 2, 3, 1 4 in order wise. How to get in my wish order?. Please give some idea guy?.. On Mon, Feb 1, 2010 at 10:29 AM, Frank Weiss fewe...@gmail.com wrote: SAXParser does NOT parse line by line. That's incorrect. What you need is something like this: @Override public void characters(char[] ch, int offset, int count) { sb.append(ch, offset, count); } @Override public void endElement(String namespaceUri, String localName, String qName) { if (localName.equals(title)) title = sb.toString(); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
I don't know Hari. On Tue, Feb 2, 2010 at 10:03 AM, hari harish.cse...@gmail.com wrote: hi Sasikumar.S do you know how to update xml file using Sax parser. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
Hari, as far as I know you'd usually parse the document into an object, do any updating of the object, then write it back out overwriting the previous version. SAX doesn't store the xml in memory, it streams it, like xmlpull does and you assemble an object tree from the xml as your needs require. You don't have to assmble an object tree that is identical to the xml as well. This is probably part of the reason DOM is so slow and requires as much as 8x the XML size in memory to store. Frankly, I'd go with xmlpull. It's vastly easier to work with and generally as fast if not faster than sax. On Mon, Feb 1, 2010 at 8:34 PM, Sasikumar.S sasikumar.it1...@gmail.comwrote: I don't know Hari. On Tue, Feb 2, 2010 at 10:03 AM, hari harish.cse...@gmail.com wrote: hi Sasikumar.S do you know how to update xml file using Sax parser. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
Hi Kevin, Which is more faster and easier to use?. I need to Parse a XML. That file contains more than 12000 lines. First i tried to use DOM but it is very slow. It is taking more than 10 minutes tom parse. Now i'm trying to use SAX. Which one is very fast whether SAX or XMLPull Parser ?.. On Tue, Feb 2, 2010 at 10:40 AM, Kevin Duffey andjar...@gmail.com wrote: Hari, as far as I know you'd usually parse the document into an object, do any updating of the object, then write it back out overwriting the previous version. SAX doesn't store the xml in memory, it streams it, like xmlpull does and you assemble an object tree from the xml as your needs require. You don't have to assmble an object tree that is identical to the xml as well. This is probably part of the reason DOM is so slow and requires as much as 8x the XML size in memory to store. Frankly, I'd go with xmlpull. It's vastly easier to work with and generally as fast if not faster than sax. On Mon, Feb 1, 2010 at 8:34 PM, Sasikumar.S sasikumar.it1...@gmail.comwrote: I don't know Hari. On Tue, Feb 2, 2010 at 10:03 AM, hari harish.cse...@gmail.com wrote: hi Sasikumar.S do you know how to update xml file using Sax parser. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
Ok. Thank u very much for ur reply. In SAX Parser it will parse line by line. How can we get only the particular data alone. Ex:- In a XML file there are 5 tags. SAX is parsing all the 5 tags. I need only the 1,3 4 tag value. How to retrieve that?. I did not need 2 5th value. can you pls give some idea for this?.. On Mon, Feb 1, 2010 at 10:16 AM, Kumar Bibek coomar@gmail.com wrote: SAX parsing is done line by line, so there is no way that you can pick up a specific tag if you are SAX parsing. Kumar Bibek On Feb 1, 8:30 am, Sasikumar.S sasikumar.it1...@gmail.com wrote: Hi, How to parse only the particular tag using SAX Parser?.. *sample.xml* * * main type= sub connameGeorge/conname conphonenumber840123456/conphonenumber extraUS/extra /sub /main when i try to parse the above sample.xml i'm getting all the values(conname, canphonenumber extra). But i need only conname conphonenumber -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
SAXParser does NOT parse line by line. That's incorrect. What you need is something like this: @Override public void characters(char[] ch, int offset, int count) { sb.append(ch, offset, count); } @Override public void endElement(String namespaceUri, String localName, String qName) { if (localName.equals(title)) title = sb.toString(); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
Thank u frank. On Mon, Feb 1, 2010 at 10:29 AM, Frank Weiss fewe...@gmail.com wrote: SAXParser does NOT parse line by line. That's incorrect. What you need is something like this: @Override public void characters(char[] ch, int offset, int count) { sb.append(ch, offset, count); } @Override public void endElement(String namespaceUri, String localName, String qName) { if (localName.equals(title)) title = sb.toString(); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Particular Tag Parsing
Ok Thank U Kumar On Mon, Feb 1, 2010 at 11:18 AM, Kumar Bibek coomar@gmail.com wrote: Well, true, it's not line by line, to be more specific, it's character by character. What I meant was, you can't just pick up specific data from the XML, you will have to go through the whole XML, or till the tag which you want to fetch. Kumar Bibek. On Feb 1, 10:12 am, Sasikumar.S sasikumar.it1...@gmail.com wrote: Thank u frank. On Mon, Feb 1, 2010 at 10:29 AM, Frank Weiss fewe...@gmail.com wrote: SAXParser does NOT parse line by line. That's incorrect. What you need is something like this: @Override public void characters(char[] ch, int offset, int count) { sb.append(ch, offset, count); } @Override public void endElement(String namespaceUri, String localName, String qName) { if (localName.equals(title)) title = sb.toString(); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Sasikumar.S -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en