Class PSWriter

java.lang.Object
com.helger.schematron.pure.exchange.PSWriter

public class PSWriter extends Object
This class serializes the Schematron created within the domain object
Author:
Philip Helger
  • Constructor Details

    • PSWriter

      public PSWriter()
      Constructor using the default PSWriterSettings instance.
    • PSWriter

      public PSWriter(@Nonnull IPSWriterSettings aWriterSettings)
      Constructor.
      Parameters:
      aWriterSettings - The writer settings to be used. May not be null.
  • Method Details

    • getWriterSettings

      @Nonnull public IPSWriterSettings getWriterSettings()
      Returns:
      The writer settings specified in the constructor.
    • getAsDocument

      @Nonnull @OverrideOnDemand protected com.helger.xml.microdom.IMicroNode getAsDocument(@Nonnull com.helger.xml.microdom.IMicroElement aElement)
    • writeToFile

      @Nonnull public com.helger.commons.state.ESuccess writeToFile(@Nonnull IPSElement aPSElement, @Nonnull File aFile)
      Write the passed Schematron element to the passed file.
      Parameters:
      aPSElement - The schematron element to write. May not be null.
      aFile - The file to write things to. May not be null.
      Returns:
      ESuccess.
    • writeToStream

      @Nonnull public com.helger.commons.state.ESuccess writeToStream(@Nonnull IPSElement aPSElement, @Nonnull @WillClose OutputStream aOS)
      Write the passed Schematron element to the passed output stream.
      Parameters:
      aPSElement - The schematron element to write. May not be null.
      aOS - The output stream to write things to. May not be null. The stream is automatically closed.
      Returns:
      ESuccess.
    • writeToWriter

      @Nonnull public com.helger.commons.state.ESuccess writeToWriter(@Nonnull IPSElement aPSElement, @Nonnull @WillClose Writer aWriter)
      Write the passed Schematron element to the passed writer.
      Parameters:
      aPSElement - The schematron element to write. May not be null.
      aWriter - The writer to write things to. May not be null. The writer is automatically closed.
      Returns:
      ESuccess.
    • getXMLString

      @Nullable public String getXMLString(@Nonnull IPSElement aPSElement)
      Get the passed Schematron element as a String
      Parameters:
      aPSElement - The schematron element to convert to a string. May not be null.
      Returns:
      The passed element as a string or null if serialization failed.
    • getXMLStringNotNull

      @Nullable public String getXMLStringNotNull(@Nonnull IPSElement aPSElement)
      Get the passed Schematron element as a String
      Parameters:
      aPSElement - The schematron element to convert to a string. May not be null.
      Returns:
      The passed element as a string and never null.
      Throws:
      IllegalStateException - if serialization failed
    • toString

      public String toString()
      Overrides:
      toString in class Object