use of org.w3c.dom.ls.LSSerializer in project CloudStack-archive by CloudStack-extras.
the class VsmCommand method serialize.
private static String serialize(DOMImplementation domImpl, Document document) {
DOMImplementationLS ls = (DOMImplementationLS) domImpl;
LSSerializer lss = ls.createLSSerializer();
return lss.writeToString(document);
}
use of org.w3c.dom.ls.LSSerializer in project jackson-databind by FasterXML.
the class DOMSerializer method serialize.
@Override
public void serialize(Node value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
if (_domImpl == null)
throw new IllegalStateException("Could not find DOM LS");
LSSerializer writer = _domImpl.createLSSerializer();
jgen.writeString(writer.writeToString(value));
}
use of org.w3c.dom.ls.LSSerializer in project opennms by OpenNMS.
the class JaxbClassObjectAdapter method unmarshal.
@Override
public Object unmarshal(final Object from) throws Exception {
LOG.trace("unmarshal: from = ({}){}", (from == null ? null : from.getClass()), from);
if (from == null)
return null;
if (from instanceof Node) {
final Node e = (Node) from;
e.normalize();
final String nodeName = e.getNodeName();
final Class<?> clazz = getClassForElement(nodeName);
LOG.trace("class type = {} (node name = {})", clazz, nodeName);
if (clazz == null) {
LOG.warn("Unable to determine object type for node name {}. Known elements include: {}", nodeName, m_knownElementClasses);
return from;
}
final DOMImplementationLS lsImpl = (DOMImplementationLS) e.getOwnerDocument().getImplementation().getFeature("LS", "3.0");
LSSerializer serializer = lsImpl.createLSSerializer();
//by default its true, so set it to false to get String without xml-declaration
serializer.getDomConfig().setParameter("xml-declaration", false);
final String str = serializer.writeToString(e);
return JaxbUtils.unmarshal(clazz, str);
} else {
LOG.error("Unsure how to determine which class to use for unmarshaling object type {}", from.getClass());
throw new IllegalArgumentException("Unsure how to determine which class to use for unmarshaling object type " + from.getClass());
}
}
use of org.w3c.dom.ls.LSSerializer in project wildfly by wildfly.
the class UsernameTokenCallbackHandler method toString.
private String toString(Node node) {
String str = null;
if (node != null) {
DOMImplementationLS lsImpl = (DOMImplementationLS) node.getOwnerDocument().getImplementation().getFeature("LS", "3.0");
LSSerializer serializer = lsImpl.createLSSerializer();
//by default its true, so set it to false to get String without xml-declaration
serializer.getDomConfig().setParameter("xml-declaration", false);
str = serializer.writeToString(node);
}
return str;
}
use of org.w3c.dom.ls.LSSerializer in project cloudstack by apache.
the class VsmCommand method serialize.
private static String serialize(DOMImplementation domImpl, Document document) {
DOMImplementationLS ls = (DOMImplementationLS) domImpl;
LSSerializer lss = ls.createLSSerializer();
return lss.writeToString(document);
}
Aggregations