from static method

XmlDoctype? from(
  1. String string, {
  2. bool parseCharacterEntities = true,
  3. bool parseComments = false,
  4. bool trimWhitespace = true,
  5. bool parseCdataAsText = true,
})
override

Returns the first XML DocType declaration found in string. string must not be null.

If parseCharacterEntities is true, text values will be parsed and replace all encoded character entities with their corresponding character. parseCharacterEntities must not be null.

If parseComments is true, commments will be scrubbed from string before parsing.

If trimWhitespace is true, unnecessary whitespace between nodes will be removed and all remaining whitespace will be replaced with a single space. trimWhitespace must not be null.

If parseCdataAsText is true, all CDATA sections will be returned as XmlText nodes. parseCdataAsText must not be null.

Returns null if no Doctype Declarations are found.

Implementation

static XmlDoctype? from(
  String string, {
  bool parseCharacterEntities = true,
  bool parseComments = false,
  bool trimWhitespace = true,
  bool parseCdataAsText = true,
}) {
  return parseString(
    string,
    parseCharacterEntities: parseCharacterEntities,
    parseComments: parseComments,
    trimWhitespace: trimWhitespace,
    parseCdataAsText: parseCdataAsText,
    stop: 0,
  )?.first;
}