Click here to Skip to main content
15,895,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: List Objects to Xml Method Pin
AndyASPVB14-Oct-09 9:41
AndyASPVB14-Oct-09 9:41 
GeneralRe: List Objects to Xml Method Pin
Not Active14-Oct-09 10:18
mentorNot Active14-Oct-09 10:18 
GeneralRe: List Objects to Xml Method Pin
DaveyM6914-Oct-09 10:20
professionalDaveyM6914-Oct-09 10:20 
Questionerror sending email using Networkcredential Pin
Jassim Rahma14-Oct-09 8:32
Jassim Rahma14-Oct-09 8:32 
AnswerRe: error sending email using Networkcredential Pin
Abhijit Jana14-Oct-09 8:42
professionalAbhijit Jana14-Oct-09 8:42 
GeneralRe: error sending email using Networkcredential Pin
Jassim Rahma14-Oct-09 9:41
Jassim Rahma14-Oct-09 9:41 
GeneralRe: error sending email using Networkcredential Pin
Abhijit Jana14-Oct-09 17:18
professionalAbhijit Jana14-Oct-09 17:18 
QuestionXML VALIDATION Pin
waqasm14-Oct-09 8:23
waqasm14-Oct-09 8:23 
Hello Everyone,

I have a very small problem which I cant seem to fix. The following is the code which validates an XML file against a Schema. As the XML file gets parsed, if there is an XMLException in the XML file, the error message indicates the error and outputs the message along with the Line and position. But if there is a XMLSchemaException, it indicates the error but does not tell me the line and position number.

try
                   {
                       XmlDocument doc = new XmlDocument();
                       doc.Load(strXML);
                       string xmlFrag = doc.InnerXml;
                       XmlParserContext context = new XmlParserContext(null, null, "", XmlSpace.None);
                       reader = new XmlValidatingReader(xmlFrag, XmlNodeType.Element, context);
                       reader.ValidationType = ValidationType.Schema;
                       myschema.Add("http://tempuri.org/dsMinistryH1N1Export.xsd", strXSD);
                       reader.Schemas.Add(myschema);
                       //reader.ValidationEventHandler += new ValidationEventHandler(ShowCompileErrors);
                       //reader.ValidationEventHandler += new ValidationEventHandler(ValidationHandler);

                       while (reader.Read())
                       {


                       }

                       output.Text = ("Completed Validating " + strXML);
                   }

                   catch (XmlException XmlExp)
                   {
                       output.Text = ("XMLException " + XmlExp.Message);

                   }

                   catch (XmlSchemaException XmlSchExp)
                   {
                       output.Text = ("XMLSchemaException:" + XmlSchExp.Message);


                   }

                  //Catch all other exceptions and report them to the user:
                   catch (Exception GenExp)
                   {
                       output.Text = ("Exception " + GenExp.Message);
                   }


Note: I have tried using XmlSchExp.LineNumber and XmlSchExp.LinePosition - The problem is I need the user to be able to fix the error in the XML file, not the Schema File. So how do I output the Line/Position of where the error is in the XML file once the reader catches the XML schemaException. I hope I am clear about my question. Thanks in advance for any help.
QuestionC# console application to dll and register..... Pin
greendragons14-Oct-09 8:20
greendragons14-Oct-09 8:20 
AnswerRe: C# console application to dll and register..... Pin
Dave Kreskowiak14-Oct-09 8:28
mveDave Kreskowiak14-Oct-09 8:28 
GeneralRe: C# console application to dll and register..... Pin
greendragons14-Oct-09 8:31
greendragons14-Oct-09 8:31 
GeneralRe: C# console application to dll and register..... Pin
DaveyM6914-Oct-09 8:38
professionalDaveyM6914-Oct-09 8:38 
GeneralRe: C# console application to dll and register..... Pin
greendragons14-Oct-09 8:46
greendragons14-Oct-09 8:46 
GeneralRe: C# console application to dll and register..... Pin
Dave Kreskowiak14-Oct-09 8:59
mveDave Kreskowiak14-Oct-09 8:59 
GeneralRe: C# console application to dll and register..... Pin
greendragons14-Oct-09 9:04
greendragons14-Oct-09 9:04 
QuestionProblem changing text on from lable from another class [modified] Pin
yogi_bear_7914-Oct-09 6:20
yogi_bear_7914-Oct-09 6:20 
AnswerRe: Problem changing text on from lable from another class Pin
Dave Kreskowiak14-Oct-09 6:38
mveDave Kreskowiak14-Oct-09 6:38 
GeneralRe: Problem changing text on from lable from another class Pin
yogi_bear_7914-Oct-09 8:02
yogi_bear_7914-Oct-09 8:02 
GeneralRe: Problem changing text on from lable from another class Pin
DaveyM6914-Oct-09 8:05
professionalDaveyM6914-Oct-09 8:05 
GeneralRe: Problem changing text on from lable from another class Pin
yogi_bear_7914-Oct-09 8:42
yogi_bear_7914-Oct-09 8:42 
GeneralRe: Problem changing text on from lable from another class Pin
DaveyM6914-Oct-09 9:05
professionalDaveyM6914-Oct-09 9:05 
GeneralRe: Problem changing text on from lable from another class Pin
yogi_bear_7914-Oct-09 10:17
yogi_bear_7914-Oct-09 10:17 
QuestionPerform a mouse click Pin
p3rson14-Oct-09 6:11
p3rson14-Oct-09 6:11 
AnswerRe: Perform a mouse click Pin
Keith Barrow14-Oct-09 6:24
professionalKeith Barrow14-Oct-09 6:24 
AnswerRe: Perform a mouse click Pin
Luc Pattyn14-Oct-09 6:36
sitebuilderLuc Pattyn14-Oct-09 6:36 

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.