Exemplo n.º 1
0
  @Override
  public boolean read(ReadingContext aContext) {
    if (mappers == null) {
      withPCDataMappedTo(tagName);
    }

    if (aContext.isStartTagNamed(namespace, tagName)) {
      maybePushNewContextObject(aContext);

      try {
        if (attributes != null) attributes.read(aContext);

        while (aContext.isNotEndTag(namespace, tagName)) {
          for (XmlReader _m : mappers) {
            if (_m.read(aContext)) {
              break;
            }
          }
          aContext.next();
        }
        return true;
      } catch (XmlReadingException anExc) {
        throw anExc;
      } catch (Exception anExc) {
        throw new XmlReadingException(anExc);
      } finally {
        maybePopContext(aContext);
      }
    } else {
      return false;
    }
  }
Exemplo n.º 2
0
 @Override
 public final boolean read(ReadingContext aContext) {
   if (aContext.isTextNode()) {
     read(aContext, aContext.getParser().getText());
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 3
0
  private void maybePushNewContextObject(ReadingContext aContext) {
    if (type != null) {
      Object _ctx = aContext.peek();
      T _nestedCtx = newContextObject();

      getMutator(_ctx.getClass(), type, tagName).apply(_ctx, _nestedCtx);

      aContext.push(_nestedCtx);
    }
  }
Exemplo n.º 4
0
  public void read(ReadingContext aContext, String aText) {
    T _currentContext = aContext.peek();

    try {
      ValueSetter _vs = getSetter(aContext, _currentContext.getClass(), fieldName);
      _vs.invoke(fieldName, _currentContext, aText);
    } catch (ParsingException anExc) {
      throw anExc;
    } catch (Exception anExc) {
      throw new ParsingException(anExc);
    }
  }
Exemplo n.º 5
0
 private void maybePopContext(ReadingContext aContext) {
   if (type != null) {
     aContext.pop();
   }
 }