Example #1
0
        /// <include file='../docs.xml'
        /// path='docs/doc[@name="M:PeterO.XEWriter.Create(System.Xml.XmlWriter,System.String,System.String)"]/*'/>
        public static XEWriter Create(XmlWriter writer, string localName, string ns)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (localName == null)
            {
                throw new ArgumentNullException("localName");
            }
            if (localName.Length == 0)
            {
                throw new ArgumentException("localName" + " is empty.");
            }
            var w = new XEWriter(writer, true);

            if (String.IsNullOrEmpty(ns))
            {
                w.writer.WriteStartElement(localName);
            }
            else
            {
                w.writer.WriteStartElement(localName, ns);
            }
            return(w);
        }
Example #2
0
        /// <include file='../docs.xml'
        /// path='docs/doc[@name="M:PeterO.XEWriter.Create(System.String,System.String,System.String,System.Boolean)"]/*'/>
        public static XEWriter Create(
            string file,
            string localName,
            string ns,
            bool indent)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }
            if (file.Length == 0)
            {
                throw new ArgumentException("file" + " is empty.");
            }
            if (localName == null)
            {
                throw new ArgumentNullException("localName");
            }
            if (localName.Length == 0)
            {
                throw new ArgumentException("localName" + " is empty.");
            }
            var xws = new XmlWriterSettings();

            xws.Indent = indent;
            var w = new XEWriter(XmlWriter.Create(file, xws), false);

            if (String.IsNullOrEmpty(ns))
            {
                w.writer.WriteStartElement(localName);
            }
            else
            {
                w.writer.WriteStartElement(localName, ns);
            }
            return(w);
        }
Example #3
0
       /// <include file='../docs.xml'
       /// path='docs/doc[@name="M:PeterO.XEWriter.Create(System.String,System.String,System.String,System.Boolean)"]/*'/>
       public static XEWriter Create(
 string file,
 string localName,
 string ns,
 bool indent)
       {
           if (file == null) {
           throw new ArgumentNullException("file");
             }
             if (file.Length == 0) {
           throw new ArgumentException("file" + " is empty.");
             }
             if (localName == null) {
           throw new ArgumentNullException("localName");
             }
             if (localName.Length == 0) {
           throw new ArgumentException("localName" + " is empty.");
             }
             var xws = new XmlWriterSettings();
             xws.Indent = indent;
             var w = new XEWriter(XmlWriter.Create(file, xws), false);
             if (String.IsNullOrEmpty(ns)) {
           w.writer.WriteStartElement(localName);
             } else {
           w.writer.WriteStartElement(localName, ns);
             }
             return w;
       }
Example #4
0
 /// <include file='../docs.xml'
 /// path='docs/doc[@name="M:PeterO.XEWriter.Create(System.Xml.XmlWriter,System.String,System.String)"]/*'/>
 public static XEWriter Create(XmlWriter writer, string localName, string ns)
 {
     if (writer == null) {
     throw new ArgumentNullException("writer");
       }
       if (localName == null) {
     throw new ArgumentNullException("localName");
       } if (localName.Length == 0) {
     throw new ArgumentException("localName" + " is empty.");
       }
       var w = new XEWriter(writer, true);
       if (String.IsNullOrEmpty(ns)) {
     w.writer.WriteStartElement(localName);
       } else {
     w.writer.WriteStartElement(localName, ns);
       }
       return w;
 }