Characters method in SAX parser

Hi
I have a SAX Parser Appln where in I am trying to run it in English Locale But the xml file contains Arabic Characters.
The method characters looks like this
public void characters(char buf[], int offset, int len) throws SAXException
if (recognisedTopElementStarted && storyStarted && recognisedElementStarted )
buffer.append ( new String(buf,offset,len) ) ;
//buffer.append ( new String(buf,offset,len,"UTF-16") ) ;
In this method I want to convert the char array to byte array so as to specify the encoding for constructing a String object(Arabic characters) with correct encoding as specified in the commented statement.
How to do it so as to get the arabic characters
Thanks
Raj

Hi Raj,
I don't have Arabic support on my machine, so I tried with Greek, which has a significant Unicode code page.
To get a byte array, I did this:
byte[] ba = new String(buf, offset, len).getBytes("utf-16");To double check, I saved the byte array in a file output stream and validated the encoding in XML Spy.
So it works for Greek, let's hope it will work for our friends across the Mediterranean sea ;-)
Regards,
David

Similar Messages

  • Can i check for invalid chars inside characters () method

    Hi There
    Cani check for invalid charcaters inside characters() method of SAX api so as to take care of invalid charactrers that mey come up while parsing an xml file from the internet
    Thanks
    Mum

    Hi DrClap
    Thanks for responding.But i have no control on the encoding of the xml file that is coming to me
    So i will be thankful to u if u could just tell me if there is any way in which i can change the encoding format used for parsing the xml file so my parsing process reaches its logical end
    Thanks
    Mumtaz

  • SAX Parser method charaters trouble

    Hi,
    I am using a sax parser for loading an xml file of size over 1gb. The problem whats happening is that the content gets truncated at random.
    And this truncation happens in the characters method of the sax parser. This am sure as I logged the content I get from characters method before starting my processing. for ex:
    <content>signal1,signal960</content>
    <content>signal1,signal970</content>
    On parsing the above snippet, the first content "signal1,signal960"
    gets extracted completely, however the next one is truncated, and the truncation is random. This happens for some tags, and then the extraction resumes normally. And this truncation starts occuring again after it has extracted a few tags.
    Also the first truncation started occuring only after parsing around 200 mb of the 1gb file.
    Could anyone tell if there is some limitation with XERCES or CRIMSON.
    or if any other one that I can use???
    Regards,
    R.

    To quote from the Documentation of ContentHandler.characters:
    -- start quote --
    The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.
    -- end quote --
    So providing the content in two seperate calls is perfectly valid and must be handled by your code. It's probably a result of the internal workings of the XML parser and allowing that in the Parser specification probably allowed some optimizations that would otherwise be impossible (a constant buffer size, for example).

  • Problem with SAX characters method

    Well I already used SAX on couple occasions, and there was no problems. But this time I have weird situation. characters method from handler class (SAX parser) does not handle XML element at once, but in two passes. For example:
    <some>this is some text</some>is handled by calling characters method TWICE (e.g. 'this is' and 'some text'). Is this normal behavior, or I do not form XML file properly? If it is normal, can anyone tell me how to detect this behavior?
    Every help is appreciated. Cheers!
    Message was edited by:
    zly

    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPSAX3.html
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4316794
    http://forum.java.sun.com/thread.jspa?threadID=5130656&tstart=0

  • Xerces SAX parser don`t initialize a characters array

    Xerces SAX parser don`t initialize a characters array from characters() method in DefaultHandler.
    I use jdk 1.5.12.
    For value "22-11-2009" variables start=1991, length=9.
    Result: "22-11-200"

    My handler:
    package com.epam.xmltask.parsers;
    import com.epam.xmltask.model.Category;
    import com.epam.xmltask.model.Goods;
    import com.epam.xmltask.model.Products;
    import com.epam.xmltask.model.Subcategory;
    import com.epam.xmltask.utils.Constants;
    import com.epam.xmltask.utils.DateConverter;
    import java.text.ParseException;
    import java.util.Date;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.helpers.DefaultHandler;
    public class SAXProductsParser extends DefaultHandler implements IProductsParser {
        private Logger logger = null;
        private SAXParser parser = null;
        private ErrorHandler errorHandler = null;
        private Products products = null;
        private Category category = null;
        private Subcategory subcategory = null;
        private Goods goods = null;
        private String currentField = Constants.EMPTY_STRING;
        protected Logger getLogger() {
            if (logger == null) {
                logger = Logger.getLogger(SAXProductsParser.class.getName());
            return logger;
        protected SAXParser getParser() throws Exception {
            if (parser == null) {
                try {
                    SAXParserFactory parserFactory = SAXParserFactory.newInstance();
                    parserFactory.setNamespaceAware(true);
                    parserFactory.setValidating(true);
                    parser = parserFactory.newSAXParser();
                    parser.setProperty(Constants.SCHEMA_LANGUAGE, Constants.XML_SCHEMA);
                } catch (Exception ex) {
                    getLogger().log(Level.SEVERE, null, ex);
                    throw ex;
            return parser;
        public ErrorHandler getErrorHandler() {
            if (errorHandler == null) {
                errorHandler = new ProductsErrorHandler();
            return errorHandler;
        public Products getProducts(String uri) throws Exception {
            try {
                products = new Products();
                getParser().parse(uri, this);
                return products;
            } catch (Exception ex) {
                getLogger().log(Level.SEVERE, null, ex);
                throw ex;
        @Override
        public void startElement(String uri, String localName,
                String qName, Attributes attributes) {
            if (Constants.CATEGORY.equals(qName)) {
                String name = attributes.getValue(Constants.NAME);
                category = new Category(name);
            } else if (Constants.SUBCATEGORY.equals(qName)) {
                String name = attributes.getValue(Constants.NAME);
                subcategory = new Subcategory(name);
            } else if (Constants.GOODS.equals(qName)) {
                String name = attributes.getValue(Constants.NAME);
                goods = new Goods(name);
            } else if (Constants.NOT_IN_STOCK.equals(qName)) {
                goods.setIsInStock(false);
            } else {
                currentField = qName;
        @Override
        public void endElement(String uri, String localName, String qName) {
            if (Constants.CATEGORY.equals(qName)) {
                products.addCategory(category);
                category = null;
            } else if (Constants.SUBCATEGORY.equals(qName)) {
                category.addSubcategory(subcategory);
                subcategory = null;
            } else if (Constants.GOODS.equals(qName)) {
                subcategory.addGoods(goods);
                goods = null;
            } else {
                currentField = Constants.EMPTY_STRING;
        @Override
        public void characters(char[] chars, int start, int length) throws SAXException {
            String field = new String(chars, start, length).trim();
            if (goods != null) {
                if (Constants.PRODUSER.equals(currentField)) {
                    goods.setProducer(field);
                } else if (Constants.MODEL.equals(currentField)) {
                    goods.setModel(field);
                } else if (Constants.DATE_OF_ISSUE.equals(currentField)) {
                    Date date = null;
                    try {
                        date = DateConverter.getConvertedDate(field);
                    } catch (ParseException ex) {
                        getLogger().log(Level.SEVERE, null, ex);
                        throw new SAXException(ex);
                    goods.setDateOfIssue(date);
                } else if (Constants.COLOR.equals(currentField)) {
                    goods.setColor(field);
                } else if (Constants.PRICE.equals(currentField)) {
                    Float price = Float.valueOf(field);
                    goods.setPrice(price);
        @Override
        public void error(SAXParseException ex) throws SAXException {
            getErrorHandler().error(ex);
        @Override
        public void fatalError(SAXParseException ex) throws SAXException {
            getErrorHandler().fatalError(ex);
        @Override
        public void warning(SAXParseException ex) throws SAXException {
            getErrorHandler().warning(ex);
    }

  • SAX-ContentHandler -characters methods gets wrong int end sometimes

    Hi
    I am having problems with SAX-ContentHandler -characters methods. It gets wrong int end values time to time ---means that it chops up my strings when it reads large XML files.
    Is there any way to correct it? Any suggestions will be very helpful. Thank you.
    My code is below.
    public class MyContentHandlerDemo extends Thread implements ContentHandler{
    private ArrayList hitList = new ArrayList(1000);
    private ArrayList hitId = new ArrayList(1000);
    private ArrayList hspNum = new ArrayList(1000);
    private ArrayList hitLength = new ArrayList(1000);
    private ArrayList queryFrom = new ArrayList(1000);
    private ArrayList hspith = new ArrayList(1000);
    private ArrayList idith = new ArrayList(1000);
    private String localname;
    private Locator locator;
    private int know=1;
    private int knowid=1;
    private int knowlength=1;
    private int knowhitlength=1;
    private int knowhspnum=1;
    private int knowhspnumadd=1;
    private int knowhspnumlength=1;
    private int knowquery=1;
    private int knowqueryfrom=1;
    private int processon =1;
    private int processcount = 0;
    private int hspithnum=0;
    private int idithnum=0;
    String allstr;
    String addseq;
    char [] allchar;
    int icount=0;
    int lengthsum=0;
    public synchronized void setDocumentLocator(Locator locator) {
    System.out.println(" * setDocumentLocator() called");
    // We save this for later use if desired.
    this.locator = locator;
    public synchronized void startDocument() throws SAXException {
    System.out.println("Parsing begins...");
    public synchronized void endDocument() throws SAXException {
    try {
    FileOutputStream outputfileDemo;
    PrintStream printoutDemo;
    outputfileDemo= new FileOutputStream("apoe500.fasta");
    printoutDemo=new PrintStream(outputfileDemo);
    FileOutputStream reSaxfile;
    PrintStream printoutReSax;
    reSaxfile= new FileOutputStream("reSax.txt");
    printoutReSax=new PrintStream(reSaxfile);
    int m = hitList.size();
    for (int k=0; k < m; k++) {
    int comp = (((hitList.get(k)).toString()).length());
    String strComp = Integer.toString(comp);
    String hitleng = (hitLength.get(k)).toString();
    if(strComp.compareTo(hitleng)!=0)
    {System.out.println("Warning: Length is different at hit number (-1) " + hitId.get(k));}
    for (int l=0; l < hspith.size(); l++){
    printoutReSax.println((hspith.get(l)).toString());
    outputfileDemo.close();
    printoutDemo.close();
    reSaxfile.close();
    printoutReSax.close();
    } catch (IOException e) {
    System.out.println("IOException errors");
    System.out.println("...Parsing ends.");
    public synchronized void processingInstruction(String target, String data)
    throws SAXException {
    //System.out.println("PI: Target:" + target + " and Data:" + data);
    public synchronized void startPrefixMapping(String prefix, String uri) {
    //System.out.println("Mapping starts for prefix " + prefix +
    // " mapped to URI " + uri);
    public synchronized void endPrefixMapping(String prefix) {
    //System.out.println("Mapping ends for prefix " + prefix);
    public synchronized void startElement(String namespaceURI, String localName,
    String rawName, Attributes atts)
    throws SAXException {
    localname =localName;
    int which =100;
    if (localname.equals("Hit_id")) {which = 0;}
    if (localname.equals("Hsp_num")) {which = 1;}
    if (localname.equals("Hsp_hseq")) {which = 2;}
    if (localname.equals("Hsp_align-len")) {which =3;}
    if (localname.equals("Hsp_query-from")) {which =4;}
    switch (which){
    case 0: knowid=0;
    //icount=icount+1;
    break;
    case 1: knowhspnum=0;icount=icount+1;
    break;
    case 2: know=0; //icount=icount+1;
    break;
    case 3: knowlength=0; //icount=icount+1;
    break;
    case 4: knowquery=0; //icount=icount+1;
    break;
    default: knowid=1; know=1; knowlength=1; knowhspnum=1;knowhitlength=1;knowquery=1;
    public synchronized void endElement(String namespaceURI, String localName,
    String rawName)
    throws SAXException {
    //System.out.println("endElement: " + localName + "\n");
    public synchronized void characters(char[] ch, int start, int end)
    throws SAXException {
    String s = new String(ch, start, end);
    int process=100;
    if (knowid==0) {process=0;}
    if (knowhspnum==0){process=1;}
    if (know==0) {process=2;}
    if (knowlength==0) {process=3;}
    if(knowquery==0){process=4;}
    switch(process){
    case 0:
    idithnum = idithnum+1;
    //int start1 = start;
    //int end1 = end;
    //char [] datahold1 = new char[end1];
    //for (int i=0;i<end1;i++){
    //datahold1=ch[start1+i];
    //warn if the length is differernt
    int n=s.length();
    allchar = new char[n+1];
    allchar[0] = '>';
    for (int i=0; i<n; i++){
    allchar[i+1]=s.charAt(i);
    allstr = new String(allchar);
    hitId.add(allstr);
    knowid=1;
    processon=1;
    break;
    case 1:
    hspNum.add(s);
    if ((s.compareTo(Integer.toString(1)))!=0){
    String hspallstr = new String (allstr.concat(s));
    hitId.add(hspallstr);
    knowhspnum=1;
    processon=1;
    break;
    case 2:
    hitList.add(s);
    know=1;
    processon=1;
    break;
    case 3:
    hitLength.add(s);
    knowlength=1;
    processon=1;
    break;
    case 4:
    queryFrom.add(s);
    knowquery=1;
    processon=1;
    break;
    default: processon=0;
    public synchronized void ignorableWhitespace(char[] ch, int start, int end)
    throws SAXException {
    String s = new String(ch, start, end);
    public synchronized void skippedEntity(String name) throws SAXException {

    I put some more codes in characters(). Then I got OutOfMemory: Java Heap Error.
    I probably have to write something in startElement() to limit input for characters() method.
    Could anyone help me? I need to limit inputs for charactes() in startElement().
    I added some codes in characters() method
    public synchronized void characters(char[] ch, int start, int end)
            throws SAXException {
            String s;
            StringBuffer stringbuf1;
            String finalstring1;
            int process=100;
            if (knowid==0) {process=0;}
            if (knowhspnum==0){process=1;}
            if (know==0) {process=2;}
            if (knowlength==0) {process=3;}
            if(knowquery==0){process=4;}
            switch(process){
            case 0:
            //s = new String(ch, start, end);
            idithnum = idithnum+1;
            //int start1 = start;
            //int end1 = end;
            //char [] datahold1 = new char[end1];
            stringbuf1 = new StringBuffer();
            while(ch!=null){
            stringbuf1.append(ch);   
            finalstring1 = stringbuf1.toString();
            //warn if the length is differernt
            int n=finalstring1.length();
            allchar = new char[n+1];
            allchar[0] = '>';
            for (int i=0; i<n; i++){
            allchar[i+1]=finalstring1.charAt(i);
            allstr = new String(allchar);
            hitId.add(allstr);
            knowid=1;
            processon=1;
            break;
            case 1:
            //s = new String(ch, start, end);
            stringbuf1 = new StringBuffer();
            while(ch!=null){
            stringbuf1.append(ch);   
            finalstring1 = stringbuf1.toString();
            hspNum.add(finalstring1);
            if ((finalstring1.compareTo(Integer.toString(1)))!=0){
            String hspallstr = new String (allstr.concat(finalstring1));
            hitId.add(hspallstr);
            //System.out.println(allstr);
            knowhspnum=1;
            processon=1;
            break;
            case 2:
            //s = new String(ch, start, end);
            //int lengthend=end;
            stringbuf1 = new StringBuffer();
            while(ch!=null){
            stringbuf1.append(ch);   
            finalstring1 = stringbuf1.toString();
            checklength:
            while(know==0){
            if(lengthend!=new Integer((hitLength.get(hitLength.size()-1)).toString())){
            String s1=new String(ch, start, end);
            s = (((hitList.get((hitList.size())-1)).toString()).concat(s1));
            hitList.add(s);know=1;
            break;
            hitList.add(finalstring1);
            processon=1;
            break;
            case 3:
            //s = new String(ch, start, end);
            stringbuf1 = new StringBuffer();
            while(ch!=null){
            stringbuf1.append(ch);   
            finalstring1 = stringbuf1.toString();
            hitLength.add(finalstring1);
            knowlength=1;
            processon=1;
            break;
            case 4:
            //s = new String(ch, start, end);
            stringbuf1 = new StringBuffer();
            while(ch!=null){
            stringbuf1.append(ch);   
            finalstring1 = stringbuf1.toString();
            queryFrom.add(finalstring1);
            knowquery=1;
            processon=1;
            break;
            default: processon=0;

  • SAX Parser is dropping characters

    Hello,
    We have noticed that the BEA implementation of the SAX parser appears
    to drop characters from the start of an attribute's value.
    For example:
    <attribute-value>au.com.bonline.bean.SomeClass</attribute-value>
    becomes
    online.bean.SomeClass
    after parsing.
    Has anyone seen this behaviour before ?
    Previously we were running the application under tomcat and did not have
    this issue with the implementation of the SAX parser that comes with
    tomcat.
    Are there changes we have to make to the way we code against the
    SAX parser that we might have missed moving from tomcat to BEA ?
    Thankyou,
    Brian Gorrie
    Programmer/Analyst
    B Digital

    Hi Brian,
    I just tried this simple program with the output below; it worked OK
    using WLS 8.1
    What WLS version and can you provide a test case?
    Thanks,
    Bruce
    C:\stephens\CRs\crXML>type attr.xml
    <?foo version="1.0" ?>
    <A>
    <attribute-value>au.com.bonline.bean.SomeClass</attribute-value>
    </A>
    C:\stephens\CRs\crXML>java -classpath .;%CLASSPATH% sax attr.xml
    Start document
    Processing Instruction:
    target: foo
    data: version="1.0"
    Start element: A
    Characters: "\n"
    Start element: attribute-value
    Characters: "au.com.bonline.bean.SomeClass"
    End element: attribute-value
    Characters: " \n"
    End element: A
    End document
    Brian Gorrie wrote:
    >
    Hello,
    We have noticed that the BEA implementation of the SAX parser appears
    to drop characters from the start of an attribute's value.
    For example:
    <attribute-value>au.com.bonline.bean.SomeClass</attribute-value>
    becomes
    online.bean.SomeClass
    after parsing.
    Has anyone seen this behaviour before ?
    Previously we were running the application under tomcat and did not have
    this issue with the implementation of the SAX parser that comes with
    tomcat.
    Are there changes we have to make to the way we code against the
    SAX parser that we might have missed moving from tomcat to BEA ?
    Thankyou,
    Brian Gorrie
    Programmer/Analyst
    B Digital[sax.java]

  • SAX parser getValue() method

    All,
    Whever i get the attribute value using getValue() method , it returns me the result with the lower case string
    for example if i have something like this
    <input label="Last Name:" />
    and i try to get the attribute value of label
    String label = attrs.getValue("label");
    The result will be
    label = "last name"
    It doesnot adhere with the case (it returns the value by converting it into lower case)
    Is it something that i am doing wrong , or its the way SAX parser internally does it.
    I am using the SAX parser which comes with the BlackBerry JDE.
    Any answers , pointers will be helpful

    Never mind , my input to the SAX parser itself is somehow getting all lower case.
    Thanks!

  • Getting characters in a particular xml tag type during Sax parsing.

    How do I get the text within a certain XML tag using the parser. I can use the parser which will get me all the text in all the tags, but how do I get the ones I need only.
    For example:
    <channel id="south-east.bbc1.bbc.co.uk">
        <display-name lang="en">BBC1</display-name>
        <display-name>1</display-name>
      </channel>
      <programme start="20040217233500" stop="20040218000500 +0000" channel="south-east.bbc1.bbc.co.uk">
        <title lang="en">Film 2004 with Jonathan Ross</title>
      </programme>how do I get the text 'Film 2004 with Jonathan Ross' without getting the others?

    Well, the SAX parser just gives you the start/end tag
    information to a handler, right? So if you just use
    the SAX parser to get one item, then you could do it
    by running thru the entire XML file to get that item
    then get another item. Clearly this isn't the best
    way to do it.... The handler should put the data for
    the whole document into some data structure, or use
    DocumentBuilder to get a Document object. I see. Yes, that is not the way to use SAX. It's kind of an inside out way of doing things. If you using SAX you should know everything that you want before parsing and grab all of them in one fell swoop.
    If you want to get an in memory representation, the JDOM package is a whole lot eaiser to use than DOM.

  • How to deal with empty tags in a SAX Parser

    Hi,
    I hope someone can help me with the problem I am having!
    Basically, I have written an xml-editor application. When an XML file is selected, I parse the file with a SAX parser and save the start and end locations of all the tags and character data. This enables me to display the xml file with the tags all nicely formatted with pretty colours. Truly it is a Joy To Behold. However, I have a problem with tags in this form:
    <package name="boo"/>
    because the SAX parser treats them like this:
    <package name = boo>
    </package>
    for various complex reasons the latter is unaccetable so my question is: Is there some fiendishly clever method to detect tags of this type as they occur, so that I can treat them accordingly?
    Thanks,
    Chris

    I have spent some time on googling for code doing this, but found nothing better, than I had to write in by myself.
    So, it would be something like this. Enjoy :)
    package comd;
    import org.xml.sax.helpers.DefaultHandler;
    import org.xml.sax.SAXException;
    import org.xml.sax.Attributes;
    import java.util.Stack;
    import java.util.Enumeration;
    public class EmptyTagsHandler extends DefaultHandler {
         private StringBuilder xmlBuilder;
         private Stack<XmlElement> elementStack;
         private String processedXml;
         private class XmlElement{
              private String name;
              private boolean isEmpty = true;
              public XmlElement(String name) {
                   this.name = name;
              public void setNotEmpty(){
                   isEmpty = false;
         public EmptyTagsHandler(){
              xmlBuilder = new StringBuilder();
              elementStack = new Stack();
         private String getElementXPath(){
              StringBuilder builder = new StringBuilder();
              for (Enumeration en=elementStack.elements();en.hasMoreElements();){
                   builder.append(en.nextElement());
                   builder.append("/");
              return builder.toString();
         public String getXml(){
              return processedXml;
         public void startDocument() throws SAXException {
              xmlBuilder = new StringBuilder();
              elementStack.clear();
              processedXml = null;
         public void endDocument() throws SAXException {
              processedXml = xmlBuilder.toString();
         public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
              if (!elementStack.empty()) {
                   XmlElement elem = elementStack.peek();
                   elem.setNotEmpty();
              xmlBuilder.append("<");
              xmlBuilder.append(qName);
              for (int i=0; i<attributes.getLength();i++){
                   xmlBuilder.append(" ");
                   xmlBuilder.append(attributes.getQName(i));
                   xmlBuilder.append("=");
                   xmlBuilder.append(attributes.getValue(i));
              xmlBuilder.append(">");
              elementStack.push(new XmlElement(qName));
         public void endElement(String uri, String localName, String qName) throws SAXException {
              XmlElement elem = elementStack.peek();
              if (elem.isEmpty) {
                   xmlBuilder.insert(xmlBuilder.length()-1, "/");
              } else {
                   xmlBuilder.append("</");
                   xmlBuilder.append(qName);
                   xmlBuilder.append(">");
              elementStack.pop();
         public void characters(char ch[], int start, int length) throws SAXException {
              if (!elementStack.empty()) {
                   XmlElement elem = elementStack.peek();
                   elem.setNotEmpty();
              String str = new String(ch, start, length);
              xmlBuilder.append(str);
         public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
              String str = new String(ch, start, length);
              xmlBuilder.append(str);
    }

  • Why are all the events in the XML SAX parser not activated?

    Hi everyone,
    I have written a mini server that parses XML files into SQL queries.
    Below is a segment of my code;
              try          {                                                       
                   Class.forName( JDBC_DRIVER );
                   myConnection = DriverManager.getConnection( DATABASE_URL, "username", "password");                                                  
                   EventXMLParser myEXP = new EventXMLParser(directory, myConnection);
                   File[] xmlFiles = directory.listFiles();
                   for (File xmlFile : xmlFiles)               {     
                        myEXP.XMLtoDB(xmlFile);
                        outWriter.println("File:" + xmlFile.getName() + " DONE");
              } catch (SQLException e)     {
                   System.err.println("SQLException for establishing connection");
                   e.printStackTrace();
              } catch (ClassNotFoundException e)     {
                   System.err.println("CLASS NOT FOUND EXCEPTION HERE");
                   e.printStackTrace();
              } catch (Exception e)     {
                   System.err.println(e);
                   e.printStackTrace();
              finally {
                   outWriter.println("PARSING COMPLETED");
                   outWriter.close();
         }Where the constructor EventXMLParser constructs the following:
         public EventXMLParser(File path, Connection connection)     {
              super();
              try     {
                   this.XMLpath = path;
                   this.db_connection = connection;
                   this.xr = XMLReaderFactory.createXMLReader();
                   this.XMLSAXhandler  = new DefaultHandler(); //create a new own handler
                   this.xr.setContentHandler(XMLSAXhandler);
                   this.xr.setErrorHandler(XMLSAXhandler);
                   //System.out.println("DEBUG: db_connection is " + db_connection.toString());
              catch (Exception e)     {
                   System.out.println("Constructor Error!");
                   e.printStackTrace();
         }Below are all my helper methods within EventXMLParser.java
         public void XMLtoDB(String XMLpath) throws Exception  {
              try     {
                   //Input
                   System.out.println("XMLpath is : " + XMLpath);
                   /*FileReader r = new FileReader(XMLpath); debug
                   InputSource in = new InputSource(r);
                   xr.parse(in);
                   xr.parse(XMLpath);
                   /* Note that while parsing, the end of each event, </event>
                    * will trigger sendSQL to execute the query on the database
              catch (Exception e)     {
                   throw new Exception("Error with XMLtoDB!! Exception: " + e);
         public void sendSQL(Event event, Connection sql_connection) throws SQLException     {
                   //JDBC part
                   try     {
                        System.err.println("DEBUG sendSQL");
                        Statement sql_statement = sql_connection.createStatement();
                        ResultSet resultSet = sql_statement.executeQuery( event.toSQL() );
                   catch (SQLException e)     {
                        e.printStackTrace();
         /* Parsing XML
          * From here onwards it's all designed for the SAX Parsing with different event calling methods
         public void startDocument()     {
              System.err.println("Start Document");
         public void endDocument()     {
              System.err.println("End Document");
         public void startElement(String uri, String name, String qName, Attributes atts)     {
              CurrentElement= name;
              System.out.println("This is parsing");
         public void characters(char ch[], int start, int length)     {
              SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
              StringBuffer sb = new StringBuffer();
              for (int i = start; i < start + length; i++)     
                   sb.append(ch);
              String content = sb.toString();
              if (CurrentElement.equals("eid"))
                   temp.setEventID( (Integer.valueOf(content)).intValue() ) ;
              else if (CurrentElement.equals("sd"))
                   temp.setShort_description(content);
              else if (CurrentElement.equals("ld"))
                   temp.setLong_description(content);
              else if ( (CurrentElement.equals("dt")))
                   temp.setDate_Time( formatter.parse(content, new ParsePosition(0)) );
              else if (CurrentElement.equals("repeat"))
                   temp.setRepeat_pattern( (Integer.valueOf(content)).intValue() );
              else if (CurrentElement.equals("valid"))
                   temp.setValid_period(content);
              else if (CurrentElement.equals("status"))     {
                   temp.setStatus( (Integer.valueOf(content)).intValue() );
              else {}
         public void endElement(String uri, String name, String qName)     {
              System.err.println("DEBUG" + temp.toString()); /*debug*/
              if (name.equals("event"))     {
                   try     {
                        /*debug*/ temp.setUserID(1);
                        /*debug*/ System.err.println("DEBUG: " + temp.toString());
                        sendSQL(temp, db_connection);
                        //temp = new Event();
                   catch (SQLException e)     {
                        System.err.println(e);
                   }//end catch
              }//end try
    Where event is a public class Event     {
         //fields
         private int userID = 1; // = 1 only applies for testing
         private int eventID;
         private String short_description;
         private String long_description;
         private Date date_time = null;
         private int repeat_pattern;
         private String valid_period;
         private int status;     //1 for new, 0 for modification and -1 for delete
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
         //Constructors
         //every event requires the following: userID eventID and short_Description
         public Event(int uID, int eID, String shortDescrp)     {
              setUserID(uID);
              setEventID(eID);
              setShort_description(shortDescrp);
         public Event(int uid, int eid, String sd,
                                  String ld, Date d_t, int r_p, String v_p, int s)     {
              setUserID(uid);
              setEventID(eid);
              setShort_description(sd);
              setLong_description(ld);
              setDate_Time(d_t);
              setRepeat_pattern(r_p);
              setValid_period(v_p);
              setStatus(s);
         //set
         public void setUserID (int x)                         { this.userID = x ;}
         public void setEventID (int x)                         { this.eventID = x ;}
         public void setShort_description (String x)          { this.short_description = x ;}
         public void setLong_description (String x)          { this.long_description = x ;}
         public void setDate_Time(Date x)                    { this.date_time = x ;}
         public void setRepeat_pattern (int x)               { this.repeat_pattern = x ;}
         public void setValid_period (String x)               { this.valid_period = x ;}
         public void setStatus (int x)                         { this.status = x; }
         //get
         public int           getUserID()                              { return this.userID;}
         public int           getEventID()                         { return this.eventID;}
         public String      getShort_description()               { return this.short_description;}
         public String      getLong_description()               { return this.long_description;}
         public Date        getDate_Time()                         { return this.date_time;}
         public int         getRepeat_pattern()                    { return this.repeat_pattern;}
         public String      getValid_period()                    { return this.valid_period;}
         public int           getStatus()                              { return this.status; }
         //Event to SQL statements;
         public String toSQL()     {
              StringBuffer sb = new StringBuffer();
              ///if ( status == 1)     {
                   sb.append( "INSERT INTO events SET" );
                   sb.append( " userID = " + userID + ", ");
                   sb.append( "eventID = " + eventID + ", " );
                   sb.append( "short_description = " + "\'" + short_description + "\'" + ", "); //String
                   sb.append( "long_description = " + "\'" + long_description + "\'"  + ", "); //String
                   sb.append( "date_time = " + "\'" + formatter.format(date_time) + "\'" + ", ");
                   sb.append( "repeat_pattern = " + repeat_pattern + ", " );
                   sb.append( "valid_period = " + "\'" + valid_period + "\'" ); //String
                   sb.append( ";");
              //} else if ( status == 2)      {
              System.err.println(sb.toString());
              return sb.toString();
    }     My question is: I have taken my SQL query generated by toSQL() method in events and it worked.
    Here is the funny thing:
    Everything is correct syntax wise: No complaints what soever
    The mysql part works: Tested separately.
    So I tend to think that the problem lies within the SAX parser. I have written SAX2 parsers on this machine before and they have worked too. I tried inserting println statements all over startElement endElement etc etc only to find out that the SAX parser did not call any of the methods that I overided!! Why is that so?
    Can you guys spot where my SAX parser fails?

    I see.
    I try to correct this problem by removing super();
    so right now my code looks like this:
         static Event temp = new Event(0, 0, "null", "null", new Date(), 0, "null", 0);
         static String CurrentElement = null;
         static File XMLpath;
         static Connection db_connection;
         static XMLReader xr;
         static DefaultHandler XMLSAXhandler; 
         //Constructor,      Build the SAX Parser
         public EventXMLParser(File path, Connection connection)     {
              try     {
                   this.XMLpath = path;
                   this.db_connection = connection;
                   this.xr = XMLReaderFactory.createXMLReader();
                   this.XMLSAXhandler  = new DefaultHandler(); //create a new own handler
                   this.xr.setContentHandler(XMLSAXhandler);
                   this.xr.setErrorHandler(XMLSAXhandler);
                   //System.out.println("DEBUG: db_connection is " + db_connection.toString());
              catch (Exception e)     {
                   System.out.println("Constructor Error!");
                   e.printStackTrace();
         }This time, I created a new instance of default handler() which can be referenced by as the objects's XMLSAXhandler. However, that did not solve the problem, why does the problem still persist?
    Right now, there is only one instance of a default handler created. So why does all my parsing event functions still get ignored?

  • Read any XML File Elements using SAX Parser in J2se

    Hi All
    I can able to parsed one structured XML file using SAX
    Sample code :
    // ===========================================================
         // SAX DocumentHandler methods
         // ===========================================================
         public void startDocument() throws SAXException {
              logger.info("Start of document");
         public void endDocument() throws SAXException {
              logger.info("End of document");
         public void startElement(String namespaceURI, String localName, // local
                   // name
                   String qualName, // qualified name
                   Attributes attrs) throws SAXException {
              elemName = new String(localName); // element name
              if (elemName.equals(""))
                   elemName = new String(qualName); // namespaceAware = false
              tagPosition = TAG_START;
              // Set the string for accumulating the text in a tag to empty
              elemChars = "";
              // If the element name is "row", create a new row instance
              // If the element is "indexxid", "ModelPrice", or "ModelSpread",
              // the value will be read in the method "characters" and stored.
              if (elemName.equals("row")) {
                   row = new IndexRow();
                   numRows++;
              // logger.info("Number of numRow:"+numRows);
         } // end method startElement
         public void endElement(String namespaceURI, String simpleName, // simple
                   // name
                   String qualName // qualified name
         ) throws SAXException {
              elemName = new String(simpleName);
              if (elemName.equals(""))
                   elemName = new String(qualName); // namespaceAware = false
              tagPosition = TAG_END;
              String indexId = new String();
              Double dblVal = new Double(0);
              // If element name is "row", put the current row in the map for row
              // instances
              if (elemName.equals("row")) {
                   if (numRows <= 5) { logger.info("Row is: " + row.toString()); }
                   //ABX
                   //indexRows.put(row.getIndexxId(), row);
                   if (family.equals("ABX.HE")){
                   indexRows.put(row.getIndexREDId(), row);
                   else {
                        //CDX ITRXX
                             indexRows.put(row.getIndexxId(), row);
              } else if (elemName.equals("IndexID")) {
                   row.setIndexxId(elemChars);
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setCompositeSpread(dblVal);
                        indexId = row.getIndexxId();
              } else if (elemName.equals("REDCode")) {
                   row.setRedCode(elemChars);
              else if (elemName.equals("Name")) {
                   row.setRowName(elemChars);
              } else if (elemName.equals("Series")) {
                   row.setSeries(elemChars);
              } else if (elemName.equals("Version")) {
                   row.setVersion(elemChars);
              } else if (elemName.equals("Term")) {
                   row.setTerm(elemChars);
              } else if (elemName.equals("Maturity")) {
                   row.setMaturity(elemChars);
              } else if (elemName.equals("OnTheRun")) {
                   row.setOnTheRun(elemChars);
              } else if (elemName.equals("Date")) {
                   row.setRowDate(elemChars);
              } else if (elemName.equals("Depth")) {
                   row.setDepth(elemChars);
              else if (elemName.equals("Heat")) {
                   // logger.info("Chars for element " + elemName + " are '" +
                   // elemChars + "'");
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setHeat(dblVal);
                        indexId = row.getIndexxId();
    //          ABX.HE
              else if (elemName.equals("IndexREDId")){
                   row.setIndexREDId(elemChars);
              else if (elemName.equals("Coupon")){
                   row.setCoupon(elemChars);
              if (elemName.equals("Ontherun")) {
                   row.setOnTheRun(elemChars);
         } // end method endElement
         public void characters(char buf[], int offset, int len) throws SAXException {
              // If at end of element, there will be no characters
              if (tagPosition == TAG_END) {
                   return;
              // The characteres method may be called more than once
              // for an element if the internal buffer fills up.
              // Append the characters until the end of the element.
              String strVal = new String(buf, offset, len);
              elemChars = elemChars + strVal;
         } // end method characters
    } // end class MarkItIndexLoader
    but the problem is i want to read (parse) any XML file means any Elemets would be change any time using SAX .In the above example
    else if (elemName.equals("Heat")) {
    else if (elemName.equals("IndexREDId")){
    } else if (elemName.equals("Maturity")) {
    like above I am doing hard code Elements names and reading the values so i don't want hard coding the elements names I want to read any element name and value dynamically.
    If i give any one below XML file i want to read the Elements and displaying to console without changing any code i want to read the XML document.
    EX:
    Student.XML: <root>..</StName>..</StAge>...</root>
    Employee.XML: <root>..</EmpName>..</EmpAge>...</root>
    CdCatalog.XML: <root>..</Cdtitle>...</CdNumber>...</root>
    I need one java program can ready any type of XML file elements and send to the Database table.
    Please any one done like this task please suggest some reference links or books or sample snippet which can help me to develop program in my requirement.
    Thanks in advance
    Regards
    satish

    You should ask in the Java forum.
    Regards
    Stefan

  • Sax parser problem

    hi,
    i am assuming the problem is with sax parser but i cant be sure. I am parsing a xml file (about 1.4MB) with some data in it. the parser i have created reads the xml file correctly for the most part but when at some point the
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function stops working correctly....i.e it doesnt fully read read the data between the "<start>" and "</start>" element. say it reads about 100 id's correctly---for 101 ID it does this. This is just an example. Since, the problem might be with how :
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function is reading the data i was wondering if anybody else had encountered this problem or please let me know if i need to change something in the code: here's a part of the code :
    Bascially i have created three classes to enter data into three mysql tables and as i parse the data i fill up the columns by matching the column header with the tagName.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.*;
    import java.io.*;
    import java.util.ArrayList;
    import java.lang.Object;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import java.util.*;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    public class Echo03 extends DefaultHandler
    StringBuffer textBuffer;
    int issuedValue, prodValue;
    OrdHeader header = new OrdHeader();
    OrdDetail detail = new OrdDetail();
    Member memInfo = new Member();
    //new addition to store the dynamic value of the products
    TestOrdheader prod = new TestOrdheader();
    int counter;
    String tag, newTag;
    SetValue setVal = new SetValue();
    String test;
    public static void main(String argv[])
    if (argv.length != 1) {
    System.err.println("Usage: cmd filename");
    System.exit(1);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new Echo03();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Set up output stream
    out = new OutputStreamWriter(System.out, "UTF8");
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse( new File(argv[0]), handler);
    } catch (Throwable t) {
    t.printStackTrace();
    System.exit(0);
    static private Writer out;
    private String indentString = " "; // Amount to indent
    private int indentLevel = 0;
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    nl();
    nl();
    emit("START DOCUMENT");
    nl();
    emit("<?xml version='1.0' encoding='UTF-8'?>");
    header.assign();
    public void endDocument()
    throws SAXException
    nl(); emit("END DOCUMENT");
    try {
    nl();
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void startElement(String namespaceURI,
    String lName, // local name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
    indentLevel++;
    nl(); //emit("ELEMENT: ");
    String eName = lName; // element name
    if ("".equals(eName)) eName = qName; // namespaceAware = false
    if (qName.equals("Billing")){
    issuedValue = 1;
    }else if (qName.equals("Shipping")){
    issuedValue = 2;
    }else if (qName.equals("ShippingTotal")){
    issuedValue = 3;
    //check to see if "Product" is the name of the element thats coming next
    if (qName.equals("Product")){
    if (issuedValue != 3){
    prodValue = 1;
    prod.addCounter();
    }else{
    prodValue = 0;
    tag = eName;
    if (attrs != null) {
    for (int i = 0; i < attrs.getLength(); i++) {
    String aName = attrs.getLocalName(i); // Attr name
    if ("".equals(aName)) aName = attrs.getQName(i);
    nl();
    emit(" ATTR: ");
    emit(aName);
    emit("\t\"");
    emit(attrs.getValue(i));
    emit("\"");
    if (attrs.getLength() > 0) nl();
    public void endElement(String namespaceURI,
    String sName, // simple name
    String qName // qualified name
    throws SAXException
    nl();
    String eName = sName; // element name
    if ("".equals(eName)){
    eName = qName; // not namespaceAware
    if ("Order".equals(eName)){          
    //enter into database
         databaseEnter();
    textBuffer = null;
    indentLevel--;
    public void characters(char buf[], int offset, int len)
    throws SAXException
    nl();
    try {
    String s = new String(buf, offset, len);
    if (!s.trim().equals("")){
    settag(tag, s);
    s = null;
    }catch (NullPointerException E){
    System.out.println("Null pointer Exception:"+E);
    //===========================================================
    // Utility Methods ...
    //===========================================================
    // Wrap I/O exceptions in SAX exceptions, to
    // suit handler signature requirements
    private void emit(String s)
    throws SAXException
    try {
    out.write(s);
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    // Start a new line
    // and indent the next line appropriately
    private void nl()
    throws SAXException
    String lineEnd = System.getProperty("line.separator");
    try {
    out.write(lineEnd);
    for (int i=0; i < indentLevel; i++) out.write(indentString);
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    ===================================================================
    ///User defined methods
    ===================================================================
    private String strsplit(String splitstr){
    String delimiter = new String("=");
    String[] value = splitstr.split(delimiter);
    value[1] = value[1].replace(':', ' ');
    return value[1];
    public void settag(String tag, String s){         
    String pp_transid = null, pp_respmsg = null,pp_authid = null, pp_avs = null, pp_avszip = null;
    if ((tag.equals("OrderDate")) || (tag.equals("OrderProcessingInfo"))){
    if (tag.equals("OrderDate")){
    StringTokenizer st = new StringTokenizer(s);
    String orddate = st.nextToken();
    String ordtime = st.nextToken();
    header.put("ordDate", orddate);
    header.put("ordTime", ordtime);
    }else if (tag.equals("OrderProcessingInfo")){
    StringTokenizer st1 = new StringTokenizer(s);
    int tokenCount = 1;
    while (tokenCount <= st1.countTokens()){
    switch(tokenCount){
    case 1:
    String extra = st1.nextToken();
    break;
    case 2:
    String Opp_transid = st1.nextToken();
    pp_transid = strsplit(Opp_transid);
    break;
    case 3:
    String Opp_respmsg = st1.nextToken();
    pp_respmsg = strsplit(Opp_respmsg);
    break;
    case 4:
    String Opp_authid = st1.nextToken();
    pp_authid = strsplit(Opp_authid);
    break;
    case 5:
    String Opp_avs = st1.nextToken();
    pp_avs = strsplit(Opp_avs);
    break;
    case 6:
    String Opp_avszip = st1.nextToken();
    pp_avszip = strsplit(Opp_avszip);
    break;
    tokenCount++;
    header.put("pp_transid", pp_transid);
    header.put("pp_respmsg", pp_respmsg);
    header.put("pp_authid", pp_authid);
    header.put("pp_avs", pp_avs);
    header.put("pp_avszip", pp_avszip);
    }else{
    newTag = new String(setVal.set_name(tag, issuedValue));
    header.put(newTag, s);
    //detail.put(newTag, s);
    prod.put(newTag, s);
    memInfo.put(newTag,s);
    //Check to see-- if we should add this product to the database or not
    boolean check = prod.checkValid(newTag, prodValue);
    if (check){
    prod.addValues(s);
    setVal.clearMod();
    ==================================================================
    Here's the error that i get:
    java.util.NoSuchElementException
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
    at Echo03.main(Echo03.java:47)

    I haven't gone through your code but I also had a similar error....and the exception in my was because of an "&" instead of the entity reference & in one of the element values. I use a non-validating parser but if you use a validating one then this might not be the reason for your exception.

  • Using the SAX Parser

    As I reported in this thread: Carriage Returns in XSLT output I am trying to produce a text output file with each line terminating in cr-lf (using the output from ViewObject.writeXML() passed through the XSLProcessor.processXSL() method to apply a XSLT stylesheet transformation to it), but the cr characters in the stylesheet are being converted to nl characters, so I am ending up with two nl characters at the end of each line.
    I found a 2002 query (here: http://www.xslt.com/html/xsl-list/2002-04/msg00193.html) by someone with the same problem, and a reply by Steve Muench explaining it and stating that the Oracle SAX parser does not have the same problem.
    So my question now is - does the SAX parser still retain cr characters (or is it too now converting them to nl) and if it does, how do I make XSLProcessor.processXSL() use it rather than the default XML parser? Can I do it from within my code, or does it need to be set in some sort of environment variable? We are on version 9.0.5.2 of JDeveloper(10g)

    Repost

  • How to get a specific tag value from SAX parser

    I am using the SAX method to parse my xml file.
    My Question is how to get the returning characters parsed after calling?
    esp the value of <body> tag?
    Here is my xml file, and i want to get the parsed <body> value after call sax parser.
    <?xml version="1.0" encoding="UTF-8"?>
    <article>
    <content>
    <title>floraaaaa</title>
    <date>2004-03-19</date>
    <body>
    Details of an article, and i want to get the article details
    </body>
    </content>
    </article>

    here is the parser code I am using:
    import java.io.*;
    import org.apache.xerces.parsers.SAXParser;
    import org.xml.sax.Attributes;
    import org.xml.sax.ContentHandler;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.Locator;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.XMLReader;
    import org.xml.sax.helpers.XMLReaderFactory;
    public class test2 {
         public String m_xmlDetail;
         public void readDetail(String url) {
              System.out.println("Parsing XML File: " + url + "\n\n");
              try {
                   XMLReader parser = new SAXParser();
                   ContentHandler contentHandler = new MyContentHandler();
                   parser.setContentHandler(contentHandler);
                   parser.parse(url);
              } //try ends here
              catch (IOException e) {
                   System.out.println("Error reading URI: " + e.getMessage());
              } //catch ends here
              catch (SAXException e) {
                   System.out.println("Error in parsing: " + e.getMessage());
              } //catch ends here
         } //function
    }//close class
    public class MyContentHandler implements ContentHandler {
         private Locator locator;
         //public String m_bodyDetail=new String();
         public void setDocumentLocator(Locator locator) {
              System.out.println(" * setDocumentLocator() called");
              this.locator = locator;
         public void startDocument() throws SAXException {
              System.out.println("Parsing begins...");
         public void endDocument() throws SAXException {
              System.out.println("...Parsing ends.");
         public void processingInstruction(String target, String data)throws SAXException {
              System.out.println("PI: Target:" + target + " and Data:" + data);
         public void startPrefixMapping(String prefix, String uri) {
              System.out.println("Mapping starts for prefix " + prefix + " mapped to URI " + uri);
         public void endPrefixMapping(String prefix) {
              System.out.println("Mapping ends for prefix " + prefix);
         public void startElement(String namespaceURI, String localName,String rawName, Attributes atts)throws SAXException {
              System.out.print("startElement: " + localName);
              if (!namespaceURI.equals("")) {
                   System.out.println(" in namespace " + namespaceURI + " (" + rawName + ")");
              else {
                   System.out.println(" has no associated namespace");
              for (int i=0; i<atts.getLength(); i++)
                   System.out.println(" Attribute: " + atts.getLocalName(i) +"=" + atts.getValue(i));
         public void endElement(String namespaceURI, String localName, String rawName) throws SAXException {
              System.out.println("endElement: " + localName + "\n");
         public void characters(char[] ch, int start, int end) throws SAXException {
              String s = new String(ch, start, end);
              System.out.println("characters: " + s);
         public void ignorableWhitespace(char[] ch, int start, int end)throws SAXException {
              String s = new String(ch, start, end);
              System.out.println("ignorableWhitespace: [" + s + "]");
         public void skippedEntity(String name) throws SAXException {
              System.out.println("Skipping entity " + name);
    } //close class

Maybe you are looking for

  • CRM - Process Flow of Authorization Check in Business Transactions

    Hello Folks: I have implemented CRM security using Process Flow of Authorization Check in Business Transactions. What I have in place: CRM_ORD_OP (inactive, don't want access to own documents) CRM_ORD_LP (inactive, not using standard org level values

  • X1900 XT goes black during games

    My roommate started reporting this first, but now I'm getting it fairly often as well. After a little while playing any "difficult" 3D game (Halo, Quake, etc) the screen will turn black and not come back. I'm assuming it's heat related, but I have no

  • Oracle SOA Suite 11g - Supported Databases??

    Hi All I am trying my hands with Oracle SOA suite 11g on my laptop having 2GB of RAM... List of soft wares installed for this are Oracle 11g database, JDeveloper, SOA Suite. On real time when developing some application system becomes too slow due to

  • Query..for Field should not accept the manual entry

    i wann query for remarks Field in JE It should Not accept the manual entry it should accept only sys drop data. Thanks & Regards yogi

  • Paying for a service not listed on my account

    I cancelled my Adobe Illustrator CC subscription some time ago, and it does not appear under "Plans & Products" on my account. It says I have no plans or products, and the program is no longer installed on my PC. However I am still being charged $19.