@Override protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) { try { UnmarshallingContext unmarshallingContext = (UnmarshallingContext) createUnmarshallingContext(); IXMLReader xmlReader = new StAXReaderWrapper(streamReader, null, true); unmarshallingContext.setDocument(xmlReader); return unmarshallingContext.unmarshalElement(); } catch (JiBXException ex) { throw convertJibxException(ex, false); } }
public Object read(QName elementQName, XMLStreamReader input, Class type) { try { UnmarshallingContext ctx = getUnmarshallingContext(input, type); return ctx.unmarshalElement(type); } catch (JiBXException e) { throw new RuntimeException(e); } } private static UnmarshallingContext getUnmarshallingContext(XMLStreamReader reader, Class jtype)
public Object read(QName elementQName, XMLStreamReader input, Class<?> type) { try { UnmarshallingContext ctx = getUnmarshallingContext(input, type); return ctx.unmarshalElement(type); } catch (JiBXException e) { throw new RuntimeException(e); } }
Object item = ctx.unmarshalElement(); m_holder.add(item);
Object item = ctx.unmarshalElement(); m_holder.add(item);
@Override protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) { try { UnmarshallingContext unmarshallingContext = (UnmarshallingContext) createUnmarshallingContext(); IXMLReader xmlReader = new StAXReaderWrapper(streamReader, null, true); unmarshallingContext.setDocument(xmlReader); return unmarshallingContext.unmarshalElement(); } catch (JiBXException ex) { throw convertJibxException(ex, false); } }
protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) { try { UnmarshallingContext unmarshallingContext = (UnmarshallingContext) createUnmarshallingContext(); IXMLReader xmlReader = new StAXReaderWrapper(streamReader, null, true); unmarshallingContext.setDocument(xmlReader); return unmarshallingContext.unmarshalElement(); } catch (JiBXException ex) { throw convertJibxException(ex, false); } }
public Object read(MessagePartInfo part, XMLStreamReader input) { Class<?> type = part.getTypeClass(); try { UnmarshallingContext ctx = getUnmarshallingContext(input, type); if (JibxSimpleTypes.isSimpleType(type)) { QName stype = part.getTypeQName(); QName ctype = part.getConcreteName(); if (ctx.isAt(ctype.getNamespaceURI(), ctype.getLocalPart())) { String text = ctx.parseElementText(ctype.getNamespaceURI(), ctype.getLocalPart()); return JibxSimpleTypes.toObject(text, stype); } else { throw new RuntimeException("Missing required element [" + ctype + "]"); } } else { return ctx.unmarshalElement(part.getTypeClass()); } } catch (JiBXException e) { throw new RuntimeException(e); } }
unmarshalClass(global, null, ctx); } else { global.internalAddExtensionChild(ctx.unmarshalElement());
return context.unmarshalElement();
public Object unmarshal(Object obj, IUnmarshallingContext ictx) throws JiBXException { // make sure we're at the appropriate start tag UnmarshallingContext ctx = (UnmarshallingContext)ictx; if (!ctx.isAt(m_uri, m_name)) { return null; } else { // check for reference to existing ID String id = ctx.attributeText(null, getAttributeName(), null); if (id == null) { // no ID value supplied, unmarshal full definition obj = ctx.unmarshalElement(); } else { // find object based on ID obj = ctx.findID(id, 0); ctx.parsePastEndTag(m_uri, m_name); if (obj == null) { ctx.throwStartTagException("Reference to undefined ID " + id); } } } return obj; } }
public Object unmarshal(Object obj, IUnmarshallingContext ictx) throws JiBXException { // make sure we're at the appropriate start tag UnmarshallingContext ctx = (UnmarshallingContext)ictx; if (!ctx.isAt(m_uri, m_name)) { ctx.throwStartTagNameError(m_uri, m_name); } // create new hashmap if needed int size = ctx.attributeInt(m_uri, getSizeAttributeName(), DEFAULT_SIZE); Map map = (Map)obj; if (map == null) { map = new HashMap(size); } // process all entries present in document ctx.parsePastStartTag(m_uri, m_name); while (ctx.isAt(m_uri, getEntryElementName())) { Object key = ctx.attributeText(m_uri, getKeyAttributeName(), null); ctx.parsePastStartTag(m_uri, getEntryElementName()); Object value = ctx.unmarshalElement(); map.put(key, value); ctx.parsePastEndTag(m_uri, getEntryElementName()); } ctx.parsePastEndTag(m_uri, m_name); return map; } }