Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
            }
        }