<p>
unmarshal from html string to html object.
</p>

@param sb
@return
@throws JAXBException
487216
protected Html unmarshal(StringBuilder sb) throws JAXBException {
        Html html = null;
        sb = replaceIframeEndTag(sb);
        sb = removeDoctypeDeclaration(sb);
        sb = replaceNamedEntity(sb);
        StringReader stringReader = new StringReader(sb.toString());
        html = (Html) jaxbContext.createUnmarshaller().unmarshal(stringReader);
        return html;
    }
282694
public ResponseWrapper unmarshal(String payload) throws ResponseParseException {

    Services xmlServices = parseResponsePayload(payload);

    ResponseWrapper response = constructResponseWrapperFromResponse(xmlServices);

    return response;

  }
106807
@SuppressWarnings("unchecked")
    @NotNull
    public <TYPE> TYPE create(@NotNull final String xml, @NotNull final JAXBContext jaxbContext) throws UnmarshalObjectException {

        Contract.requireArgNotNull("xml", xml);
        Contract.requireArgNotNull("jaxbContext", jaxbContext);

        return (TYPE) create(new StringReader(xml), jaxbContext);

    }
1137173
public Unmarshaller getUnmarshaller(boolean reuse)
    throws JAXBException {
    if (!reuse || unmarshaller == null) {
      unmarshaller = context.createUnmarshaller();
    }
    return unmarshaller;
  }
1121964
public Object unmarshalRootElement(Reader inStream, BaseXmlTrxMessageIn soapTrxMessage) throws Exception
    {
    	String packageName = null;
    	String bindingName = null;
        try {
            // create a JAXBContext capable of handling classes generated into
            // the primer.po package
            packageName = (String)((TrxMessageHeader)soapTrxMessage.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_PACKAGE_NAME);
            bindingName = (String)((TrxMessageHeader)soapTrxMessage.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_BINDING_NAME);
            if (packageName != null)
            {
                Object obj = null;
                IUnmarshallingContext u = JibxContexts.getJIBXContexts().getUnmarshaller(packageName, bindingName);
                if (u == null)
                    return null;
                synchronized(u)
                {   // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
                    obj = u.unmarshalDocument( inStream, bindingName);
                }

                return obj;
            }
//+        } catch (XMLStreamException ex)  {
//+            ex.printStackTrace();
        } catch (JiBXException ex)  {
            ex.printStackTrace();
            throw new Exception("Error: " + ex.getMessage() + " binding: " + bindingName + " package: " + packageName);
        }

        return null;
    }
