copyWith method
Copies this DocType declaration with the provided values.
name
must be > 0
in length if not null
.
Either isSystem
or isPublic
may be true
, not both.
If copyNull
is true
, externalDtdName
, externalDtdUri
,
externalDtd
, and internalDtd
will be copied with a value
of null
if they're not provided with another value, otherwise
they will default to this element's values.
Implementation
XmlDoctype copyWith({
String? element,
bool? isSystem,
bool? isPublic,
String? externalDtdName,
String? externalDtdUri,
List<XmlNode>? externalDtd,
List<XmlNode>? internalDtd,
bool copyNull = false,
}) {
assert(element == null || element.isNotEmpty);
assert(isPublic == null || isSystem == null || !(isPublic && isSystem));
if (!copyNull) {
externalDtdName ??= this.externalDtdName;
externalDtdUri ??= this.externalDtdUri;
externalDtd ??= this.externalDtd;
internalDtd ??= this.internalDtd;
}
isSystem ??= isPublic == true ? false : this.isSystem;
isPublic ??= isSystem == true ? false : this.isPublic;
return XmlDoctype(
element: element ?? this.element,
isSystem: isSystem,
isPublic: isPublic,
externalDtdName: externalDtdName,
externalDtdUri: externalDtdUri,
externalDtd: externalDtd,
internalDtd: internalDtd,
);
}