MsDeviceParameter.fromXML constructor
MsDeviceParameter.fromXML(
- String xmlSTR
Implementation
factory MsDeviceParameter.fromXML(String xmlSTR) {
final document = XmlDocument.parse(xmlSTR);
XmlElement? vendorModelInfoElement =
document.firstChild!.getElement("vendorModelInfo");
XmlElement? ipAndPortElement = document.firstChild!.getElement("ipAndPort");
XmlElement? statusElement = document.firstChild!.getElement("msStatus");
VendorModelInfo vendorModelInfo =
VendorModelInfo.fromXML(vendorModelInfoElement!.toXmlString());
IpAndPort ipAndPort = IpAndPort.fromXML(ipAndPortElement!.toXmlString());
MsStatus status = MsStatus.fromXML(statusElement!.toXmlString());
String numberOfTracks = document.firstChild!.attributes
.firstWhere((element) => element.name.toString() == "numberOfTracks")
.value;
String supportsJIS2 = document.firstChild!.attributes
.firstWhere((element) => element.name.toString() == "supportsJIS2")
.value;
String style = document.firstChild!.attributes
.firstWhere((element) => element.name.toString() == "style")
.value;
String msCapabilities = document.firstChild!.attributes
.firstWhere((element) => element.name.toString() == "msCapabilities",
orElse: orElseEmpty)
.value;
return MsDeviceParameter(
vendorModelInfo: vendorModelInfo,
ipAndPort: ipAndPort,
status: status,
numberOfTracks: numberOfTracks,
supportsJIS2: supportsJIS2,
style: style,
msCapabilities: msCapabilities,
);
}