@Override
 public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
   if (ea.matches(keyTag)) {
     state.loader = keyLoader;
     state.receiver = keyReceiver;
     return;
   }
   if (ea.matches(valueTag)) {
     state.loader = valueLoader;
     state.receiver = valueReceiver;
     return;
   }
   super.childElement(state, ea);
 }
예제 #2
0
        @Override
        public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException {
          List<Object> r = new FinalArrayList<Object>();

          int idx = 0;
          int len = text.length();

          while (true) {
            int p = idx;
            while (p < len && !WhiteSpaceProcessor.isWhiteSpace(text.charAt(p))) p++;

            CharSequence token = text.subSequence(idx, p);
            if (!token.equals(""))
              try {
                r.add(xducer.parse(token));
              } catch (AccessorException e) {
                handleGenericException(e, true);
                continue; // move on to next
              }

            if (p == len) break; // done

            while (p < len && WhiteSpaceProcessor.isWhiteSpace(text.charAt(p))) p++;
            if (p == len) break; // done

            idx = p;
          }

          state.target = toArray(r);
        }
 @Override
 public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
   if (ea.matches(entryTag)) {
     state.loader = entryLoader;
   } else {
     super.childElement(state, ea);
   }
 }
 @Override
 public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
   // create or obtain the Map object
   try {
     target = (BeanT) state.prev.target;
     map = acc.get(target);
     if (map == null) {
       map = ClassFactory.create(mapImplClass);
     }
     map.clear();
     state.target = map;
   } catch (AccessorException e) {
     // recover from error by setting a dummy Map that receives and discards the values
     handleGenericException(e, true);
     state.target = new HashMap();
   }
 }
 @Override
 public void startElement(UnmarshallingContext.State state, TagName ea) {
   state.target = new Object[2]; // this is inefficient
 }