Parsing XML from the Net - Using the SAXParser

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Postby padde » Sun Nov 01, 2009 9:28 am

Replace this...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public void characters(char ch[], int start, int length) {
  3.  
  4.     if(this.in_mytag) {
  5.  
  6.         myParsedExampleDataSet.setExtractedString(new String(ch, start, length));
  7.  
  8.     }
  9.  
  10. }
  11.  
  12.  
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


with this...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public void characters(char ch[], int start, int length) {
  3.  
  4.     if(this.in_mytag) {
  5.  
  6.         myParsedExampleDataSet.setExtractedString(new StringBuffer().append(ch).toString());
  7.  
  8.     }
  9.  
  10. }
  11.  
  12.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


The problem is the newline character at the end of the string in the xml.. the new String(...) method seems
to cant handle this.. stringbuffer can.
Maybe this is a new bug.. but i'am not familiar enough with the expected behaviour in this case to claim it as a
bug :)

I would say just take this solution for now.. or even better.. clean your XMLs ;)
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Top

Postby marf » Sun Nov 01, 2009 3:57 pm

I'm not sure why this is happening. I'm developing my library outside of the Android Framework, but I fully intend to move it inside once I get to a certain stage. So I'm using Java SDK 1.6, and the SAX parse that comes with it.
I've encountered this wierd error. My Java overridden method is:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void startElement(String namespaceURI, String localName,
  2.  
  3.                         String qName, Attributes atts) throws SAXException
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


Which is fine.

my XML is a string

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="UTF-8"?><mydata>XXXXXXXXX</mydata>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


so I made a slight adjustment and am calling it like so:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. SAXParserFactory spf = SAXParserFactory.newInstance();
  3.  
  4.                 SAXParser sp;
  5.  
  6.                 MyHandler th;
  7.  
  8.                 try {
  9.  
  10.                         sp = spf.newSAXParser();
  11.  
  12.                        
  13.  
  14.                         mh= new MyHandler();
  15.  
  16.                         sp.parse(new InputSource(new StringReader(unparsedEntity)),mh);
  17.  
  18.                         MyObject test = mh.getParsedData();
  19.  
  20.                 }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


The annoything thing, is it was never working. I was doing the tags and assignment all correctly. I decided to step through my code and debug. What I found was

In StartElement I changed

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. if(localName.equalsIgnoreCase("mydata"))
  2.  
  3.                 {
  4.  
  5.                         _inTag = true;
  6.  
  7.                 }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


To

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. if(qName.equalsIgnoreCase("mydata"))
  2.  
  3.                 {
  4.  
  5.                         _inTag = true;
  6.  
  7.                 }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


and now it works perfectly.

Now there are some tutorials that I have read that use qName, and some use localName. Is this a SAX version problem? Will I get this bug when I move my library over into an Android project? Any Ideas?
marf
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Nov 01, 2009 3:47 pm

Thanks Paddy

Postby base2coder » Mon Nov 02, 2009 7:58 am

THanks a lot paddy....it is working now...
base2coder
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun Jul 12, 2009 8:54 pm

xml parsing

Postby hPushpa18 » Thu Nov 05, 2009 2:43 pm

Hi ,

I have attached my project.can u please help me with parsing cc.xml.Its giving null as extracted string.Its urgent

Thanks and Regards,
pushpa
Attachments
XMLParsingDemo2.zip
(164.69 KiB) Downloaded 149 times
hPushpa18
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Nov 02, 2009 11:08 am
Location: Bangalore

Postby padde » Thu Nov 05, 2009 5:16 pm

The XML looks like this...
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version='1.0'  encoding='UTF-8' ?>
  3.  
  4. <RESULTS>
  5.  
  6.         <ROW>
  7.  
  8.                 <COLUMN NAME="ID"><![CDATA[162]]></COLUMN>
  9.  
  10.                 <COLUMN NAME="QUESTION"><![CDATA[What...]]></COLUMN>
  11.  
  12.                 <COLUMN NAME="ANSWER"><![CDATA[Show...]]></COLUMN>
  13.  
  14.                 <COLUMN NAME="EXPLANATION"><![CDATA[This...]]></COLUMN>
  15.  
  16.                 <COLUMN NAME="CATEGORY"><![CDATA[(ICND 1)...]]></COLUMN>
  17.  
  18.                 <COLUMN NAME="FIGURE"><![CDATA[]]></COLUMN>
  19.  
  20.                 <COLUMN NAME="CATID"><![CDATA[4]]></COLUMN>
  21.  
  22.         </ROW>
  23.  
  24. </RESULTS>
  25.  
  26.  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


