Class XmlMappingWriter

java.lang.Object
org.openehealth.ipf.commons.map.xml.XmlMappingWriter
All Implemented Interfaces:
MappingWriter

public class XmlMappingWriter extends Object implements MappingWriter
Writes Mappings as a *.mapping.xml document.

The output declares the schema with xsi:noNamespaceSchemaLocation, so an IDE validates it while it is being edited. Attributes that only restate a default - equivalence="equal", reversible="true", override="false" - are left out.

Since:
6.0
  • Constructor Details

    • XmlMappingWriter

      public XmlMappingWriter()
  • Method Details

    • format

      public String format()
      Description copied from interface: MappingWriter
      Short, stable identifier of the format this writer produces, matching the format id of the loader that reads it back, e.g. xml, yaml or conceptmap-r4-json. Compared case-insensitively, and unique among the writers on one classpath.
      Specified by:
      format in interface MappingWriter
      Returns:
      the format id, never null or blank
    • extension

      public String extension()
      Specified by:
      extension in interface MappingWriter
      Returns:
      the file extension of the format this writer produces, including the leading dot and lower case, e.g. .mapping.xml
    • toXml

      public String toXml(List<? extends Mapping> mappings)
      Parameters:
      mappings - the mappings to write
      Returns:
      the document as a string, always with a <mappings> root so that further mappings can be added to the file by hand
    • write

      public void write(List<? extends Mapping> mappings, OutputStream out)
    • write

      public void write(List<? extends Mapping> mappings, Writer out)
      Specified by:
      write in interface MappingWriter
      Parameters:
      mappings - the mappings to write
      out - the destination; the caller closes it