public static string GetAttributeWithInheritanceOrFail(XmlElement e, string name) { string v = GetAttributeWithInheritance(e, name); if (null == v) { throw new ParserException(e.ToString() + " missing \"" + name + "\" attribute"); } return v; }
public static XmlElement GetFirstChildOrFail(XmlElement e) { XmlElement kid = GetFirstChildElement(e); if (null == kid) { throw new ParserException(e.ToString() + " does not contain a child element"); } return kid; }
public static XmlElement GetChildByTagOrFail(XmlElement e, string name) { XmlElement kid = GetChildByTagName(e, name); if (null == kid) { throw new ParserException(e.ToString() + " missing \"" + name + "\" child element"); } return kid; }
public static string GetNonBlankTextOrFail(XmlElement e) { string v = GetText(e); if (null != v) v = v.Trim(); if (null == v || 0 == v.Length) { throw new ParserException(e.ToString() + " has no text"); } return v; }
private void LoadAssembly(XmlElement el, string currentDirectory) { if (el.Name == "Assembly" && el.HasAttribute("Path")) { string path = el.GetAttribute("Path"); FileInfo fInfo = new FileInfo(Path.Combine(currentDirectory, path)); if (!fInfo.Exists) fInfo = new FileInfo(path); if (fInfo.Exists) { try { Assembly loadedAssembly = Assembly.LoadFrom(fInfo.FullName); bool wasBehaviorAssembly = false; foreach (Type type in loadedAssembly.DefinedTypes) { if (type.BaseType != null && type.BaseType.FullName == "Hansoft.Jean.Behavior.AbstractBehavior") { behaviorTypes.Add(type); wasBehaviorAssembly = true; } } if (!wasBehaviorAssembly) { extensionAssemblies.Add(path); } } catch (Exception e) { logger.Exception("Error in configuration file JeanSettings.xml when loading assembly " + fInfo.FullName + ".", e); } } else logger.Error("Error in configuration file JeanSettings.xml. Could not find assembly file: " + path); } else logger.Error("Error in configuration file JeanSettings.xml. Malformed configuration of assemblies: " + el.ToString()); }
public XmlResult(XmlElement xmlElement) { Content = xmlElement.ToString(); ContentEncoding = Encoding.UTF8; ContentType = "text/xml"; }
protected void Write(XmlElement data) { ProtocolLog.WriteIf(XmppLog, "Outgoing: " + data.ToString()); lock(_write_lock) { _jc.Write(data); } }
/// <summary>Crap, we were denied access, all we can do is notify the user. /// Maybe they can change the user parameters and restart the process.</summary> protected void HandleAuthError(object sender, XmlElement rp) { ProtocolLog.WriteIf(ProtocolLog.Exceptions, rp.ToString()); }