private void AddNamespace(XmlElement elem) { if (elem.Name != "namespace") { throw new Exception("Wrong element; expected 'namespace'."); } DefNameSpace spc = new DefNameSpace(elem, _managedNamespace); if (spc.NativeName.Contains("::")) { string pname = spc.NativeName.Substring(0, spc.NativeName.LastIndexOf("::")); foreach (DefNameSpace fns in NameSpaces) { if (fns.NativeName == pname) { spc.ParentNameSpace = fns; fns.ChildNameSpaces.Add(spc); break; } } } NameSpaces.Add(spc); }
private void AddAttributesInNamespace(DefNameSpace nameSpace, XmlElement elem) { foreach (XmlNode child in elem.ChildNodes) { if (child is XmlElement) { AddAttributesInType(nameSpace.GetDefType((child as XmlElement).GetAttribute("name")), child as XmlElement); } } }
public DefNameSpace GetNameSpace(string name) { DefNameSpace spc = null; foreach (DefNameSpace ns in NameSpaces) { if (ns.NativeName == name) { spc = ns; break; } } if (spc == null) { throw new Exception("couldn't find namespace"); } return(spc); }