Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
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 
QuestionHow to set the distance between checkbox and text in using TreeView ? Pin
taibc20-Nov-12 22:26
taibc20-Nov-12 22:26 
AnswerRe: How to set the distance between checkbox and text in using TreeView ? Pin
Jay Nardev21-Nov-12 0:03
Jay Nardev21-Nov-12 0:03 
GeneralRe: How to set the distance between checkbox and text in using TreeView ? Pin
taibc21-Nov-12 14:06
taibc21-Nov-12 14:06 
QuestionHow to fix Error when i using BackgroundWorker in C# Pin
Alviss_H20-Nov-12 20:36
Alviss_H20-Nov-12 20:36 
AnswerRe: How to fix Error when i using BackgroundWorker in C# Pin
AmitGajjar20-Nov-12 21:04
professionalAmitGajjar20-Nov-12 21:04 
GeneralRe: How to fix Error when i using BackgroundWorker in C# Pin
Alviss_H20-Nov-12 21:19
Alviss_H20-Nov-12 21:19 
GeneralRe: How to fix Error when i using BackgroundWorker in C# Pin
AmitGajjar20-Nov-12 21:22
professionalAmitGajjar20-Nov-12 21:22 
AnswerRe: How to fix Error when i using BackgroundWorker in C# Pin
Sivaraman Dhamodharan20-Nov-12 22:52
Sivaraman Dhamodharan20-Nov-12 22:52 
QuestionInvokeRequired Pin
MAW3020-Nov-12 15:04
MAW3020-Nov-12 15:04 
AnswerRe: InvokeRequired Pin
SledgeHammer0120-Nov-12 18:02
SledgeHammer0120-Nov-12 18:02 
AnswerRe: InvokeRequired Pin
Braj_1222-Nov-12 22:46
Braj_1222-Nov-12 22:46 
QuestionHow to Query if a ComboBox's AutoComplete Dialog is Open Pin
Skippums20-Nov-12 14:47
Skippums20-Nov-12 14:47 
QuestionFull path name of .cs file Pin
PozzaVecia20-Nov-12 10:35
PozzaVecia20-Nov-12 10:35 
AnswerRe: Full path name of .cs file Pin
Garth J Lancaster20-Nov-12 11:42
professionalGarth J Lancaster20-Nov-12 11:42 
AnswerRe: Full path name of .cs file Pin
jschell20-Nov-12 12:24
jschell20-Nov-12 12:24 

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.