Click here to Skip to main content
15,915,864 members
Home / Discussions / C#
   

C#

 
AnswerRe: Specialized List Sorting question Pin
BobJanova21-Nov-12 22:50
BobJanova21-Nov-12 22:50 
QuestionWinForms Class Design Pin
Member 961929521-Nov-12 6:43
Member 961929521-Nov-12 6:43 
AnswerRe: WinForms Class Design Pin
Richard MacCutchan21-Nov-12 7:15
mveRichard MacCutchan21-Nov-12 7:15 
GeneralRe: WinForms Class Design Pin
Matt U.21-Nov-12 8:16
Matt U.21-Nov-12 8:16 
GeneralRe: WinForms Class Design Pin
Richard MacCutchan21-Nov-12 8:56
mveRichard MacCutchan21-Nov-12 8:56 
GeneralRe: WinForms Class Design Pin
Matt U.21-Nov-12 8:59
Matt U.21-Nov-12 8:59 
GeneralRe: WinForms Class Design Pin
Richard MacCutchan21-Nov-12 9:06
mveRichard MacCutchan21-Nov-12 9:06 
GeneralRe: WinForms Class Design Pin
Matt U.21-Nov-12 9:21
Matt U.21-Nov-12 9:21 
GeneralRe: WinForms Class Design Pin
PIEBALDconsult21-Nov-12 10:27
mvePIEBALDconsult21-Nov-12 10:27 
AnswerRe: WinForms Class Design Pin
PIEBALDconsult21-Nov-12 9:07
mvePIEBALDconsult21-Nov-12 9:07 
QuestionUplaod Article To Codeproject Pin
katlegoEmmnanuelNkosi21-Nov-12 3:44
katlegoEmmnanuelNkosi21-Nov-12 3:44 
AnswerRe: Uplaod Article To Codeproject Pin
PIEBALDconsult21-Nov-12 3:48
mvePIEBALDconsult21-Nov-12 3:48 
AnswerRe: Uplaod Article To Codeproject Pin
Richard MacCutchan21-Nov-12 4:34
mveRichard MacCutchan21-Nov-12 4:34 
QuestionPrint Crystal Report in c# Using Access Database? Pin
kashifjaat21-Nov-12 2:09
kashifjaat21-Nov-12 2:09 
QuestionGenerate Morse Code Sound Pin
long dao21-Nov-12 1:24
long dao21-Nov-12 1:24 
AnswerRe: Generate Morse Code Sound Pin
Pete O'Hanlon21-Nov-12 1:45
mvePete O'Hanlon21-Nov-12 1:45 
GeneralRe: Generate Morse Code Sound Pin
long dao21-Nov-12 1:54
long dao21-Nov-12 1:54 
GeneralRe: Generate Morse Code Sound Pin
Pete O'Hanlon21-Nov-12 2:05
mvePete O'Hanlon21-Nov-12 2:05 
QuestionKeeps returning NullReferenceException Pin
MacUseless20-Nov-12 23:08
MacUseless20-Nov-12 23:08 
SuggestionRe: Keeps returning NullReferenceException Pin
V.21-Nov-12 3:25
professionalV.21-Nov-12 3:25 
GeneralRe: Keeps returning NullReferenceException Pin
MacUseless21-Nov-12 3:28
MacUseless21-Nov-12 3:28 
GeneralRe: Keeps returning NullReferenceException Pin
V.21-Nov-12 3:31
professionalV.21-Nov-12 3:31 
QuestionValidate XML file against rule in db Pin
rahul.net1120-Nov-12 22:29
rahul.net1120-Nov-12 22:29 
XML
Hi,

I want to validate the xml file against certain set of rules in database.I have done most of the this but got stuck in below part. Any pointers will be appreciated.
Following is the sample xml file.
<pre lang="xml">
<BACKGROUND>
        <QUES_NUMBER>1</QUES_NUMBER>
        <QUES_RESPONSE>Y</QUES_RESPONSE>
      </BACKGROUND>
      <BACKGROUND>
        <QUES_NUMBER>2</QUES_NUMBER>
        <QUES_RESPONSE>Y</QUES_RESPONSE>
      </BACKGROUND>
      <BACKGROUND>
        <QUES_NUMBER>3</QUES_NUMBER>
        <QUES_RESPONSE>Y</QUES_RESPONSE>
      </BACKGROUND>
      <BACKGROUND>
        <QUES_NUMBER>4</QUES_NUMBER>
        <QUES_RESPONSE>N</QUES_RESPONSE>
      </BACKGROUND>
      <BACKGROUND>
        <QUES_NUMBER>5</QUES_NUMBER>
        <QUES_RESPONSE>Y</QUES_RESPONSE>
      </BACKGROUND>
      <BACKGROUND>
        <QUES_NUMBER>1A</QUES_NUMBER>
        <QUES_RESPONSE>Y</QUES_RESPONSE>
      </BACKGROUND>

As displayed there are multiple instances of <BACKGROUND><QUES_NUMBER><QUES_RESPONSE></BACKGROUND> tag. Now I have to validate below rule.

Rule 1- If QUES_NUMBER in (1,01,001) Then QUES_RESPONSE should be in (Y,N)
Rule 2- If QUES_RESPONSE Equals (Y) Then one instance of QUES_NUMBER 1A,01A,1B,01B should exist.
Rule 3- If QUES_NUMBER in (1A,01A) Then QUES_RESPONSE (X,Y,Z,Y/Z)
Rule 3.1- If QUES_NUMBER in (1B,01B) Then QUES_RESPONSE (X,Y,Z,Y/Z)

This is the complete Rule. If we are processing rule number 1 and result is true then we have to validate THEN condition (QUES_RESPONSE).
If THEN condition is true then I have to process Rule 2 (as there are multiple instance of same tag) I have to check the QUES_RESPONSE (Y)
of the same tag for which I have validated Rule 1 condition. For that purpose I am passing then index of index of the QUES_NUMBER and it works f9.
PROBLEM occurred in the THEN condition of Rule 2..Where are I am passing the value in xml file and match value (value in database Y,N) and index of the
question number to look at. But the as per then condition 1A..tag should exist and the code will try to locate the tag on that index which he will never
find.
Any pointer where I need to change in logic/any other way will be appreciated.
Below is the function which is validating the value in xml file against db value.
C#
public static bool PROCESSRULE_RANGE(string expValue, ArrayList xmlValColl, out int valIndex)//, out Array avlValue
       {

               string currentValue = string.Empty;
               valIndex = -1;
               string[] expValArr = expValue.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);

               var intersect = expValArr.Intersect(xmlValColl.ToArray());

               if (intersect.Count() > 0)
               {
                   valIndex = xmlValColl.IndexOf(intersect.First());
                   return true;
               }

       }

I am using XPATH to read the values in xml file.
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.

AnswerRe: Validate XML file against rule in db Pin
PIEBALDconsult21-Nov-12 7:07
mvePIEBALDconsult21-Nov-12 7:07 
GeneralRe: Validate XML file against rule in db Pin
rahul.net1116-Jan-13 20:01
rahul.net1116-Jan-13 20:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.