private void GetNodeProps() { XmlNode node = null; try{ node = xmlSource.Value; }catch (XPathException e) { Debug.LogWarning(e.Message); Fsm.Event(errorEvent); return; } if (node != null) { if (storeNodeProperties.Length > 0) { FsmXmlProperty.StoreNodeProperties(this.Fsm, node, storeNodeProperties); } else { storeProperties.StoreNodeProperties(this.Fsm, node); } found.Value = true; Fsm.Event(foundEvent); } else { found.Value = false; Fsm.Event(notFoundEvent); } Finish(); }
private void SelectSingleNode() { if (xmlSource.Value == null) { Debug.LogWarning("XMl source is empty, or likely invalid"); Fsm.Event(errorEvent); return; } string xPathQueryString = xPath.ParseXpathQuery(this.Fsm); XmlNode node = null; try{ node = xmlSource.Value.SelectSingleNode(xPathQueryString); }catch (XPathException e) { Debug.LogWarning(e.Message); Fsm.Event(errorEvent); return; } if (node != null) { if (!xmlResult.IsNone) { xmlResult.Value = DataMakerXmlUtils.XmlNodeToString(node); } if (storeNodeProperties.Length > 0) { FsmXmlProperty.StoreNodeProperties(this.Fsm, node, storeNodeProperties); } else { storeProperties.StoreNodeProperties(this.Fsm, node); } found.Value = true; Fsm.Event(foundEvent); } else { found.Value = false; Fsm.Event(notFoundEvent); } if (!string.IsNullOrEmpty(storeReference.Value)) { DataMakerXmlUtils.XmlStoreNode(node, storeReference.Value); } Finish(); }
void DoGetNextNode() { // no more items? int _count = _nodeList.Count; if (nextItemIndex >= _count) { nextItemIndex = 0; Fsm.Event(finishedEvent); return; } if (!string.IsNullOrEmpty(indexedNodeReference.Value)) { DataMakerXmlUtils.XmlStoreNode(_nodeList[nextItemIndex], indexedNodeReference.Value); } // get next item properties index.Value = nextItemIndex; if (storeNodeProperties.Length > 0) { FsmXmlProperty.StoreNodeProperties(this.Fsm, _nodeList[nextItemIndex], storeNodeProperties); } else { storeProperties.StoreNodeProperties(this.Fsm, _nodeList[nextItemIndex]); } // no more items? if (nextItemIndex >= _count) { Fsm.Event(finishedEvent); nextItemIndex = 0; return; } // iterate to next nextItemIndex++; if (loopEvent != null) { Fsm.Event(loopEvent); } }