Ejemplo n.º 1
0
        public void CustomSIFElementEncoding()
        {
            SIF_Query q = new SIF_Query();
            q.SIF_QueryObject = new SIF_QueryObject( StudentDTD.STUDENTPERSONAL.Name );
            SIF_Conditions conditions = new SIF_Conditions( ConditionType.NONE );
            conditions.AddSIF_Condition( "Name[@Type=\"05\"]/LastName", Operators.EQ, "Cookie" );
            q.SetSIF_ConditionGroup( ConditionType.NONE, conditions );

            string xml;
            using ( StringWriter w = new StringWriter() )
            {
                SifWriter writer = new SifWriter( w );
                writer.Write( q );
                writer.Flush();
                writer.Close();
                xml = w.ToString();
            }

            Console.WriteLine( xml );
            // Mainly, just check to make sure that the single quotes didn't get encoded
            int index = xml.IndexOf( """ );
            Assert.AreEqual( -1, index, "Single quotes should not be encoded" );
        }
Ejemplo n.º 2
0
 private static SIF_Conditions createConditions(Query query, ConditionGroup group, SifVersion effectiveVersion)
 {
     ConditionType typ = ConditionType.NONE;
     if (group.Operator == GroupOperator.And)
     {
         typ = ConditionType.AND;
     }
     else if (group.Operator == GroupOperator.Or)
     {
         typ = ConditionType.OR;
     }
     Condition[] conditions = group.Conditions;
     SIF_Conditions conds = new SIF_Conditions(conditions.Length > 1 ? typ : ConditionType.NONE);
     foreach (Condition c in conditions)
     {
         conds.AddSIF_Condition(
             c.GetXPath(query, effectiveVersion),
             Operators.Wrap(c.Operators.ToString()),
             c.Value);
     }
     return conds;
 }