Example #1
0
        /// <summary>
        /// Parse all the lignes from the doc and return them.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="CommandsCount"></param>
        /// <returns></returns>
        public static List <Ligne> parseCommandDetails(XmlDocument doc)
        {
            List <Ligne> results = new List <Ligne>();

            int i = 1;

            while (ParsingUtils.exist("detection_existence_ligne", doc, i))
            {
                Ligne ligne = new Ligne();

                ligne.data = ParsingUtils.getData(ligne.getKey(), doc, i);

                results.Add(ligne);

                ++i;

                if (logger.IsDebugEnabled)
                {
                    logger.Debug("Parsed ligne data: ");

                    StringBuilder sb = new StringBuilder("\n");

                    foreach (string key in ligne.data.Keys)
                    {
                        sb.Append(key);
                        sb.Append(":");
                        sb.AppendLine(ligne.data[key]);
                    }
                    logger.Debug(sb.ToString());
                }
            }


            return(results);
        }
Example #2
0
        public static Article parseEanDetailsResponse(XmlDocument doc)
        {
            Article article = new Article();

            article.data = ParsingUtils.getData(article.getKey(), doc);

            if (logger.IsDebugEnabled)
            {
                logger.Debug("Parsed Article data: ");

                StringBuilder sb = new StringBuilder("\n");

                foreach (string key in article.data.Keys)
                {
                    sb.Append(key);
                    sb.Append(":");
                    sb.AppendLine(article.data[key]);
                }
                logger.Debug(sb.ToString());
            }

            return(article);
        }
Example #3
0
        /// <summary>
        /// Parse a number CommandsCount of commands from the response.
        /// Never returns more than CommandsCount ResumeCommande, but returns less
        /// if there's less than that in the document to parse.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="CommandsCount"></param>
        /// <returns></returns>
        public static List <ResumeCommande> parseCommandsListResponse(XmlDocument doc, int CommandsCount)
        {
            List <ResumeCommande> results = new List <ResumeCommande>();

            for (int i = 1; i <= CommandsCount; i++)
            {
                ResumeCommande commande = new ResumeCommande();

                // We need to increment i because the first tr row is for table headers.
                commande.data = ParsingUtils.getData(commande.getKey(), doc, i + 1);

                if (!commande.hasData())
                {
                    logger.Debug("No more results found to parse in Resume Commande after " + results.Count + " commandes");
                    return(results);
                }

                results.Add(commande);

                if (logger.IsDebugEnabled)
                {
                    logger.Debug("Parsed ResumeCommande data: ");

                    StringBuilder sb = new StringBuilder("\n");

                    foreach (string key in commande.data.Keys)
                    {
                        sb.Append(key);
                        sb.Append(":");
                        sb.AppendLine(commande.data[key]);
                    }
                    logger.Debug(sb.ToString());
                }
            }

            return(results);
        }