/// <summary> /// Fonction qui permet de renvoyer la liste des colonnes de types de retour des interfaces de service /// </summary> /// <param name="doc"></param> /// <param name="nsmgr"></param> /// <returns></returns> public static TypeRetourInterfaceService TypesRetourInterfacesServices(XmlDocument doc, XmlNamespaceManager nsmgr, int i) { XmlNodeList nodeList2; XmlElement root = doc.DocumentElement; List <string> ListeTypeRetourInterfacesServices = new List <string>(); if (Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1) != 0) { for (int cmp = 0; cmp < Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1) + 1; cmp++) { string xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][3]/ following-sibling::w:tbl / w:tr /w:tc [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 2) + "]/preceding-sibling:: w:tbl / w:tr /w:tc )= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 2) + "]/preceding-sibling:: w:tbl / w:tr /w:tc)]"; if (i == InterfaceService.NomsInterfacesServices(doc, nsmgr).Count&& cmp == Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1)) { xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][3]/ following-sibling::w:tbl / w:tr /w:tc [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2]/preceding-sibling:: w:tbl / w:tr /w:tc )= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][2] /preceding-sibling:: w:tbl / w:tr /w:tc)]"; } if (i < InterfaceService.NomsInterfacesServices(doc, nsmgr).Count&& cmp == Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1) - 1) { xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][3]/ following-sibling::w:tbl / w:tr /w:tc [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + (i + 1) + "]/preceding-sibling:: w:tbl / w:tr /w:tc )= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + (i + 1) + "]/preceding-sibling:: w:tbl / w:tr /w:tc)]"; } nodeList2 = root.SelectNodes(xpath, nsmgr); foreach (XmlNode isbn2 in nodeList2) { ListeTypeRetourInterfacesServices.Add(isbn2.InnerText); } } } if (ListeTypeRetourInterfacesServices.Count == 0) { return(new TypeRetourInterfaceService("NA", "NA")); } else { return(new TypeRetourInterfaceService(ListeTypeRetourInterfacesServices[2], ListeTypeRetourInterfacesServices[3])); } }
/// <summary> /// Retourne la liste des interfaces de service du fichier /// </summary> /// <param name="doc"></param> /// <param name="nsmgr"></param> /// <returns></returns> public static List <InterfaceService> InterfacesService(XmlDocument doc, XmlNamespaceManager nsmgr) { List <InterfaceService> interfacesServices = new List <InterfaceService>(); List <string> noms = NomsInterfacesServices(doc, nsmgr); for (int i = 1; i < NomsInterfacesServices(doc, nsmgr).Count + 1; i++) { List <Methode> methodes = Methode.Methodes(doc, nsmgr, i); string descriptions = DescriptionsInterfacesServices(doc, nsmgr, i); if (Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1) != 0) { interfacesServices.Add(new InterfaceService(noms[i - 1], descriptions, methodes)); } if (Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1) == 0) { interfacesServices.Add(new InterfaceService(noms[i - 1], descriptions)); } } return(interfacesServices); }
public static List <ParametreInterfaceService> ParametresInterfacesServices(XmlDocument doc, XmlNamespaceManager nsmgr, int i) { XmlNodeList nodeList2; XmlElement root = doc.DocumentElement; List <string> ListeParametresInterfacesServices = new List <string>(); if (Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1) != 0) { for (int cmp = 0; cmp < Methode.NombreMethodesInterfacesServices(doc, nsmgr, i - 1) + 1; cmp++) { string xpath = @"// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][2]/ following-sibling::w:tbl / w:tr /w:tc [count(. | // w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][3]/preceding-sibling:: w:tbl / w:tr /w:tc )= count(// w:p [ w:pPr / w:pStyle [@w:val='Heading1']][3] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading2']][1] /following:: w:p [ w:pPr / w:pStyle [@w:val='Heading3']][" + i + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading4']][2]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading5']][" + (cmp + 1) + "]/following:: w:p [ w:pPr / w:pStyle [@w:val='Heading6']][3]/preceding-sibling:: w:tbl / w:tr /w:tc)]"; nodeList2 = root.SelectNodes(xpath, nsmgr); foreach (XmlNode isbn2 in nodeList2) { ListeParametresInterfacesServices.Add(isbn2.InnerText); } } } return(ListeAParametresInterfacesServices(ListeParametresInterfacesServices)); }