类 Xml
java.lang.Object
com.darra.ethercat.utils.Xml
XML 配置工具类
对应 C# Utils/Xml.cs
提供 ENI/DENI 配置文件的导入/导出功能
-
嵌套类概要
嵌套类修饰符和类型类说明static class组配置数据static class主站 XML 配置 (对齐 C# MasterXMLConfiguration) 持有应用到主站的全局参数static classPDO 条目配置static classQoS 配置 EtherCAT 帧优先级和 VLAN 配置static class从站 DC 配置static class从站 XML 配置 (完整版)static classSyncManager 配置static classXML 配置导入结果 -
字段概要
字段 -
方法概要
修饰符和类型方法说明static booleanApplyXMLConfiguration(Xml.MasterXMLConfiguration config, EtherCATMaster master) 将 XML 配置应用到主站 (对应 C# ApplyXMLConfiguration)static StringdocumentToString(Document doc) 将 Document 转换为字符串static ElementfindChildIgnoreCase(Element parent, String name) 按名称 (忽略大小写) 查找第一个子元素static StringgetAttributeIgnoreCase(Element el, String name) 按名称 (忽略大小写) 获取属性值static byte解析 byte, 支持十六进制或十进制字符串static byte[]解析灵活的十六进制字符串, 支持可选的 0x 或 # 前缀static int解析 uint, 支持 "0x" 或 "#" 前缀的十六进制, 也支持十进制static short解析 short, 采用与 parseIntHexOrDec 相同的规则static DocumentparseXmlFile(String filePath) 解析 XML 文件static DocumentparseXmlString(String xml) 解析 XML 字符串static booleanwriteXmlFile(Document doc, String filePath) 将 Document 写入文件
-
字段详细资料
-
ENI_NS
ENI 标准命名空间 (无)- 另请参阅:
-
DENI_NS
DENI 扩展命名空间- 另请参阅:
-
-
方法详细资料
-
parseIntHexOrDec
解析 uint, 支持 "0x" 或 "#" 前缀的十六进制, 也支持十进制- 参数:
s- 字符串- 返回:
- 解析结果, 失败返回 0
-
parseShortHexOrDec
解析 short, 采用与 parseIntHexOrDec 相同的规则 -
parseByteHexOrDec
解析 byte, 支持十六进制或十进制字符串 -
parseXmlFile
解析 XML 文件- 参数:
filePath- 文件路径- 返回:
- Document 对象, 失败返回 null
-
parseXmlString
解析 XML 字符串- 参数:
xml- XML 字符串- 返回:
- Document 对象, 失败返回 null
-
findChildIgnoreCase
按名称 (忽略大小写) 查找第一个子元素 -
getAttributeIgnoreCase
按名称 (忽略大小写) 获取属性值 -
writeXmlFile
将 Document 写入文件- 参数:
doc- Document 对象filePath- 输出文件路径- 返回:
- 成功返回 true
-
documentToString
将 Document 转换为字符串- 参数:
doc- Document 对象- 返回:
- XML 字符串
-
parseHexStringFlexible
解析灵活的十六进制字符串, 支持可选的 0x 或 # 前缀- 参数:
hex- 十六进制字符串- 返回:
- 字节数组, 失败返回空数组
-
ApplyXMLConfiguration
public static boolean ApplyXMLConfiguration(Xml.MasterXMLConfiguration config, EtherCATMaster master) 将 XML 配置应用到主站 (对应 C# ApplyXMLConfiguration)- 参数:
config- 已加载的 XML 配置master- 主站实例- 返回:
- 是否成功
-