Relevant part of the handler is...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.      public void startElement(String namespaceURI, String localName,
  3.  
  4.                String qName, Attributes atts) throws SAXException {
  5.  
  6.           if (localName.equals("RESULTS")) {
  7.  
  8.                this.RESULTS = true;
  9.  
  10.           }else if (localName.equals("ROW")) {
  11.  
  12.                this.ROW = true;
  13.  
  14.           }else if (localName.equals("COLUMN NAME")) {
  15.  
  16.                this.COLUMN = true;
  17.  
  18.           }//else if (localName.equals("tagwithnumber")) {
  19.  
  20.                // Extract an Attribute
  21.  
  22.                String attrValue = atts.getValue("ID");
  23.  
  24.                String i = attrValue;
  25.  
  26.                myParsedExampleDataSet.setExtractedString(i);
  27.  
  28.          
  29.  
  30.      }
  31.  
  32.      
  33.  
  34.      /** Gets be called on closing tags like:
  35.  
  36.       * </tag> */
  37.  
  38.      @Override
  39.  
  40.      public void endElement(String namespaceURI, String localName, String qName)
  41.  
  42.                throws SAXException {
  43.  
  44.           if (localName.equals("RESULTS")) {
  45.  
  46.                this.RESULTS = false;
  47.  
  48.           }else if (localName.equals("ROW")) {
  49.  
  50.                this.ROW = false;
  51.  
  52.           }else if (localName.equals("COLUMN NAME")) {
  53.  
  54.                this.COLUMN = false;
  55.  
  56.           }//else if (localName.equals("tagwithnumber")) {
  57.  
  58.                // Nothing to do here
  59.  
  60.          
  61.  
  62.      }
  63.  
  64.  
Parsed in 0.041 seconds, using GeSHi 1.0.8.4


You checking in both methods for a tag named "COLUMN NAME".
Replace all "COLUMN NAME" to "COLUMN" and it should work.
The tag name is "COLUMN" the "NAME" is a attribute of the tag not part of the tag name.
Due to that your COLUMN boolean is never true and therefore nothing is saved to your parsed
dataset.
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

xml parsing

Postby hPushpa18 » Fri Nov 06, 2009 5:52 am

Hi Padde,

Even though i changed it to COLUMN its not working,can u plz help me.I have attached the project.can u plz import it and check.But u need to push the file (cc.xml)to sdcard


Thanks and Regards,
Pushpa
Attachments
XMLParsingDemo3.rar
(317.5 KiB) Downloaded 109 times
hPushpa18
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Nov 02, 2009 11:08 am
Location: Bangalore

Top

Postby padde » Fri Nov 06, 2009 11:01 am

For me it was working.. well some how.. but i changed it so it reads from res/raw before testing and
i got wrong results but better than nothing :D

I paddefied the complete project a bit and now it parse the complete fp.xml and shows the results.
Be patient after you hit the button.. that xml is a huge beast and take some seconds to parse.
Attachments
XMLParsingDemo3.rar
(159.95 KiB) Downloaded 180 times
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Postby SubZtep » Sun Nov 08, 2009 1:57 am

Hi,
thanks for this great tutorial.

I can use this with emulator without any problem.
When I'm trying to install this into my phone, I've got this message:

Parse Error
There is a problem parsing the package.


I have no idea what's going on, I tried to parse XML with standard DocumentBuilder and I got the same message. Without XML parsing functions everything working fine. Have you got any idea?
I'm using 1.5.

Cheers!
SubZtep
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Nov 07, 2009 10:29 pm

Postby tolas » Tue Nov 17, 2009 6:29 am

padde wrote:Replace this...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void characters(char ch[], int start, int length) {
  2.     if(this.in_mytag) {
  3.         myParsedExampleDataSet.setExtractedString(new String(ch, start, length));
  4.     }
  5. }
  6.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


with this...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void characters(char ch[], int start, int length) {
  2.     if(this.in_mytag) {
  3.         myParsedExampleDataSet.setExtractedString(new StringBuffer().append(ch).toString());
  4.     }
  5. }
  6.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


The problem is the newline character at the end of the string in the xml.. the new String(...) method seems
to cant handle this.. stringbuffer can.
Maybe this is a new bug.. but i'am not familiar enough with the expected behaviour in this case to claim it as a
bug :)

