Class Input

java.lang.Object
org.xmlunit.builder.Input

public class Input extends Object
Fluent API to create Source instances.
  • Method Details

    • fromDocument

      public static Input.Builder fromDocument(Document d)
      Build a Source from a DOM Document.
      Parameters:
      d - the document to use as source
      Returns:
      a new builder
    • fromNode

      public static Input.Builder fromNode(Node n)
      Build a Source from a DOM Node.
      Parameters:
      n - the node to use as source
      Returns:
      a new builder
    • from

      public static Input.Builder from(Object object)
      Return the matching Builder for the supported types: Source, Input.Builder, Document, Node, byte[] (XML as byte[]), String (XML as String), File (contains XML), URL (to an XML-Document), URI (to an XML-Document), InputStream, ReadableByteChannel, Path, Jaxb-Object (marshal-able with JAXB.marshal(...))
      Parameters:
      object - the object to use as source
      Returns:
      a new builder
    • fromJaxb

      public static JaxbBuilder fromJaxb(Object jaxbObject)
      Build a Source from a Jaxb-Object.
      Parameters:
      jaxbObject - the object to use as source
      Returns:
      a new builder
    • fromFile

      public static Input.Builder fromFile(File f)
      Build a Source from a file.
      Parameters:
      f - the file to use as source
      Returns:
      a new builder
    • fromFile

      public static Input.Builder fromFile(String name)
      Build a Source from a named file.
      Parameters:
      name - name of the file to use as source
      Returns:
      a new builder
    • fromStream

      public static Input.Builder fromStream(InputStream s)
      Build a Source from a stream.
      Parameters:
      s - the stream to use as source
      Returns:
      a new builder
    • fromReader

      public static Input.Builder fromReader(Reader r)
      Build a Source from a reader.
      Parameters:
      r - the reader to use as source
      Returns:
      a new builder
    • fromString

      public static Input.Builder fromString(String s)
      Build a Source from a string.
      Parameters:
      s - the string to use as source
      Returns:
      a new builder
    • fromByteArray

      public static Input.Builder fromByteArray(byte[] b)
      Build a Source from an array of bytes.
      Parameters:
      b - the bytes to use as source
      Returns:
      a new builder
    • fromChannel

      public static Input.Builder fromChannel(ReadableByteChannel c)
      Build a Source from a channel.
      Parameters:
      c - the channel to use as source
      Returns:
      a new builder
    • fromURL

      public static Input.Builder fromURL(URL url)
      Build a Source from an URL.
      Parameters:
      url - the url to use as source
      Returns:
      a new builder
    • fromURI

      public static Input.Builder fromURI(URI uri)
      Build a Source from an URI.
      Parameters:
      uri - must represent a valid URL
      Returns:
      a new builder
    • fromURI

      public static Input.Builder fromURI(String uri)
      Build a Source from an URI.
      Parameters:
      uri - must represent a valid URL
      Returns:
      a new builder
    • fromPath

      public static Input.Builder fromPath(Path path)
      Build a Source from a Path.
      Parameters:
      path - a Path
      Returns:
      a new builder
      Since:
      XMLUnit 2.8.0
    • byTransforming

      public static Input.TransformationBuilder byTransforming(Source s)
      Build a Source by XSLT transforming a different Source.
      Parameters:
      s - the source to transform
      Returns:
      a new builder
    • byTransforming

      public static Input.TransformationBuilder byTransforming(Input.Builder b)
      Build a Source by XSLT transforming a different Source.
      Parameters:
      b - builder providing the source to transform
      Returns:
      a new builder