Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.xml » stream » events » [javadoc | source]

    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   
   16   package org.apache.xmlbeans.xml.stream.events;
   17   
   18   import org.apache.xmlbeans.xml.stream.XMLEvent;
   19   
   20   public class ElementTypeNames {
   21     public static String getName(int val) { 
   22       switch(val) {
   23       case XMLEvent.XML_EVENT: return ("XML_EVENT");
   24       case XMLEvent.START_ELEMENT: return ("START_ELEMENT");
   25       case XMLEvent.END_ELEMENT: return ("END_ELEMENT");
   26       case XMLEvent.PROCESSING_INSTRUCTION: return ("PROCESSING_INSTRUCTION");
   27       case XMLEvent.CHARACTER_DATA: return ("CHARACTER_DATA");
   28       case XMLEvent.COMMENT: return ("COMMENT");
   29       case XMLEvent.SPACE: return ("SPACE");
   30       case XMLEvent.NULL_ELEMENT: return ("NULL_ELEMENT");
   31       case XMLEvent.START_DOCUMENT: return ("START_DOCUMENT");
   32       case XMLEvent.END_DOCUMENT: return ("END_DOCUMENT");
   33       case XMLEvent.START_PREFIX_MAPPING: return ("START_PREFIX_MAPPING");
   34       case XMLEvent.CHANGE_PREFIX_MAPPING: return ("CHANGE_PREFIX_MAPPING");
   35       case XMLEvent.END_PREFIX_MAPPING: return ("END_PREFIX_MAPPING");
   36       case XMLEvent.ENTITY_REFERENCE: return ("ENTITY_REFERENCE");
   37       default: return "";
   38       }
   39     }
   40     public static int getType(String val) {
   41       if (val.equals("XML_EVENT")) 
   42         return XMLEvent.XML_EVENT;
   43       if (val.equals ("START_ELEMENT")) return 
   44           XMLEvent.START_ELEMENT; 
   45       if (val.equals ("END_ELEMENT")) return XMLEvent.END_ELEMENT;
   46       if (val.equals ("PROCESSING_INSTRUCTION"))
   47         return XMLEvent.PROCESSING_INSTRUCTION; 
   48       if (val.equals ("CHARACTER_DATA"))
   49         return XMLEvent.CHARACTER_DATA; 
   50       if (val.equals ("COMMENT"))
   51         return XMLEvent.COMMENT; 
   52       if (val.equals ("SPACE"))
   53         return XMLEvent.SPACE; 
   54       if (val.equals ("NULL_ELEMENT"))
   55         return XMLEvent.NULL_ELEMENT; 
   56       if (val.equals ("START_DOCUMENT"))
   57         return XMLEvent.START_DOCUMENT; 
   58       if (val.equals ("END_DOCUMENT"))
   59         return XMLEvent.END_DOCUMENT; 
   60       if (val.equals ("START_PREFIX_MAPPING"))
   61         return XMLEvent.START_PREFIX_MAPPING; 
   62       if (val.equals ("CHANGE_PREFIX_MAPPING"))
   63         return XMLEvent.CHANGE_PREFIX_MAPPING;
   64       if (val.equals ("ENTITY_REFERENCE"))
   65         return XMLEvent.ENTITY_REFERENCE; 
   66       if (val.equals ("END_PREFIX_MAPPING"))
   67         return XMLEvent.END_PREFIX_MAPPING;
   68   
   69       return XMLEvent.NULL_ELEMENT;
   70     }
   71   }

Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.xml » stream » events » [javadoc | source]