0
myXML =Получить dgType значение атрибута из XML-дерева
<dgInfoList><DGRec0 desc="Analog Input 'AI 1 Slot2'" type="AI" dgType="AI" ordinal="25" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000043" device="BRW_08_09_EFM"/><DGRec1 desc="Analog Input 'Brown 8TBG'" type="AI" dgType="AI" ordinal="26" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000044" device="BRW_08_09_EFM"/><DGRec2 desc="Analog Input 'Brown 8CSG'" type="AI" dgType="AI" ordinal="27" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000045" device="BRW_08_09_EFM"/><DGRec3 desc="Analog Input 'Brown 9TBG'" type="AI" dgType="AI" ordinal="28" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000046" device="BRW_08_09_EFM"/><DGRec4 desc="Analog Input 'Brown 9CSG'" type="AI" dgType="AI" ordinal="29" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000047" device="BRW_08_09_EFM"/><DGRec5 desc="Basic Poll" type="BasicPoll" dgType="BasicPoll" ordinal="0" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000007" device="BRW_08_09_EFM"/><DGRec6 desc="Time/Date" type="DateTime" dgType="DateTime" ordinal="0" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000008" device="BRW_08_09_EFM"/><DGRec7 desc="GenTLP-Tbg Csg/BatVolt/BasicPoll" type="GenTLP" dgType="GenTLP" ordinal="3" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000048" device="BRW_08_09_EFM"/><DGRec8 desc="History Point List" type="HistPtCfg" dgType="HistPtCfg" ordinal="0" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000021" device="BRW_08_09_EFM"/><DGRec9 desc="I/O Point List" type="IoPntCfg" dgType="IoPntCfg" ordinal="0" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000042" device="BRW_08_09_EFM"/><DGRec10 desc="ROC Config" type="RtuConfig" dgType="RtuConfig" ordinal="1" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000022" device="BRW_08_09_EFM"/><DGRec11 desc="System Variables" type="SysVars" dgType="SysVars" ordinal="0" facility="BRW_08_09_EFM" visible="1" webEnabled="0" dbKey="0000001510B0000026" device="BRW_08_09_EFM"/><DGRec12 desc="AGA Flow Calc Values" type="AGAFlowVal" dgType="AGAFlowVal" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000001" device="BRW_08_09_EFM"/><DGRec13 desc="AGA Gas/Flow Parms '0624040002'" type="AGAParams" dgType="AGAParams" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000004" device="BRW_08_09_EFM"/><DGRec14 desc="GMR Configuration Send Data" type="GmrCfgSend" dgType="GmrCfgSend" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000009" device="BRW_08_09_EFM"/><DGRec15 desc="GMR Configuration Data" type="GmrConfig" dgType="GmrConfig" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000012" device="BRW_08_09_EFM"/><DGRec16 desc="GMR Events Data" type="GmrEvent" dgType="GmrEvent" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000015" device="BRW_08_09_EFM"/><DGRec17 desc="GMR History Data" type="GmrHist" dgType="GmrHist" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000018" device="BRW_08_09_EFM"/><DGRec18 desc="Meter Config Params (Basic)" type="MetCfg" dgType="MetCfg" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000031" device="BRW_08_09_EFM"/><DGRec19 desc="Meter Config Params (Extra 107)" type="MetCfg107" dgType="MetCfg107" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000033" device="BRW_08_09_EFM"/><DGRec20 desc="Meter Flow Values (Basic)" type="MetFlow" dgType="MetFlow" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000035" device="BRW_08_09_EFM"/><DGRec21 desc="Meter Flow Values (Extra 107)" type="MetFlowE" dgType="MetFlowE" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000037" device="BRW_08_09_EFM"/><DGRec22 desc="Run Parameters '0624040002'" type="RunParm" dgType="RunParm" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000023" device="BRW_08_09_EFM"/><DGRec23 desc="Extra Run Parameters '0624040002" type="XRunParm" dgType="XRunParm" ordinal="1" facility="BRW_08_09_TS_GM01" visible="1" webEnabled="0" dbKey="0000001510B0000027" device="BRW_08_09_EFM"/></dgInfoList>
Для каждого из DGRec#
я хотел бы получить значение dgType
.
Невозможно понять, как использовать XMLDOM, чтобы это произошло.
Set xmlDoc1 = CreateObject("Msxml2.DOMDocument")
xmlDoc1.setProperty "SelectionLanguage", "XPath"
xmlDoc1.loadXML(myXML)
как насчет того, хотел ли я dgType и порядковый номер одновременно? – ZareenD
в принципе, я бы хотел пройти через этот большой xml и только захватить dgType, если это «GmrHist» и соответствующий порядковый номер – ZareenD
@ ZareenD Вы должны были упомянуть об этом в своем вопросе. См. Обновленный ответ. –