Search in sources :

Example 26 with XMLWriter

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

the class XmlParserBase method compose.

@Override
public void compose(OutputStream stream, Type type, String rootName) throws IOException {
    xml = new XMLWriter(stream, "UTF-8", version == XmlVersion.V1_1);
    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 27 with XMLWriter

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

the class XmlParser method compose.

@Override
public void compose(Element e, OutputStream stream, OutputStyle style, String base) throws IOException, FHIRException {
    XMLWriter xml = new XMLWriter(stream, "UTF-8");
    xml.setSortAttributes(false);
    xml.setPretty(style == OutputStyle.PRETTY);
    xml.start();
    String ns = e.getProperty().getXmlNamespace();
    if (ns != null && !"noNamespace".equals(ns)) {
        xml.setDefaultNamespace(ns);
    }
    if (hasTypeAttr(e))
        xml.namespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
    addNamespaces(xml, e);
    composeElement(xml, e, e.getType(), true);
    xml.end();
}
Also used : IXMLWriter(org.hl7.fhir.utilities.xml.IXMLWriter) XMLWriter(org.hl7.fhir.utilities.xml.XMLWriter)

Example 28 with XMLWriter

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

the class XmlParserBase method compose.

@Override
public void compose(OutputStream stream, DataType type, String rootName) 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 29 with XMLWriter

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

the class XmlParserBase method compose.

@Override
public void compose(OutputStream stream, DataType type, String rootName) 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 30 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, and maybe a different choice in the xhtml narrative (used in the spec in one place, but should not be used in production)
 * @
 */
public void compose(OutputStream stream, Resource resource, boolean htmlPretty) throws IOException {
    XMLWriter writer = new XMLWriter(stream, "UTF-8");
    writer.setPretty(style == OutputStyle.PRETTY);
    writer.start();
    compose(writer, resource, htmlPretty);
    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