Search in sources :

Example 31 with XMLWriter

use of org.hl7.fhir.utilities.xml.XMLWriter in project org.hl7.fhir.core by hapifhir.

the class XmlParserBase method compose.

/**
 * Compose a type to a stream (used in the spec, for example, but not normally in production)
 * @
 */
public void compose(OutputStream stream, String rootName, Type type) throws IOException {
    xml = new XMLWriter(stream, "UTF-8");
    xml.setPretty(style == OutputStyle.PRETTY);
    xml.start();
    xml.setDefaultNamespace(FHIR_NS);
    composeType(Utilities.noString(rootName) ? "value" : rootName, type);
    xml.end();
}
Also used : IXMLWriter(org.hl7.fhir.utilities.xml.IXMLWriter) XMLWriter(org.hl7.fhir.utilities.xml.XMLWriter)

Example 32 with XMLWriter

use of org.hl7.fhir.utilities.xml.XMLWriter in project org.hl7.fhir.core by hapifhir.

the class XmlParserBase method compose.

/**
 * Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
 * @
 */
@Override
public void compose(OutputStream stream, Resource resource) throws IOException {
    XMLWriter writer = new XMLWriter(stream, "UTF-8");
    writer.setPretty(style == OutputStyle.PRETTY);
    writer.start();
    compose(writer, resource, writer.isPretty());
    writer.end();
}
Also used : IXMLWriter(org.hl7.fhir.utilities.xml.IXMLWriter) XMLWriter(org.hl7.fhir.utilities.xml.XMLWriter)

Aggregations

XMLWriter (org.hl7.fhir.utilities.xml.XMLWriter)28 IXMLWriter (org.hl7.fhir.utilities.xml.IXMLWriter)22 FileOutputStream (java.io.FileOutputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ArrayList (java.util.ArrayList)2 ElementDefn (org.hl7.fhir.definitions.model.ElementDefn)2 BindingSpecification (org.hl7.fhir.definitions.model.BindingSpecification)1 DefinedCode (org.hl7.fhir.definitions.model.DefinedCode)1 DefinedStringPattern (org.hl7.fhir.definitions.model.DefinedStringPattern)1 PrimitiveType (org.hl7.fhir.definitions.model.PrimitiveType)1 ProfiledType (org.hl7.fhir.definitions.model.ProfiledType)1 ResourceDefn (org.hl7.fhir.definitions.model.ResourceDefn)1 TypeRef (org.hl7.fhir.definitions.model.TypeRef)1 SpecialElement (org.hl7.fhir.dstu2016may.metamodel.Element.SpecialElement)1 IniFile (org.hl7.fhir.utilities.IniFile)1