/// <summary> /// xml 문서를 만든다. /// </summary> /// <param name="eType"></param> /// <param name="isStandAlone"></param> public void XML_Create(EncodingType eType, bool isStandAlone, stNodeValue RootNode) { xml = new XmlDocument(); XmlDeclaration dec = xml.CreateXmlDeclaration("1.0", EncodingType2String(eType), isStandAlone ? "yes" : "no"); xml.InsertBefore(dec, xml.DocumentElement); if (RootNode != null) { Node_Add(RootNode, null); } chNode2Root(); //chSingleNode(RootNode.Name); }
/// <summary> /// xml에 노드를 추가 한다. /// </summary> /// <param name="node"></param> /// <param name="Atts">추가할 속성 없으면 null</param> public void Node_Add(stNodeValue node, stNodeValue[] Atts) { if (node.namespaceUri == null) { node.namespaceUri = string.Empty; } if (node.InnerText == null) { node.InnerText = string.Empty; } XmlNode xn; if (node.preFix == null || node.preFix == string.Empty) { xn = xml.CreateNode(XmlNodeType.Element, node.Name, node.namespaceUri); } else { xn = xml.CreateNode(XmlNodeType.Element, node.preFix, node.Name, node.namespaceUri); } if (Atts != null) { Node_Attribute_Add(xn, Atts); } xn.InnerText = node.InnerText; if (xmlNode == null) { xml.AppendChild(xn); } else { xmlNode.AppendChild(xn); } }