Example #1
0
  /**
   * Method to parse an XML Node
   *
   * @throws javax.xml.stream.XMLStreamException
   */
  private void procNode() throws XMLStreamException {
    int eventType = reader.getEventType();
    String nombre = "";
    if (eventType == XMLStreamConstants.END_ELEMENT
        || eventType == XMLStreamConstants.START_ELEMENT) {
      nombre = reader.getLocalName();
      if (nombre == null) {
        nombre = "";
      }
    }

    if (nombre.equals(COMPILER_ENTRY_ELEM)) { // most often
      procEntry();
    } else if (eventType == XMLStreamConstants.SPACE) { // also often
      // do nothing
    } else if (eventType == XMLStreamConstants.CHARACTERS) {
      // do nothing
    } else if (eventType == XMLStreamConstants.COMMENT) {
      // do nothing
    } else if (nombre.equals(COMPILER_PARDEF_ELEM)) {
      procParDef();
    } else if (nombre.equals(COMPILER_DICTIONARY_ELEM)) {
      /* ignore */
    } else if (eventType == XMLStreamConstants.END_ELEMENT
        && !nombre.equals(COMPILER_PARDEF_ELEM)) {
      // do nothing
    } else if (nombre.equals(COMPILER_ALPHABET_ELEM)) {
      procAlphabet();
    } else if (nombre.equals(COMPILER_SDEFS_ELEM)) {
      /* ignore */
    } else if (nombre.equals(COMPILER_SDEF_ELEM)) {
      procSDef();
    } else if (nombre.equals(COMPILER_PARDEFS_ELEM)) {
      /* ignore */
    } else if (nombre.equals(COMPILER_SECTION_ELEM)) {
      procSection();
    } else if (eventType == XMLStreamConstants.START_DOCUMENT) {
      version = reader.getVersion();
      encoding = reader.getCharacterEncodingScheme();
      // System.err.println("encoding = " + encoding);

      standalone = reader.isStandalone();
    } else if (eventType == XMLStreamConstants.END_DOCUMENT) {
      // do nothing
    } else {
      XMLPrint.printEvent(reader);
      throw new IllegalStateException(
          "procNode(): don't know how to treat <"
              + nombre
              + "> "
              + XMLPrint.getEventTypeString(eventType));
    }
  }
 public String getCharacterEncodingScheme() {
   return streamReader.getCharacterEncodingScheme();
 }