I would say just take this solution for now.. or even better.. clean your XMLs ;)




Just to make this a bit more clear. SAX buffers the calls to the characters method. This means that within a single block of character data, the characters(..) method could get called multiple times with only "chunks" of the text. In other words, the character array, from the start value to the full length, will not always be the full block of text you are looking for.

You ALWAYS need to append the character array into a StringBuffer, and handle the StringBuffer on the next end (or start) element event in order to get the full block of text you are looking for.
tolas
Freshman
Freshman
 
Posts: 3
Joined: Tue Nov 17, 2009 6:21 am

Postby achie1266 » Tue Nov 17, 2009 6:46 am

tolas wrote:You ALWAYS need to append the character array into a StringBuffer, and handle the StringBuffer on the next end (or start) element event in order to get the full block of text you are looking for.


Can you give an example of this. I might be having the same problem. I am trying to parse out an xml file with almost 1000 records [each has 4 properties] and it fails in four of them. it cuts out one of the property strings and gives them as multiple records.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby tolas » Tue Nov 17, 2009 4:27 pm

achie1266 wrote:
tolas wrote:You ALWAYS need to append the character array into a StringBuffer, and handle the StringBuffer on the next end (or start) element event in order to get the full block of text you are looking for.


Can you give an example of this. I might be having the same problem. I am trying to parse out an xml file with almost 1000 records [each has 4 properties] and it fails in four of them. it cuts out one of the property strings and gives them as multiple records.



This was quickly done from the top of my head without compiling it, but it should be correct.

For example if you want to grab all the character data inside a "blah" element".


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.      StringBuffer buff = null;
  2.      boolean buffering = false;
  3.  
  4.      public void startElement(String namespaceURI, String localName,
  5.                String qName, Attributes atts) throws SAXException {
  6.           if (localName.equals("blah")) {
  7.                buff = new StringBuffer("");
  8.                buffering = true;
  9.           }
  10.          
  11.      }
  12.      
  13.      public void characters(char ch[], int start, int length) {
  14.          if(buffering) {
  15.              buff.append(ch, start, length)
  16.          }
  17.      }
  18.  
  19.      public void endElement(String namespaceURI, String localName, String qName)
  20.                throws SAXException {
  21.           if (localName.equals("blah")) {
  22.                buffering = false;
  23.                // HERE YOU HAVE THE FULL TEXT CONTENT INSIDE OF "blah" TO DO WHAT YOU WANT WITH
  24.                // classString = buff.toString()
  25.           }
  26.          
  27.      }
  28.  
  29.  
Parsed in 0.039 seconds, using GeSHi 1.0.8.4




NOTE: This is the most basic example. If you have nested elements inside of "blah" this will also pick up those elements character data. If you have nested "blah" elements inside of each other, this most likely will not produce the result you want as it will stop buffering at the end of the inner "blah". But this is a good foundation to start with.
tolas
Freshman
Freshman
 
Posts: 3
Joined: Tue Nov 17, 2009 6:21 am

Postby achie1266 » Tue Nov 17, 2009 5:53 pm

tolas wrote:NOTE: This is the most basic example. If you have nested elements inside of "blah" this will also pick up those elements character data. If you have nested "blah" elements inside of each other, this most likely will not produce the result you want as it will stop buffering at the end of the inner "blah". But this is a good foundation to start with.


Thank you Tolas.

