コード例 #1
0
 /// <summary>
 /// Make the Consignments enumerable according to the CREATE section of the doc.
 /// Then index the Consignments for each of the relevant sections.
 /// Assumption: The CREATE section exists, or we have no Consignments.
 /// </summary>
 private bool Initialize(IndexBy indexBy)
 {
     IdPropertyXPath = XPathExpression.Compile("./" + indexBy.ToString() + "/text()");
     //determine available sections
     hasCreate       = doc.NodeExists("/document/CREATE");
     hasBook         = doc.NodeExists("/document/BOOK");
     hasShip         = doc.NodeExists("/document/SHIP");
     hasPrint        = doc.NodeExists("/document/PRINT");
     hasError        = doc.NodeExists("//ERROR");
     hasRuntimeError = doc.NodeExists("/runtime_error");
     //prepare iterator and indexes
     if (doc.NodeExists("/document"))
     {
         if (hasCreate)
         {
             createEnum  = doc.GetChildEnumerable(XPathExpression.Compile("/document"), "CREATE");
             createIndex = doc.GetChildIndex(XPathExpression.Compile("/document"), "CREATE", IdPropertyXPath);
         }
         if (hasBook)
         {
             bookIndex = doc.GetChildIndex(XPathExpression.Compile("/document/BOOK"), "CONSIGNMENT", IdPropertyXPath);
         }
         if (hasShip)
         {
             shipIndex = doc.GetChildIndex(XPathExpression.Compile("/document/SHIP"), "CONSIGNMENT", IdPropertyXPath);
         }
         //...etc
         return(true);
     }
     else
     {
         return(false); //after all, not worthy of further investigation.
     }
 }
コード例 #2
0
ファイル: IndexNode.cs プロジェクト: weihangChen/demoapp
 public override string ToString()
 {
     return(IndexBy.ToString());
 }