private AttributesMap ParseAttributesForXmlNode(XmlNode rootNode, out bool useMessageMarker)
        {
            useMessageMarker = false;
            if (rootNode == null)
            {
                return(null);
            }

            AttributesMap result = new AttributesMap();

            foreach (XmlNode node in rootNode)
            {
                IList <XmlAttribute> list = new List <XmlAttribute>();
                if (node.Attributes != null)
                {
                    foreach (XmlAttribute attribute in node.Attributes)
                    {
                        if (attribute.LocalName == MESSAGE_MARKER_ATTRIBUTE_NAME)
                        {
                            useMessageMarker = true;
                        }
                        list.Add(attribute);
                    }
                }

                bool useMessageMarkerInChild;
                result.Add(node.Name, new KeyValuePair <IList <XmlAttribute>, AttributesMap>(list, ParseAttributesForXmlNode(node, out useMessageMarkerInChild)));
                useMessageMarker |= useMessageMarkerInChild;
            }

            return(result);
        }
        private AttributesMap PrepareAttributesMap(string xmlText, out bool useMessageMarker)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xmlText);
            AttributesMap result = ParseAttributesForXmlNode(doc.DocumentElement, out useMessageMarker);

            return(result);
        }
        public RawXMLWithHeaderToJsonReader(string xmlTemplate, bool outputAsXml, string address, NetworkCredential credential)
        {
            _templateAttributesMap = PrepareAttributesMap(xmlTemplate, out _useMessageMarker);

            _credential        = credential;
            _initialApiAddress = address;
            _currentApiAddress = address;

            _outputAsXml = outputAsXml;
        }
Example #4
0
    // Start is called before the first frame update
    void Start()
    {
        panel.SetActive(false);


        //get ability from database,now is AttributesMap script

        abilityMap = AttributesMap.get(name);
        abilities  = AttributesMap.getAbilityNames(name);
        updatePanel();
    }
        private void ApplyTemplateAttributes(XmlNode rootNode, AttributesMap templateMap, Action <XmlNode, XmlAttribute> applyAttributeToNode)
        {
            if (rootNode == null)
            {
                return;
            }

            foreach (XmlNode node in rootNode)
            {
                if (!templateMap.ContainsKey(node.Name))
                {
                    continue;
                }

                foreach (XmlAttribute attributeInTemplate in templateMap[node.Name].Key)
                {
                    applyAttributeToNode(node, attributeInTemplate);
                }
                ApplyTemplateAttributes(node, templateMap[node.Name].Value, applyAttributeToNode);
            }
        }