That worked perfect after I did necessary modifications.
this is what I have done.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import org.xml.sax.Attributes;
  2. import org.xml.sax.SAXException;
  3. import org.xml.sax.helpers.DefaultHandler;
  4.  
  5. import android.util.Log;
  6.  
  7. public class MyHandler extends DefaultHandler{
  8.        
  9.         private int count = 0;
  10.         private int timerCount = 0;
  11.        
  12.         private boolean inRootElement = false;
  13.         private boolean inObject = false;
  14.         private boolean inId= false;
  15.         private boolean inName = false;
  16.        
  17.         StringBuffer buffer = null;
  18.         boolean buffering = false;
  19.        
  20.         private MyObject object;
  21.        
  22.         private MyDbAdapter adapter;
  23.        
  24.         public MyHandler(MyDbAdapter adapter){
  25.                 this.adapter = adapter;
  26.         }
  27.        
  28.         @Override
  29.         public void startDocument() throws SAXException{
  30.                 this.object = new MyObject();
  31.         }
  32.        
  33.         @Override
  34.         public void endDocument() throws SAXException{
  35.  
  36.         }
  37.  
  38.         @Override
  39.         public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
  40.                 if(localName.equalsIgnoreCase("root_element")){
  41.                         this.inRootElement = true;
  42.                 }else if (localName.equalsIgnoreCase("object")){
  43.                         this.inObject = true;
  44.                 }else if (localName.equalsIgnoreCase("id")){
  45.                         buffer = new StringBuffer("");
  46.                         this.inId = true;
  47.                 }else if (localName.equalsIgnoreCase("name")){
  48.                         buffer = new StringBuffer("");
  49.                         this.inName = true;
  50.                 }
  51.         }
  52.        
  53.         @Override
  54.         public void endElement(String uri, String localName, String qName) throws SAXException{
  55.                 if (localName.equalsIgnoreCase("root_element")){
  56.                         this.inRootElement = false;
  57.                 }else if (localName.equalsIgnoreCase("object")){
  58.                         adapter.addMyObject(object);
  59.                         this.inObject = false;
  60.                 }else if (localName.equalsIgnoreCase("id")){
  61.                         this.inId = false;
  62.                 }else if (localName.equalsIgnoreCase("name")){
  63.                         this.inName = false;
  64.                 }
  65.         }
  66.        
  67.         @Override
  68.         public void characters(char ch[], int start, int length){
  69.                 if(this.inRootElement){
  70.                 }
  71.                 if(this.inObject){
  72.                 }
  73.                 if(this.inId){
  74.                         String idFromXml = buffer.append(ch, start, length).toString();
  75.                         int i = -1;
  76.                         if(idFromXml.trim().length()>0)
  77.                                 i = Integer.parseInt(idFromXml.trim());
  78.                         object.setId(i);
  79.                 }
  80.                 if(this.inName){
  81.                         String nameFromXml = buffer.append(ch, start, length).toString();
  82.                         object.setName(nameFromXml);
  83.                 }
  84.         }
  85. }
  86.  
Parsed in 0.047 seconds, using GeSHi 1.0.8.4

My Sample XML
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <root_element>
  3. <object>
  4.   <id>1</id>
  5.   <name>First Object Name</name>
  6. </object>
  7. <object>
  8.   <id>2</id>
  9.   <name>Second Object Name</name>
  10. </object>
  11. </root_element>
  12.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


I have not checked the syntax of this java file as I have modified it a little to remove my project specific names. But I hope this will help anyone out there like me. Please let me know if I have done any mistakes or if it can be done in a better way.

Thanks again Tolas for the quick and accurate reply. Precisely what I needed. :D
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby tolas » Tue Nov 17, 2009 7:51 pm

achie1266 wrote:
tolas wrote:NOTE: This is the most basic example. If you have nested elements inside of "blah" this will also pick up those elements character data. If you have nested "blah" elements inside of each other, this most likely will not produce the result you want as it will stop buffering at the end of the inner "blah". But this is a good foundation to start with.


Thank you Tolas.

