using System; using System.Collections.Specialized; using System.Globalization; using System.IO; using System.Xml; using NAnt.Core.Attributes; using NAnt.Core.Util; namespace NAnt.Core.Types { [Serializable()] [ElementName("xml")] public class Xml : DataTypeBase { private XmlDocument _doc; public Xml() { _doc = new XmlDocument(); } public Xml(string xmldoc) { _doc = new XmlDocument(); _doc.LoadXml(xmldoc); } public Xml(XmlDocument xmldoc) { _doc=xmldoc; } protected override void InitializeElement(XmlNode elementNode) { if(elementNode.ChildNodes.Count!=1) throw new BuildException("Xml datatype must have one child node = root node", Location); XmlNode content = _doc.ImportNode(elementNode.FirstChild, true); _doc.AppendChild(content); } public XmlDocument XmlDocument { get { return _doc; } } } }