754469
private void _serialize(Object object, StringBuilder sb, Set<Object> done) throws ConverterException {
	// try {
	deep++;
	// NULL
	if (object == null) {
	    sb.append(goIn());
	    sb.append("nullValue()");
	    deep--;
	    return;
	}
	// String
	if (object instanceof String) {
	    sb.append(goIn());
	    sb.append(QUOTE_CHR);
	    sb.append(escape(object.toString()));
	    sb.append(QUOTE_CHR);
	    deep--;
	    return;
	}
	if (object instanceof TimeZone) {
	    sb.append(goIn());
	    sb.append(QUOTE_CHR);
	    sb.append(escape(((TimeZone) object).getID()));
	    sb.append(QUOTE_CHR);
	    deep--;
	    return;
	}
	if (object instanceof Locale) {
	    sb.append(goIn());
	    sb.append(QUOTE_CHR);
	    sb.append(LocaleFactory.toString((Locale) object));
	    sb.append(QUOTE_CHR);
	    deep--;
	    return;
	}
	// Number
	if (object instanceof Number) {
	    sb.append(goIn());
	    sb.append(Caster.toString(((Number) object)));
	    deep--;
	    return;
	}
	// Boolean
	if (object instanceof Boolean) {
	    sb.append(goIn());
	    sb.append(Caster.toString(((Boolean) object).booleanValue()));
	    deep--;
	    return;
	}
	// DateTime
	if (object instanceof DateTime) {
	    _serializeDateTime((DateTime) object, sb);
	    deep--;
	    return;
	}
	// Date
	if (object instanceof Date) {
	    _serializeDate((Date) object, sb);
	    deep--;
	    return;
	}
	// XML
	if (object instanceof Node) {
	    _serializeXML((Node) object, sb);
	    deep--;
	    return;
	}
	if (object instanceof ObjectWrap) {
	    try {
		_serialize(((ObjectWrap) object).getEmbededObject(), sb, done);
	    }
	    catch (PageException e) {
		throw toConverterException(e);
	    }
	    deep--;
	    return;
	}
	// Timespan
	if (object instanceof TimeSpan) {
	    _serializeTimeSpan((TimeSpan) object, sb);
	    deep--;
	    return;
	}
	Object raw = LazyConverter.toRaw(object);
	if (done.contains(raw)) {
	    sb.append(goIn());
	    sb.append("nullValue()");
	    deep--;
	    return;
	}

	done.add(raw);
	try {
	    // Component
	    if (object instanceof Component) {
		_serializeComponent((Component) object, sb, done);
		deep--;
		return;
	    }

	    // Struct
	    if (object instanceof Struct) {
		_serializeStruct((Struct) object, sb, done);
		deep--;
		return;
	    }
	    // Map
	    if (object instanceof Map) {
		_serializeMap((Map) object, sb, done);
		deep--;
		return;
	    }
	    // Array
	    if (object instanceof Array) {
		_serializeArray((Array) object, sb, done);
		deep--;
		return;
	    }
	    // List
	    if (object instanceof List) {
		_serializeList((List) object, sb, done);
		deep--;
		return;
	    }
	    // Query
	    if (object instanceof Query) {
		_serializeQuery((Query) object, sb, done);
		deep--;
		return;
	    }
	    // String Converter
	    if (object instanceof ScriptConvertable) {
		sb.append(((ScriptConvertable) object).serialize());
		deep--;
		return;
	    }
	    if (object instanceof Serializable) {
		_serializeSerializable((Serializable) object, sb);
		deep--;
		return;
	    }
	}
	finally {
	    done.remove(raw);
	}
	throw new ConverterException("can't serialize Object of type [ " + Caster.toClassName(object) + " ]");
	// deep--;
	/*
	 * } catch(StackOverflowError soe){ throw soe; }
	 */
    }
56693
public static Object unmarshal(String message, Class<?> childClass) {
        try {
            Class<?>[] reverseAndToArray = Iterables.toArray(Lists.reverse(getAllSuperTypes(childClass)), Class.class);
            JAXBContext jaxbCtx = JAXBContext.newInstance(reverseAndToArray);
            Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller();

            return unmarshaller.unmarshal(new StringReader(message));
        } catch (Exception e) {
        }

        return null;
    }
286930
@Nonnull
  @OverrideOnDemand
  protected Marshaller createMarshaller () throws JAXBException
  {
    final JAXBContext aJAXBContext = getJAXBContext ();

    // create a Marshaller
    final Marshaller aMarshaller = aJAXBContext.createMarshaller ();

    // Validating (if possible)
    final Schema aSchema = getSchema ();
    if (aSchema != null)
      aMarshaller.setSchema (aSchema);

    return aMarshaller;
  }
