Search in sources :

Example 1 with StaxSerializer

use of com.sun.xml.txw2.output.StaxSerializer in project metro-jax-ws by eclipse-ee4j.

the class XmlPolicyModelMarshaller method marshal.

/**
 * Marshal a policy onto the given XMLStreamWriter.
 *
 * @param model A policy source model.
 * @param writer An XML stream writer.
 * @throws PolicyException If marshalling failed.
 */
private void marshal(final PolicySourceModel model, final XMLStreamWriter writer) throws PolicyException {
    final StaxSerializer serializer = new StaxSerializer(writer);
    final TypedXmlWriter policy = TXW.create(model.getNamespaceVersion().asQName(XmlToken.Policy), TypedXmlWriter.class, serializer);
    marshalDefaultPrefixes(model, policy);
    marshalPolicyAttributes(model, policy);
    marshal(model.getNamespaceVersion(), model.getRootNode(), policy);
    policy.commit();
    serializer.flush();
}
Also used : StaxSerializer(com.sun.xml.txw2.output.StaxSerializer) TypedXmlWriter(com.sun.xml.txw2.TypedXmlWriter)

Example 2 with StaxSerializer

use of com.sun.xml.txw2.output.StaxSerializer in project metro-jax-ws by eclipse-ee4j.

the class XmlPolicyModelMarshaller method marshal.

/**
 * Marshal a policy onto the given StaxSerializer.
 *
 * @param model A policy source model.
 * @param writer A Stax serializer.
 * @throws PolicyException If marshalling failed.
 */
private void marshal(final PolicySourceModel model, final StaxSerializer writer) throws PolicyException {
    final TypedXmlWriter policy = TXW.create(model.getNamespaceVersion().asQName(XmlToken.Policy), TypedXmlWriter.class, writer);
    marshalDefaultPrefixes(model, policy);
    marshalPolicyAttributes(model, policy);
    marshal(model.getNamespaceVersion(), model.getRootNode(), policy);
    policy.commit();
}
Also used : TypedXmlWriter(com.sun.xml.txw2.TypedXmlWriter)

Aggregations

TypedXmlWriter (com.sun.xml.txw2.TypedXmlWriter)2 StaxSerializer (com.sun.xml.txw2.output.StaxSerializer)1