public void write(final ContentHandler pHandler, Object pObject) throws SAXException { pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES); pHandler.startElement("", STRUCT_TAG, STRUCT_TAG, ZERO_ATTRIBUTES); writeData(pHandler, pObject); pHandler.endElement("", STRUCT_TAG, STRUCT_TAG); pHandler.endElement("", VALUE_TAG, VALUE_TAG); } }
protected void writeData(ContentHandler pHandler, Object pData) throws SAXException { Map map = (Map) pData; for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); writeEntry(pHandler, entry.getKey(), entry.getValue()); } }
protected void writeEntry(ContentHandler pHandler, Object pKey, Object pValue) throws SAXException { pHandler.startElement("", MEMBER_TAG, MEMBER_TAG, ZERO_ATTRIBUTES); pHandler.startElement("", NAME_TAG, NAME_TAG, ZERO_ATTRIBUTES); if (config.isEnabledForExtensions() && !(pKey instanceof String)) { writeValue(pHandler, pKey); } else { String key = pKey.toString(); pHandler.characters(key.toCharArray(), 0, key.length()); } pHandler.endElement("", NAME_TAG, NAME_TAG); writeValue(pHandler, pValue); pHandler.endElement("", MEMBER_TAG, MEMBER_TAG); }
return new ListSerializer(this, pConfig); } else if (pObject instanceof Map) { return new MapSerializer(this, pConfig); } else if (pObject instanceof Node) { if (pConfig.isEnabledForExtensions()) {
return new ListSerializer(this, pConfig); } else if (pObject instanceof Map) { return new MapSerializer(this, pConfig); } else if (pObject instanceof Node) { if (pConfig.isEnabledForExtensions()) {
public void write(final ContentHandler pHandler, Object pObject) throws SAXException { pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES); pHandler.startElement("", STRUCT_TAG, STRUCT_TAG, ZERO_ATTRIBUTES); writeData(pHandler, pObject); pHandler.endElement("", STRUCT_TAG, STRUCT_TAG); pHandler.endElement("", VALUE_TAG, VALUE_TAG); } }
protected void writeData(ContentHandler pHandler, Object pData) throws SAXException { Map map = (Map) pData; for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); writeEntry(pHandler, entry.getKey(), entry.getValue()); } }
protected void writeEntry(ContentHandler pHandler, Object pKey, Object pValue) throws SAXException { pHandler.startElement("", MEMBER_TAG, MEMBER_TAG, ZERO_ATTRIBUTES); pHandler.startElement("", NAME_TAG, NAME_TAG, ZERO_ATTRIBUTES); if (config.isEnabledForExtensions() && !(pKey instanceof String)) { writeValue(pHandler, pKey); } else { String key = pKey.toString(); pHandler.characters(key.toCharArray(), 0, key.length()); } pHandler.endElement("", NAME_TAG, NAME_TAG); writeValue(pHandler, pValue); pHandler.endElement("", MEMBER_TAG, MEMBER_TAG); }
return new ListSerializer(this, pConfig); } else if (pObject instanceof Map) { return new MapSerializer(this, pConfig); } else if (pObject instanceof Node) { if (pConfig.isEnabledForExtensions()) {
public void write(final ContentHandler pHandler, Object pObject) throws SAXException { pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES); pHandler.startElement("", STRUCT_TAG, STRUCT_TAG, ZERO_ATTRIBUTES); writeData(pHandler, pObject); pHandler.endElement("", STRUCT_TAG, STRUCT_TAG); pHandler.endElement("", VALUE_TAG, VALUE_TAG); } }
protected void writeData(ContentHandler pHandler, Object pData) throws SAXException { Map map = (Map) pData; for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); writeEntry(pHandler, entry.getKey(), entry.getValue()); } }
protected void writeEntry(ContentHandler pHandler, Object pKey, Object pValue) throws SAXException { pHandler.startElement("", MEMBER_TAG, MEMBER_TAG, ZERO_ATTRIBUTES); pHandler.startElement("", NAME_TAG, NAME_TAG, ZERO_ATTRIBUTES); if (config.isEnabledForExtensions() && !(pKey instanceof String)) { writeValue(pHandler, pKey); } else { String key = pKey.toString(); pHandler.characters(key.toCharArray(), 0, key.length()); } pHandler.endElement("", NAME_TAG, NAME_TAG); writeValue(pHandler, pValue); pHandler.endElement("", MEMBER_TAG, MEMBER_TAG); }
@Override protected void writeData(ContentHandler pHandler, Object pData) throws SAXException { try { pData = getMap(pData); } catch (IllegalAccessException e) { throw new SAXException(e); } catch (InvocationTargetException e) { throw new SAXException(e); } catch (NoSuchMethodException e) { throw new SAXException(e); } super.writeData(pHandler, pData); }