Exemplo n.º 1
0
            public XML writeXML()
            {
                XML re = new XML();

                re.name = "cls";
                re.setProperty("name", iCls.clsName);

                foreach (ILMethodInfo ilMethodInfo in iCls.methods)
                {
                    XML mXML = new XML();
                    mXML.name = "method";
                    mXML.setProperty("name", ilMethodInfo.name);
                    mXML.setProperty("returnType", ilMethodInfo.returnType);
                    mXML.setProperty("visitType", ilMethodInfo.visitType.ToString());

                    foreach (MethodArgInfo argInfo in ilMethodInfo.args)
                    {
                        XML aXML = new XML();
                        aXML.name = "arg";
                        aXML.setProperty("name", argInfo.name);
                        aXML.setProperty("type", argInfo.type);
                        aXML.setProperty("defaultValue", argInfo.defaultValue);
                        aXML.setProperty("autoLength", argInfo.autoLength ? "true" : "false");
                        aXML.setProperty("isIn", argInfo.isIn ? "true" : "false");
                        aXML.setProperty("isOut", argInfo.isOut ? "true" : "false");
                        aXML.setProperty("isRef", argInfo.isRef ? "true" : "false");

                        mXML.appendChild(aXML);
                    }

                    re.appendChild(mXML);
                }

                return(re);
            }
Exemplo n.º 2
0
        /** 递归构造XML */
        private static XML makeXML(XmlNode node)
        {
            XML xml = new XML();

            xml.name  = node.Name;
            xml.value = node.Value;

            int i = 0;

            XmlAttributeCollection xac = node.Attributes;

            if (xac != null)
            {
                for (i = 0; i < xac.Count; i++)
                {
                    xml.setProperty(xac[i].Name, xac[i].Value);
                }
            }

            XmlNodeList nodeList = node.ChildNodes;

            for (i = 0; i < nodeList.Count; i++)
            {
                if (nodeList[i].NodeType == XmlNodeType.Element)
                {
                    xml.appendChild(makeXML(nodeList[i]));
                }
            }

            return(xml);
        }