Class DomDTOParser

java.lang.Object
aQute.lib.xmldtoparser.DomDTOParser

public class DomDTOParser extends Object
Parse an XML file based on a DTO as schema
  • Constructor Details

    • DomDTOParser

      public DomDTOParser()
  • Method Details

    • parse

      public static <T> T parse(Class<T> type, File doc) throws Exception
      parse the given XML file based on the type as the schema. Attributes and elements are mapped to fields in an object of this type. If the field is a collection or a DTO type, the parse will be recursive.
      Parameters:
      type - the type acting as scheme
      doc - the file
      Returns:
      a DTO of type
      Throws:
      Exception
    • parse

      public static <T> T parse(Class<T> type, InputStream doc) throws Exception
      parse the given XML file based on the type as the schema. Attributes and elements are mapped to fields in an object of this type. If the field is a collection or a DTO type, the parse will be recursive.
      Parameters:
      type - the type acting as scheme
      doc - the file
      Returns:
      a DTO of type
      Throws:
      Exception