Hi,

   I wrote the following  program and gave it the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<test>
  <doc>&#8220;Here</doc>
</test>

   It seems to me that &#8220; should be a left double quote, but Java
interprets it as ? as before. Here is the output:

shelby $ java -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser ShowChar 
test.xml 

  
?
Here


shelby$ 

   Since the encoding is UTF-8, it seems to me that the value of the
character should be something besides ?. Any ideas on how to correct
this problem?

Thank you,
Elizabeth

import org.xml.sax.helpers.XMLReaderAdapter;
import org.xml.sax.SAXException;
import java.io.IOException;
import org.apache.xerces.parsers.SAXParser;
import java.io.UnsupportedEncodingException;

class ShowChar extends XMLReaderAdapter {
  public ShowChar() throws SAXException {
    super();
  }

  public void characters(char[] ch, int start, int length) throws SAXException {
    for(int i = 0; i < length; i++) {
      System.out.print(ch[i + start]);
    }
    System.out.println("");
  }

  public static void main(String[] args) {
    try {
      ShowChar s = new ShowChar();
      for(int i = 0; i < args.length; i++) {
        try {
          s.parse(args[i]);
        } catch(IOException e) {
        } catch(SAXException e) {
        }
      }
    } catch(SAXException e) {
      e.printStackTrace();
    }
  }
};

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to