843355
private void _serialize(PageContext pc, Set test, Object object, StringBuilder sb, boolean serializeQueryByColumns, Set done) throws ConverterException {

	// NULL
	if (object == null || object == NULL) {
	    sb.append(goIn());
	    sb.append("null");
	    return;
	}
	// String
	if (object instanceof String || object instanceof StringBuilder) {
	    sb.append(goIn());
	    sb.append(StringUtil.escapeJS(object.toString(), '"', charsetEncoder));
	    return;
	}
	// TimeZone
	if (object instanceof TimeZone) {
	    sb.append(goIn());
	    sb.append(StringUtil.escapeJS(((TimeZone) object).getID(), '"', charsetEncoder));
	    return;
	}
	// Locale
	if (object instanceof Locale) {
	    sb.append(goIn());
	    sb.append(StringUtil.escapeJS(LocaleFactory.toString((Locale) object), '"', charsetEncoder));
	    return;
	}
	// Character
	if (object instanceof Character) {
	    sb.append(goIn());
	    sb.append(StringUtil.escapeJS(String.valueOf(((Character) object).charValue()), '"', charsetEncoder));
	    return;
	}
	// Number
	if (object instanceof Number) {
	    sb.append(goIn());
	    sb.append(Caster.toString(((Number) object)));
	    return;
	}
	// Boolean
	if (object instanceof Boolean) {
	    sb.append(goIn());
	    sb.append(Caster.toString(((Boolean) object).booleanValue()));
	    return;
	}
	// DateTime
	if (object instanceof DateTime) {
	    _serializeDateTime((DateTime) object, sb);
	    return;
	}
	// Date
	if (object instanceof Date) {
	    _serializeDate((Date) object, sb);
	    return;
	}
	// XML
	if (object instanceof Node) {
	    _serializeXML((Node) object, sb);
	    return;
	}
	// Timespan
	if (object instanceof TimeSpan) {
	    _serializeTimeSpan((TimeSpan) object, sb);
	    return;
	}
	// File
	if (object instanceof File) {
	    _serialize(pc, test, ((File) object).getAbsolutePath(), sb, serializeQueryByColumns, done);
	    return;
	}
	// String Converter
	if (object instanceof ScriptConvertable) {
	    sb.append(((ScriptConvertable) object).serialize());
	    return;
	}
	// byte[]
	if (object instanceof byte[]) {
	    sb.append("\"" + Base64Coder.encode((byte[]) object) + "\"");
	    return;
	}
203715
public String marshal(Object jaxbObject) {

		// Precondition, check that the jaxbContext is set!
    	if (jaxbContext == null) {
    		logger.error("Trying to marshal with a null jaxbContext, returns null. Check your configuration, e.g. jaxb-transformers!");
    		return null;
    	}

    	try {

            StringWriter writer = new StringWriter();
        	Marshaller marshaller = jaxbContext.createMarshaller();
        	if (marshallProps != null) {
	        	for (Entry<String, Object> entry : marshallProps.entrySet()) {
	        		marshaller.setProperty(entry.getKey(), entry.getValue());
				}
        	}
        	marshaller.marshal(jaxbObject, writer);

        	String xml = writer.toString();
        	
            if (logger.isDebugEnabled()) logger.debug("marshalled jaxb object of type {}, returns xml: {}",  jaxbObject.getClass().getSimpleName(), xml);
          
            return xml;
	    } catch (JAXBException e) {
	        throw new RuntimeException(e);
		}
    }
880304
private <T> T unmarshalAs(String valueAsString, Class<T> asClass) throws IOException {
        return mapper.reader(asClass).readValue(valueAsString);
    }
1165755
public Api fromXML(String xml) throws Exception {
    // retrieve the JAXB wrapper representation from the xml received
    Api api = Api.fromXML(xml);
    // check whether an error code was sent
    Error error = api.getError();
    // if there is an error - handle it
    if (error != null) {
      // prepare the error message
      String errMsg = "error code=" + error.getCode() + " info:'"
          + error.getInfo() + "'";
      this.handleError(errMsg);
    }
    return api;
  }
1137412
public Configuration unmarshall(InputStream inputStream) {
        try {
            final Unmarshaller unmarshaller = _jaxbContext.createUnmarshaller();
            unmarshaller.setEventHandler(new JaxbValidationEventHandler());

            final Configuration configuration = (Configuration) unmarshaller.unmarshal(inputStream);
            return configuration;
        } catch (JAXBException e) {
            throw new IllegalStateException(e);
        }
    }
529221
private Object convertStrToObjTree(String s) {
        Object contentObj = null;
        if (s != null) {
            s = s.trim();
            try {
                if (s.startsWith("{")) {
                    contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<HashMap<String, Object>>() {
                    });
                } else if (s.startsWith("[")) {
                    contentObj = Config.getInstance().getMapper().readValue(s, new TypeReference<List<Object>>() {
                    });
                } else {
                    logger.error("cannot deserialize json str: {}", s);
                    return null;
                }
            } catch (IOException e) {
                logger.error(e.getMessage());
            }
        }
        return contentObj;
    }
1313638
public static String serialize(Element element) {
        StringWriter sw = new StringWriter();
        serialize(new DOMSource(element), sw);
        return sw.toString();
    }
1196330
private static AckEvent unmarshall(ByteBuf json) throws IOException {
        JsonNode jsonNode = Jackson.getObjectMapper().readTree(json.toString(CharsetUtil.UTF_8));
        return UNMARSHALLER.unmarshall(jsonNode);
    }
45223
public static <T> List<T> unmarshalCollection(Class<T> cl, InputStream s) throws JAXBException {
    return unmarshalCollection(cl, new StreamSource(s));
  }