示例#1
0
 /**
  * convert an xml element in Integer value
  *
  * @param reader the StAX reader
  * @return the integer representing element
  * @throws XMLStreamException StAX exception
  * @throws ParserException in case it isn't a number
  */
 protected Integer elementAsInteger(XMLStreamReader reader)
     throws XMLStreamException, ParserException {
   Integer integerValue;
   integerValue = null;
   String elementtext = rawElementText(reader);
   try {
     integerValue = Integer.valueOf(getSubstitutionValue(elementtext));
   } catch (NumberFormatException nfe) {
     throw new ParserException(bundle.notValidNumber(elementtext, reader.getLocalName()));
   }
   return integerValue;
 }
示例#2
0
  /**
   * convert an xml element in Long value
   *
   * @param reader the StAX reader
   * @return the long representing element
   * @throws XMLStreamException StAX exception
   * @throws ParserException in case it isn't a number
   */
  protected Long elementAsLong(XMLStreamReader reader) throws XMLStreamException, ParserException {
    Long longValue;
    longValue = null;
    String elementtext = rawElementText(reader);

    try {
      longValue = Long.valueOf(getSubstitutionValue(elementtext));
    } catch (NumberFormatException nfe) {
      throw new ParserException(bundle.notValidNumber(elementtext, reader.getLocalName()));
    }

    return longValue;
  }