/// <summary> Get double attribute. </summary> public static double dA(this XmlElement self, string attribName, double @default = -1.0) { var attrib = self.A(attribName); if (attrib == null) { return(@default); } return(double.Parse(attrib)); // let it throw if not a number }
/// <summary> Get boolean attribute. </summary> public static bool bA(this XmlElement self, string attribName, bool @default = false) { var attrib = self.A(attribName); if (attrib == null) { return(@default); } return(bool.Parse(attrib)); }
private static byte[] EncodeParsToSoap(Hashtable Pars, String XmlNs, String MethodName) { XmlDocument doc = new XmlDocument(); doc.LoadXml("http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">"); AddDelaration(doc); //XmlElement soapBody = doc.createElement_x_x_x_x("soap", "Body", "http://schemas.xmlsoap.org/soap/envelope/"); XmlElement soapBody = doc.CreateElement("soap", "Body", "http://schemas.xmlsoap.org/soap/envelope/"); //XmlElement soapMethod = doc.createElement_x_x_x_x(MethodName); XmlElement soapMethod = doc.CreateElement(MethodName); soapMethod.SetAttribute("xmlns", XmlNs); foreach (string k in Pars.Keys) { //XmlElement soapPar = doc.createElement_x_x_x_x(k); XmlElement soapPar = doc.CreateElement(k); soapPar.InnerXml = ObjectToSoapXml(Pars[k]); soapMethod.A(soapPar); } soapBody.A(soapMethod); doc.DocumentElement.A(soapBody); return Encoding.UTF8.GetBytes(doc.OuterXml); }
public static void TweakA(this XmlElement self, XmlElement mod) { ChildrenTweak(self, mod.A("Name"), mod.dA("Multiply", 1.0), mod.dA("Add", 0), mod.dA("Round", 0)); }
public static void ChildTweak(this XmlElement self, XmlElement mod) { ChildTweak(self, mod.A("Tag"), mod.dA("Multiply", 1.0), mod.dA("Add", 0), mod.dA("Round", 0)); }