Class XmlParser.Builder<SELF extends XmlParser.Builder<SELF>>

Direct Known Subclasses:
HtmlParser.Builder, XmlParser.DefaultBuilder
Enclosing class:
XmlParser

public abstract static class XmlParser.Builder<SELF extends XmlParser.Builder<SELF>> extends ReaderParser.Builder<SELF>
Builder class.
  • Constructor Details

    • Builder

      protected Builder()
      Constructor, default settings.
    • Builder

      protected Builder(XmlParser.Builder<?> copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The builder to copy from.
      Cannot be null.
    • Builder

      protected Builder(XmlParser copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The bean to copy from.
      Cannot be null.
  • Method Details

    • build

      public XmlParser build()
      Description copied from class: Context.Builder
      Build the object.
      Overrides:
      build in class ReaderParser.Builder<SELF extends XmlParser.Builder<SELF>>
      Returns:
      The built object.
    • copy

      public abstract SELF copy()
      Description copied from class: Context.Builder
      Copy creator.
      Specified by:
      copy in class ReaderParser.Builder<SELF extends XmlParser.Builder<SELF>>
      Returns:
      A new mutable copy of this builder.
    • eventAllocator

      public SELF eventAllocator(Class<? extends XMLEventAllocator> value)
      XML event allocator.

      Associates an XMLEventAllocator with this parser.

      Parameters:
      value - The new value for this property.
      Can be null (no event allocator will be used).
      Returns:
      This object.
    • hashKey

      public HashKey hashKey()
      Description copied from class: Context.Builder
      Returns the hashkey of this builder.

      Used to return previously instantiated context beans that have matching hashkeys. The HashKey object is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if the HashKey.equals(Object) method is the same.

      Overrides:
      hashKey in class ReaderParser.Builder<SELF extends XmlParser.Builder<SELF>>
      Returns:
      The hashkey of this builder.
    • preserveRootElement

      Preserve root element during generalized parsing.

      When enabled, when parsing into a generic JsonMap, the map will contain a single entry whose key is the root element name.

      Example:

      // Parser with preserve-root-element. ReaderParser parser1 = XmlParser .create() .preserveRootElement() .build(); // Parser without preserve-root-element (the default behavior). ReaderParser parser2 = XmlParser .create() .build(); String xml = "<root><a>foobar</a></root>"; // Produces: "{ root: { a:'foobar' }}" JsonMap map1 = parser1.read(xml, JsonMap.class); // Produces: "{ a:'foobar' }" JsonMap map2 = parser2.read(xml, JsonMap.class);

      Returns:
      This object.
    • preserveRootElement

      public SELF preserveRootElement(boolean value)
      Same as preserveRootElement() but allows you to explicitly specify the value.
      Parameters:
      value - The value for this setting.
      Returns:
      This object.
    • reporter

      public SELF reporter(Class<? extends XMLReporter> value)
      XML reporter.

      Associates an XMLReporter with this parser.

      Parameters:
      value - The new value for this property.
      Can be null (no reporter will be used).
      Returns:
      This object.
    • resolver

      public SELF resolver(Class<? extends XMLResolver> value)
      XML resolver.

      Associates an XMLResolver with this parser.

      Parameters:
      value - The new value for this property.
      Can be null (no resolver will be used).
      Returns:
      This object.
    • validating

      public SELF validating()
      Enable validation.

      If true, XML document will be validated.

      See XMLInputFactory.IS_VALIDATING for more info.

      Returns:
      This object.
    • validating

      public SELF validating(boolean value)
      Same as validating() but allows you to explicitly specify the value.
      Parameters:
      value - The value for this setting.
      Returns:
      This object.