// Use this for initialization void Start() { nXML.jxDocument doc = nXML.jxDocument.Load(test_xml_file_simple.name, test_xml_file_simple.text); jDebug.jASSERT(doc != null && doc.m_Root != null); string outString = ""; doc.m_Root.WriteToString(ref outString); Debug.Log("doc = " + outString); string aaS = ""; jxE aa = doc.m_Root.Find("aa"); jDebug.jASSERT(aa.GetTagName() == "aa"); aa.WriteToString(ref aaS); //Debug.Log("aa = " + aaS); string aa1S = ""; jxE aa1 = aa.MakeClone(); aa1.WriteToString(ref aa1S); //Debug.Log("aa1 = " + aa1S); jDebug.jASSERT(aaS == aa1S); jDebug.jASSERT(aa1.GetParent() == null); doc.m_Root.InsertChild(aa1); outString = ""; doc.m_Root.WriteToString(ref outString); Debug.Log("doc = " + outString); }
// Use this for initialization void Start() { Debug.Log("test_jXml Start===================================="); // Load a text asset XML file from the assets/resources folder //m_doc = Resources.Load("Assets/xml_test", typeof(TextAsset)) as TextAsset; //m_doc = Resources.Load("test_xml") as TextAsset; //m_doc = (TextAsset)Resources.LoadAssetAtPath("xml/xml_test.txt", typeof(TextAsset)); nXML.jxDocument doc = nXML.jxDocument.Load(test_xml_file.name, test_xml_file.text); jDebug.jASSERT(doc != null && doc.m_Root != null); string outString = ""; doc.m_Root.WriteToString(ref outString); Debug.Log(outString); jDebug.jASSERT(doc.m_Root.Attr("b") == "B"); jxE stage = doc.m_Root.Find("stage"); jDebug.jASSERT(stage != null); jDebug.jASSERT(stage.GetIndex() == jIndexString.GetIndex("stage")); jxE mapii = stage.Find("mapii"); jDebug.jASSERT(mapii != null); jDebug.jASSERT(mapii.IsEType(nXML.EDataType.e_int_array)); jDebug.jASSERT(mapii.Get_int(0) == 255); jDebug.jASSERT(mapii.Get_int(2) == 0); jxV v = stage.AttrVar("c3"); jDebug.jASSERT(v.IsEType(nXML.EDataType.e_float_array)); jDebug.jASSERT(v.Get_float(2) == 3); // test duplcated load; // doc = nXML.jxDocument.Load(test_xml_file.name, test_xml_file.text); // jDebug.jASSERT(doc == null, "duplicated xml loading must be fail"); Debug.Log("test_jXml End===================================="); }