public boolean isElement(XmlInputStream in, TypeInfo info) throws ConnectionException { if (in.getEventType() != XmlInputStream.START_TAG) { return false; } return sameTag(getNamespace(info), info.getName(), in.getNamespace(), in.getName()); }
public boolean isElement(XmlInputStream in, TypeInfo info) throws ConnectionException { if (in.getEventType() != XmlInputStream.START_TAG) { return false; } return sameTag(getNamespace(info), info.getName(), in.getNamespace(), in.getName()); }
private void writeSimpleType(XmlOutputStream out, TypeInfo info, String value, boolean isSet, String javaType) throws IOException { if (!isSet && info.getMinOcc() == 0) { return; } if (value == null) { writeNull(out, info); } else { out.writeStartTag(getNamespace(info), info.getName()); if (writeFieldXsiType) { writeXsiType(out, info.getTypeNS(), info.getType()); } else { if ("anyType".equals(info.getType()) && Constants.SCHEMA_NS.equals(info.getTypeNS())) { QName xmlType = getXmlType(javaType); if (xmlType == null) { throw new IOException("Failed to find xml type for java type: " + javaType); } writeXsiType(out, xmlType.getNamespaceURI(), xmlType.getLocalPart()); } } out.writeText(value); out.writeEndTag(getNamespace(info), info.getName()); } }
private void writeSimpleType(XmlOutputStream out, TypeInfo info, String value, boolean isSet, String javaType) throws IOException { if (!isSet && info.getMinOcc() == 0) { return; } if (value == null) { writeNull(out, info); } else { out.writeStartTag(getNamespace(info), info.getName()); if (writeFieldXsiType) { writeXsiType(out, info.getTypeNS(), info.getType()); } else { if ("anyType".equals(info.getType()) && Constants.SCHEMA_NS.equals(info.getTypeNS())) { QName xmlType = getXmlType(javaType); if (xmlType == null) { throw new IOException("Failed to find xml type for java type: " + javaType); } writeXsiType(out, xmlType.getNamespaceURI(), xmlType.getLocalPart()); } } out.writeText(value); out.writeEndTag(getNamespace(info), info.getName()); } }
public boolean verifyElement(XmlInputStream in, TypeInfo info) throws ConnectionException { if (config != null && !config.isValidateSchema()) { return isElement(in, info); } else { try { verifyTag(getNamespace(info), info.getName(), in.getNamespace(), in.getName()); } catch (ConnectionException ce) { return false; } return true; } }
private void writeSingleObject(XmlOutputStream out, TypeInfo info, Object value) throws IOException { if (value == null) { writeSimpleType(out, info, null, true, String.class.getName()); } else if (value instanceof XMLizable) { XMLizable xmlObject = (XMLizable) value; xmlObject.write(new QName(getNamespace(info), info.getName()), out, this); } else if (value instanceof Time) { writeSimpleType(out, info, value.toString(), true, Time.class.getName()); } else if (value instanceof Calendar || value instanceof Date) { String s = calendarCodec.getValueAsString(value); writeSimpleType(out, info, s, true, Calendar.class.getName()); } else if (value instanceof byte[]) { String s = new String(Base64.encode((byte[]) value)); writeSimpleType(out, info, s, true, "[B"); } else if (value instanceof Double) { writeDouble(out, info, (Double)value, true); } else if (value instanceof Float) { writeFloat(out, info, (Float)value, true); } else if (value instanceof Long) { writeLong(out, info, (Long)value, true); } else if (value instanceof Integer) { writeInt(out, info, (Integer)value, true); } else if (value instanceof Boolean) { writeBoolean(out, info, (Boolean)value, true); } else if (value instanceof BigDecimal) { writeBigDecimal(out, info, (BigDecimal)value, true); } else { writeString(out, info, value.toString(), true); } }
public boolean verifyElement(XmlInputStream in, TypeInfo info) throws ConnectionException { if (config != null && !config.isValidateSchema()) { return isElement(in, info); } else { try { verifyTag(getNamespace(info), info.getName(), in.getNamespace(), in.getName()); } catch (ConnectionException ce) { return false; } return true; } }
private void writeSingleObject(XmlOutputStream out, TypeInfo info, Object value) throws IOException { if (value == null) { writeSimpleType(out, info, null, true, String.class.getName()); } else if (value instanceof XMLizable) { XMLizable xmlObject = (XMLizable) value; xmlObject.write(new QName(getNamespace(info), info.getName()), out, this); } else if (value instanceof Time) { writeSimpleType(out, info, value.toString(), true, Time.class.getName()); } else if (value instanceof Calendar || value instanceof Date) { String s = calendarCodec.getValueAsString(value); writeSimpleType(out, info, s, true, Calendar.class.getName()); } else if (value instanceof byte[]) { String s = new String(Base64.encode((byte[]) value)); writeSimpleType(out, info, s, true, "[B"); } else if (value instanceof Double) { writeDouble(out, info, (Double)value, true); } else if (value instanceof Float) { writeFloat(out, info, (Float)value, true); } else if (value instanceof Long) { writeLong(out, info, (Long)value, true); } else if (value instanceof Integer) { writeInt(out, info, (Integer)value, true); } else if (value instanceof Boolean) { writeBoolean(out, info, (Boolean)value, true); } else if (value instanceof BigDecimal) { writeBigDecimal(out, info, (BigDecimal)value, true); } else { writeString(out, info, value.toString(), true); } }