That worked perfect after I did necessary modifications.
this is what I have done.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import org.xml.sax.Attributes;
  2. import org.xml.sax.SAXException;
  3. import org.xml.sax.helpers.DefaultHandler;
  4.  
  5. import android.util.Log;
  6.  
  7. public class MyHandler extends DefaultHandler{
  8.        
  9.         private int count = 0;
  10.         private int timerCount = 0;
  11.        
  12.         private boolean inRootElement = false;
  13.         private boolean inObject = false;
  14.         private boolean inId= false;
  15.         private boolean inName = false;
  16.        
  17.         StringBuffer buffer = null;
  18.         boolean buffering = false;
  19.        
  20.         private MyObject object;
  21.        
  22.         private MyDbAdapter adapter;
  23.        
  24.         public MyHandler(MyDbAdapter adapter){
  25.                 this.adapter = adapter;
  26.         }
  27.        
  28.         @Override
  29.         public void startDocument() throws SAXException{
  30.                 this.object = new MyObject();
  31.         }
  32.        
  33.         @Override
  34.         public void endDocument() throws SAXException{
  35.  
  36.         }
  37.  
  38.         @Override
  39.         public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
  40.                 if(localName.equalsIgnoreCase("root_element")){
  41.                         this.inRootElement = true;
  42.                 }else if (localName.equalsIgnoreCase("object")){
  43.                         this.inObject = true;
  44.                 }else if (localName.equalsIgnoreCase("id")){
  45.                         buffer = new StringBuffer("");
  46.                         this.inId = true;
  47.                 }else if (localName.equalsIgnoreCase("name")){
  48.                         buffer = new StringBuffer("");
  49.                         this.inName = true;
  50.                 }
  51.         }
  52.        
  53.         @Override
  54.         public void endElement(String uri, String localName, String qName) throws SAXException{
  55.                 if (localName.equalsIgnoreCase("root_element")){
  56.                         this.inRootElement = false;
  57.                 }else if (localName.equalsIgnoreCase("object")){
  58.                         adapter.addMyObject(object);
  59.                         this.inObject = false;
  60.                 }else if (localName.equalsIgnoreCase("id")){
  61.                         this.inId = false;
  62.                 }else if (localName.equalsIgnoreCase("name")){
  63.                         this.inName = false;
  64.                 }
  65.         }
  66.        
  67.         @Override
  68.         public void characters(char ch[], int start, int length){
  69.                 if(this.inRootElement){
  70.                 }
  71.                 if(this.inObject){
  72.                 }
  73.                 if(this.inId){
  74.                         String idFromXml = buffer.append(ch, start, length).toString();
  75.                         int i = -1;
  76.                         if(idFromXml.trim().length()>0)
  77.                                 i = Integer.parseInt(idFromXml.trim());
  78.                         object.setId(i);
  79.                 }
  80.                 if(this.inName){
  81.                         String nameFromXml = buffer.append(ch, start, length).toString();
  82.                         object.setName(nameFromXml);
  83.                 }
  84.         }
  85. }
  86.  
Parsed in 0.047 seconds, using GeSHi 1.0.8.4

My Sample XML
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <root_element>
  3. <object>
  4.   <id>1</id>
  5.   <name>First Object Name</name>
  6. </object>
  7. <object>
  8.   <id>2</id>
  9.   <name>Second Object Name</name>
  10. </object>
  11. </root_element>
  12.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


I have not checked the syntax of this java file as I have modified it a little to remove my project specific names. But I hope this will help anyone out there like me. Please let me know if I have done any mistakes or if it can be done in a better way.

Thanks again Tolas for the quick and accurate reply. Precisely what I needed. :D



Note quite right. It happens to be working with your sample XML because the id and name fields are so short there aren't multiple buffered calls to characters(..).

Doing this in your characters(..) method is just the same as setting it to a string there (your not really doing anything by buffering it into StringBuffer.

Wrong:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.           if(this.inId){
  2.                         String idFromXml = buffer.append(ch, start, length).toString();
  3.                         int i = -1;
  4.                         if(idFromXml.trim().length()>0)
  5.                                 i = Integer.parseInt(idFromXml.trim());
  6.                         object.setId(i);
  7.                 }
  8.  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4



To be correct in all cases, your characters(..) method would only have this part of the code
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.           if(this.inId){
  2.                         buffer.append(ch, start, length).toString();
  3.                 }
  4.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


Now, if there are multiple calls to characters(..) within the same text data, you will buffer all of them.


Then, in your endElement(..) method, you will add the buffer.toString() functionality. This guarantees that the buffer has all the possible text content you are looking for.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.            else if (localName.equalsIgnoreCase("id")){
  2.                         this.inId = false;
  3.                         String idFromXml = buffer.toString();
  4.                         int i = -1;
  5.                         if(idFromXml.trim().length()>0)
  6.                                 i = Integer.parseInt(idFromXml.trim());
  7.                         object.setId(i);
  8.                 }
  9.  
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


Do the same of "name" and you're all set.

Hope that makes sense.
tolas
Freshman
Freshman
 
Posts: 3
Joined: Tue Nov 17, 2009 6:21 am

Postby achie1266 » Tue Nov 17, 2009 9:17 pm

yes it makes sense. I should have taken care of that in the first place.

Thanks for pointing it out.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby beko » Tue Nov 24, 2009 11:41 pm

Hi droid friends..
i read lot of sax parsing threads but still no success because of my xml's encoding..
when i replace ISO-8859-X with UTF-8, works like a charm but cant replace encoding of the the xml because its public.
if i append the xml to a stringbuffer then replace the encoding; parser can parse it but takes ages..
what should i do now ? please help..
beko
Freshman
Freshman
 
Posts: 2
Joined: Tue Nov 24, 2009 11:32 pm

Top
PreviousNext

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests