Пример #1
0
        static void TestRapidXml()
        {
            using (RapidXmlParser xml = new RapidXmlParser())
            {
                try
                {
                    string InContent = System.Text.Encoding.UTF8.GetString(System.IO.File.ReadAllBytes(@"G:\xxx.xml"));

                    xml.Load(InContent);

                    NodeElement projectNode = xml.FirstNode("Project");

                    NodeElement.EditorAssert(projectNode.IsValid());

                    NodeElement templateObjectListNode = projectNode.FirstNode("TemplateObjectList");
                    NodeElement actionNode             = projectNode.FirstNode("Action");
                    NodeElement refParamNode           = projectNode.FirstNode("RefParamList");

                    NodeElement.EditorAssert(templateObjectListNode.IsValid());
                    NodeElement.EditorAssert(actionNode.IsValid());
                    NodeElement.EditorAssert(refParamNode.IsValid());
                }
                catch (System.Exception e)
                {
                    UnityEngine.Debug.LogError(e.Message);
                }
            }
        }
Пример #2
0
        public string GetValue()
        {
            EditorAssert(IsValid());

            IntPtr Result = RapidXmlParser.GetAttributeValuePtr(Document.NativeDocumentPtr, NativeAttrPtr);

            return(Result != IntPtr.Zero ? Marshal.PtrToStringAnsi(Result) : "");
        }
Пример #3
0
        public string GetName()
        {
            EditorAssert(IsValid());

            IntPtr Result = RapidXmlParser.GetNodeTagPtr(Document.NativeDocumentPtr, NativeNodePtr);

            return(Result != IntPtr.Zero ? Marshal.PtrToStringAnsi(Result) : "");
        }
Пример #4
0
        // the same with AttributeString
        // created for compatible
        public string Attribute(string InName)
        {
            EditorAssert(IsValid());

            IntPtr Result = RapidXmlParser.AttributeStringPtr(Document.NativeDocumentPtr, NativeNodePtr, InName);

            return(Result != IntPtr.Zero ? Marshal.PtrToStringAnsi(Result) : "");
        }
Пример #5
0
        public NodeAttribute NextAttribute(string InName = null)
        {
            EditorAssert(IsValid());

            NodeAttribute Attr = new NodeAttribute();

            Attr.Document      = this.Document;
            Attr.NativeAttrPtr = string.IsNullOrEmpty(InName) ?
                                 RapidXmlParser.NextAttributePtr(Document.NativeDocumentPtr, NativeAttrPtr) :
                                 RapidXmlParser.NextAttributePtrWithName(Document.NativeDocumentPtr, NativeAttrPtr, InName);

            return(Attr);
        }
Пример #6
0
        public NodeElement NextSibling(string InName = null)
        {
            EditorAssert(IsValid());

            NodeElement Element = new NodeElement();

            Element.Document      = Document;
            Element.NativeNodePtr =
                string.IsNullOrEmpty(InName) ?
                RapidXmlParser.NextSiblingPtr(Document.NativeDocumentPtr, NativeNodePtr) :
                RapidXmlParser.NextSiblingPtrWithName(Document.NativeDocumentPtr, NativeNodePtr, InName);

            return(Element);
        }
Пример #7
0
        public double GetDouble()
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.GetAttributeValueDouble(Document.NativeDocumentPtr, NativeAttrPtr));
        }
Пример #8
0
        public float GetFloat()
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.GetAttributeValueFloat(Document.NativeDocumentPtr, NativeAttrPtr));
        }
Пример #9
0
        public UInt64 GetUInt64()
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.GetAttributeValueUInt(Document.NativeDocumentPtr, NativeAttrPtr));
        }
Пример #10
0
        public bool GetBool()
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.GetAttributeValueBool(Document.NativeDocumentPtr, NativeAttrPtr));
        }
Пример #11
0
        public int GetAttributeCount()
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.GetAttributeCount(Document.NativeDocumentPtr, NativeNodePtr));
        }
Пример #12
0
        public float AttributeFloat(String InName)
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.AttributeFloat(Document.NativeDocumentPtr, NativeNodePtr, InName));
        }
Пример #13
0
        public uint AttributeUInt(string InName)
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.AttributeUInt(Document.NativeDocumentPtr, NativeNodePtr, InName));
        }
Пример #14
0
        public bool HasAttribute(String InName)
        {
            EditorAssert(IsValid());

            return(RapidXmlParser.HasAttribute(Document.NativeDocumentPtr, NativeNodePtr, InName));
        }