Beispiel #1
0
 /// <summary>See <see cref="XmlReader.this[string, string]"/></summary>
 public override string this[string name, string namespaceURI]
 {
     get
     {
         return(base[
                    NameTable.Add(XmlFirstLowerWriter.MakeFirstLower(name)), namespaceURI]);
     }
 }
		public void XmlFirstLowerWriter()
		{
			string xml = "<Customer Id=\"1\" pp:Id=\"aba\" xmlns=\"urn-kzu\" xmlns:pp=\"urn-pepenamespace\"><pp:Order /><Order Id=\"1\">chocolates</Order></Customer>";

			XmlTextReader tr = new XmlTextReader(new StringReader(xml));
			
			StringWriter sw = new StringWriter();
			XmlFirstLowerWriter fw = new XmlFirstLowerWriter(sw);
            
			fw.WriteNode(tr, true);
			fw.Flush();

			Assert.AreEqual(xml.ToLower(), sw.ToString());
		}
Beispiel #3
0
 /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary>
 public override bool MoveToAttribute(string name, string ns)
 {
     return(base.MoveToAttribute(
                NameTable.Add(XmlFirstLowerWriter.MakeFirstLower(name)), ns));
 }
Beispiel #4
0
 /// <summary>See <see cref="XmlReader.this[string, string]"/></summary>
 public override string this[string name, string namespaceUri] => base[
     NameTable.Add(XmlFirstLowerWriter.MakeFirstLower(name)), namespaceUri];
		public void Serialization()
		{
			XmlFirstUpperReader fu = new XmlFirstUpperReader(Globals.GetResource( 
				this.GetType().Namespace + ".Customer.xml"));
			XmlSerializer ser = new XmlSerializer(typeof(Customer));
			Customer c = (Customer) ser.Deserialize(fu);

			StringWriter sw = new StringWriter();
			XmlFirstLowerWriter fl = new XmlFirstLowerWriter(sw);

			ser.Serialize(fl, c);

			Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-16\"?><customer xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" id=\"0736\" xmlns=\"mvp-xml-customer\"><name>Daniel Cazzulino</name><order id=\"25\" /></customer>", 
				sw.ToString());
		}