473,842 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I validate my xml?

Hi,
I'm trying to validate my xml against a xsd but I can't get it to work.
Originally, I wanted to validate an xml string but since I didn't get that
to work I tried to validate an xml file instead. Didn't work either.
Actuallty, the xml gets loaded but there are no events raised that says my
xml is incorrect!

I'm using .NET 2.0 and my code is listed below. ALL help is appreciated!

Thanks!

/Jonny

void myValidate()
{
FileStream fs = File.Open(@"C:\ Test.xml", FileMode.Open);

XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Schema s.Add(null,@"C: \Test.xsd");
settings.Valida tionType = ValidationType. Schema; //this line is
neccessary for validation to work
settings.Valida tionEventHandle r += new
ValidationEvent Handler(rs_Vali dationEventHand ler);

XmlReader xreader = XmlReader.Creat e(fs, settings);

XmlDocument xdoc = new XmlDocument();
xdoc.Load(xread er);

fs.Close();
}

void rs_ValidationEv entHandler(obje ct sender, ValidationEvent Args e)
{
Debug.WriteLine ("e.Message: " + e.Message);
}
Schema:
<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns="urn:book store-schema" elementFormDefa ult="qualified"
targetNamespace ="urn:bookst ore-schema">
<xsd:element name="bookstore " type="bookstore Type" />
<xsd:element name="comment" type="xsd:strin g" />
<xsd:element name="author" type="authorNam e"/>
<xsd:complexTyp e name="authorNam e">
<xsd:sequence >
<xsd:element name="first-name" type="xsd:strin g" />
<xsd:element name="last-name" type="xsd:strin g" />
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="bookstore Type">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="book" type="bookType" />
<xsd:element ref="comment" minOccurs="0" />
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="bookType" >
<xsd:sequence >
<xsd:element name="title" type="xsd:strin g" />
<xsd:element ref="author" />
<xsd:element name="price" type="xsd:decim al" />
</xsd:sequence>
<xsd:attribut e name="genre" type="xsd:strin g" />
</xsd:complexType >
</xsd:schema>

xml:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="http://myns/slidesdemo"
xmlns:rv="http://myns/slidesdemo/reviewdate">
<session name="All about XML">
<slide>
<slide position="1">
<title>Agenda </title>
<rv:reviewed>20 04-05-10T00:00:00</rv:reviewed>
</slide>
<slide position="2">
<title>Introduc tion</title>
<rv:reviewed>20 03-10-22T00:00:00</rv:reviewed>
</slide>
<ILLEGAL_NODE >
<NONSENSE>NONSE NSE</NONSENSE>
</ILLEGAL_NODE>
<slide position="3">
<title>Code Examples</title>
<rv:reviewed>20 04-03-02T00:00:00</rv:reviewed>
</slide>
</slide>
</session>
</root>
May 29 '06 #1
6 2757
take a look here
http://www.codeproject.com/soap/Simp..._Validator.asp

and here
http://msdn2.microsoft.com/en-us/8f0h7att.aspx

my opinio is tha you are not use while (reader.Read()) ; as shown in
example
hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com

May 29 '06 #2
Thanks for your response. Your first link shows an example using
XmlValidatingRe ader whixh I don't want to use since it's obsolete in 2.0.

The second example is good, but I can't get it to work. Using while (...)
doesn't change the behaviour for me.

/Jonny
"Galcho[MCSD.NET]" <ga****@gmail.c om> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
take a look here
http://www.codeproject.com/soap/Simp..._Validator.asp

and here
http://msdn2.microsoft.com/en-us/8f0h7att.aspx

my opinio is tha you are not use while (reader.Read()) ; as shown in
example
hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com

May 30 '06 #3
Thanks for your response.

The XmlValidatingRe ader is obsolete for 2.0 and therefor I want to find
another solution.

Thanks,
Jonny

"Michael Nemtsev" <ne*****@msn.co m> wrote in message
news:9c******** *************** ***@msnews.micr osoft.com...
Hello Jonny,

Try to use XmlValidatingRe ader for this
J> Hi,
J> I'm trying to validate my xml against a xsd but I can't get it to
J> work.
J> Originally, I wanted to validate an xml string but since I didn't get
J> that
J> to work I tried to validate an xml file instead. Didn't work either.
J> Actuallty, the xml gets loaded but there are no events raised that
J> says my
J> xml is incorrect!
J> I'm using .NET 2.0 and my code is listed below. ALL help is
J> appreciated!
J> J> Thanks!
J> J> /Jonny
J> J> void myValidate()
J> {
J> FileStream fs = File.Open(@"C:\ Test.xml", FileMode.Open);
J> XmlReaderSettin gs settings = new XmlReaderSettin gs();
J> settings.Schema s.Add(null,@"C: \Test.xsd");
J> settings.Valida tionType = ValidationType. Schema; //this line is
J> neccessary for validation to work
J> settings.Valida tionEventHandle r += new
J> ValidationEvent Handler(rs_Vali dationEventHand ler);
J> XmlReader xreader = XmlReader.Creat e(fs, settings);
J> J> XmlDocument xdoc = new XmlDocument();
J> xdoc.Load(xread er);
J> fs.Close();
J> }
J> void rs_ValidationEv entHandler(obje ct sender, ValidationEvent Args e)
J> {
J> Debug.WriteLine ("e.Message: " + e.Message);
J> }
J> Schema:
J> <xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
J> xmlns="urn:book store-schema" elementFormDefa ult="qualified"
J> targetNamespace ="urn:bookst ore-schema">
J> <xsd:element name="bookstore " type="bookstore Type" />
J> <xsd:element name="comment" type="xsd:strin g" />
J> <xsd:element name="author" type="authorNam e"/>
J> <xsd:complexTyp e name="authorNam e">
J> <xsd:sequence >
J> <xsd:element name="first-name" type="xsd:strin g" />
J> <xsd:element name="last-name" type="xsd:strin g" />
J> </xsd:sequence>
J> </xsd:complexType >
J> <xsd:complexTyp e name="bookstore Type">
J> <xsd:sequence maxOccurs="unbo unded">
J> <xsd:element name="book" type="bookType" />
J> <xsd:element ref="comment" minOccurs="0" />
J> </xsd:sequence>
J> </xsd:complexType >
J> <xsd:complexTyp e name="bookType" >
J> <xsd:sequence >
J> <xsd:element name="title" type="xsd:strin g" />
J> <xsd:element ref="author" />
J> <xsd:element name="price" type="xsd:decim al" />
J> </xsd:sequence>
J> <xsd:attribut e name="genre" type="xsd:strin g" />
J> </xsd:complexType >
J> </xsd:schema>
J> xml:
J> <?xml version="1.0" encoding="utf-8"?>
J> <root xmlns="http://myns/slidesdemo"
J> xmlns:rv="http://myns/slidesdemo/reviewdate">
J> <session name="All about XML">
J> <slide>
J> <slide position="1">
J> <title>Agenda </title>
J> <rv:reviewed>20 04-05-10T00:00:00</rv:reviewed>
J> </slide>
J> <slide position="2">
J> <title>Introduc tion</title>
J> <rv:reviewed>20 03-10-22T00:00:00</rv:reviewed>
J> </slide>
J> <ILLEGAL_NODE >
J> <NONSENSE>NONSE NSE</NONSENSE>
J> </ILLEGAL_NODE>
J> <slide position="3">
J> <title>Code Examples</title>
J> <rv:reviewed>20 04-03-02T00:00:00</rv:reviewed>
J> </slide>
J> </slide>
J> </session>
J> </root>
J> ---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche

May 30 '06 #4
Hello Jonny,

Try to use XmlValidatingRe ader for this

J> Hi,
J> I'm trying to validate my xml against a xsd but I can't get it to
J> work.
J> Originally, I wanted to validate an xml string but since I didn't get
J> that
J> to work I tried to validate an xml file instead. Didn't work either.
J> Actuallty, the xml gets loaded but there are no events raised that
J> says my
J> xml is incorrect!
J> I'm using .NET 2.0 and my code is listed below. ALL help is
J> appreciated!
J>
J> Thanks!
J>
J> /Jonny
J>
J> void myValidate()
J> {
J> FileStream fs = File.Open(@"C:\ Test.xml", FileMode.Open);
J> XmlReaderSettin gs settings = new XmlReaderSettin gs();
J> settings.Schema s.Add(null,@"C: \Test.xsd");
J> settings.Valida tionType = ValidationType. Schema; //this line is
J> neccessary for validation to work
J> settings.Valida tionEventHandle r += new
J> ValidationEvent Handler(rs_Vali dationEventHand ler);
J> XmlReader xreader = XmlReader.Creat e(fs, settings);
J>
J> XmlDocument xdoc = new XmlDocument();
J> xdoc.Load(xread er);
J> fs.Close();
J> }
J> void rs_ValidationEv entHandler(obje ct sender, ValidationEvent Args e)
J> {
J> Debug.WriteLine ("e.Message: " + e.Message);
J> }
J> Schema:
J> <xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
J> xmlns="urn:book store-schema" elementFormDefa ult="qualified"
J> targetNamespace ="urn:bookst ore-schema">
J> <xsd:element name="bookstore " type="bookstore Type" />
J> <xsd:element name="comment" type="xsd:strin g" />
J> <xsd:element name="author" type="authorNam e"/>
J> <xsd:complexTyp e name="authorNam e">
J> <xsd:sequence >
J> <xsd:element name="first-name" type="xsd:strin g" />
J> <xsd:element name="last-name" type="xsd:strin g" />
J> </xsd:sequence>
J> </xsd:complexType >
J> <xsd:complexTyp e name="bookstore Type">
J> <xsd:sequence maxOccurs="unbo unded">
J> <xsd:element name="book" type="bookType" />
J> <xsd:element ref="comment" minOccurs="0" />
J> </xsd:sequence>
J> </xsd:complexType >
J> <xsd:complexTyp e name="bookType" >
J> <xsd:sequence >
J> <xsd:element name="title" type="xsd:strin g" />
J> <xsd:element ref="author" />
J> <xsd:element name="price" type="xsd:decim al" />
J> </xsd:sequence>
J> <xsd:attribut e name="genre" type="xsd:strin g" />
J> </xsd:complexType >
J> </xsd:schema>
J> xml:
J> <?xml version="1.0" encoding="utf-8"?>
J> <root xmlns="http://myns/slidesdemo"
J> xmlns:rv="http://myns/slidesdemo/reviewdate">
J> <session name="All about XML">
J> <slide>
J> <slide position="1">
J> <title>Agenda </title>
J> <rv:reviewed>20 04-05-10T00:00:00</rv:reviewed>
J> </slide>
J> <slide position="2">
J> <title>Introduc tion</title>
J> <rv:reviewed>20 03-10-22T00:00:00</rv:reviewed>
J> </slide>
J> <ILLEGAL_NODE >
J> <NONSENSE>NONSE NSE</NONSENSE>
J> </ILLEGAL_NODE>
J> <slide position="3">
J> <title>Code Examples</title>
J> <rv:reviewed>20 04-03-02T00:00:00</rv:reviewed>
J> </slide>
J> </slide>
J> </session>
J> </root>
J>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 31 '06 #5
Hi,
I have used 2.0 it is working for me but I am not loading the XML thru
file, I am reading the XML string and validating with the XSD. here is the
code.

public bool Validate(string xmlStr, string xsdPath)
{
XmlTextReader textReader = getXmlReader(xm lStr);
return Validate(textRe ader, xsdPath);

}

public bool Validate(XmlTex tReader nodeReader, string xsdPath)
{

XmlReader reader = null;
try
{
errors.Clear();
bValid = true;
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Schema s.Add(null, xsdPath);

settings.Valida tionType = ValidationType. Schema; //this line
is neccessary for validation to work
settings.Valida tionEventHandle r += new
ValidationEvent Handler(Validat ionCallBack);
reader = XmlReader.Creat e(nodeReader, settings);

while (reader.Read()) ;
}
catch (XmlException xmle)
{
bValid = false;
errors.Add(xmle .Message);
//errMsg.Append(x mle.Message).Ap pend("\n");
}
finally
{
//Close the reader.
nodeReader.Clos e();
reader.Close();
}

return bValid;
//return validationFlag;
}

------------------
private void ValidationCallB ack(object sender, ValidationEvent Args e)
{
//Logger.Debug("E ntering ValidationCallB ack");
if (e.Severity == XmlSeverityType .Warning)
{
warnings.Add(e. Message);
}
else if (e.Severity == XmlSeverityType .Error)
{
bValid = false;
Console.WriteLi ne(e.Message);
errors.Add(e.Me ssage);

}

//Logger.Debug("E xiting ValidationCallB ack");
}
-----------------------------------------

But another problem with this is it is not accumalting all the errors, once
it encounters the validation error it is coming out, as per my understanding
it shud display all the errors in the XML file
"Jonny" wrote:
Thanks for your response.

The XmlValidatingRe ader is obsolete for 2.0 and therefor I want to find
another solution.

Thanks,
Jonny

"Michael Nemtsev" <ne*****@msn.co mwrote in message
news:9c******** *************** ***@msnews.micr osoft.com...
Hello Jonny,

Try to use XmlValidatingRe ader for this
JHi,
JI'm trying to validate my xml against a xsd but I can't get it to
Jwork.
JOriginally, I wanted to validate an xml string but since I didn't get
Jthat
Jto work I tried to validate an xml file instead. Didn't work either.
JActuallty, the xml gets loaded but there are no events raised that
Jsays my
Jxml is incorrect!
JI'm using .NET 2.0 and my code is listed below. ALL help is
Jappreciated!
JJThanks!
JJ/Jonny
JJvoid myValidate()
J{
JFileStream fs = File.Open(@"C:\ Test.xml", FileMode.Open);
JXmlReaderSetti ngs settings = new XmlReaderSettin gs();
Jsettings.Schem as.Add(null,@"C :\Test.xsd");
Jsettings.Valid ationType = ValidationType. Schema; //this line is
Jneccessary for validation to work
Jsettings.Valid ationEventHandl er += new
JValidationEven tHandler(rs_Val idationEventHan dler);
JXmlReader xreader = XmlReader.Creat e(fs, settings);
JJXmlDocument xdoc = new XmlDocument();
Jxdoc.Load(xrea der);
Jfs.Close();
J}
Jvoid rs_ValidationEv entHandler(obje ct sender, ValidationEvent Args e)
J{
JDebug.WriteLin e("e.Message: " + e.Message);
J}
JSchema:
J<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
Jxmlns="urn:boo kstore-schema" elementFormDefa ult="qualified"
JtargetNamespac e="urn:bookstor e-schema">
J<xsd:element name="bookstore " type="bookstore Type" />
J<xsd:element name="comment" type="xsd:strin g" />
J<xsd:element name="author" type="authorNam e"/>
J<xsd:complexTy pe name="authorNam e">
J<xsd:sequence >
J<xsd:element name="first-name" type="xsd:strin g" />
J<xsd:element name="last-name" type="xsd:strin g" />
J</xsd:sequence>
J</xsd:complexType >
J<xsd:complexTy pe name="bookstore Type">
J<xsd:sequence maxOccurs="unbo unded">
J<xsd:element name="book" type="bookType" />
J<xsd:element ref="comment" minOccurs="0" />
J</xsd:sequence>
J</xsd:complexType >
J<xsd:complexTy pe name="bookType" >
J<xsd:sequence >
J<xsd:element name="title" type="xsd:strin g" />
J<xsd:element ref="author" />
J<xsd:element name="price" type="xsd:decim al" />
J</xsd:sequence>
J<xsd:attribut e name="genre" type="xsd:strin g" />
J</xsd:complexType >
J</xsd:schema>
Jxml:
J<?xml version="1.0" encoding="utf-8"?>
J<root xmlns="http://myns/slidesdemo"
Jxmlns:rv="http ://myns/slidesdemo/reviewdate">
J<session name="All about XML">
J<slide>
J<slide position="1">
J<title>Agenda </title>
J<rv:reviewed>2 004-05-10T00:00:00</rv:reviewed>
J</slide>
J<slide position="2">
J<title>Introdu ction</title>
J<rv:reviewed>2 003-10-22T00:00:00</rv:reviewed>
J</slide>
J<ILLEGAL_NODE >
J<NONSENSE>NONS ENSE</NONSENSE>
J</ILLEGAL_NODE>
J<slide position="3">
J<title>Code Examples</title>
J<rv:reviewed>2 004-03-02T00:00:00</rv:reviewed>
J</slide>
J</slide>
J</session>
J</root>
J---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Aug 24 '06 #6
Do you have your example of "getXmlReader(x mlStr)" ?

Thanks,
Eric.-
"Kaladhar" wrote:
Hi,
I have used 2.0 it is working for me but I am not loading the XML thru
file, I am reading the XML string and validating with the XSD. here is the
code.

public bool Validate(string xmlStr, string xsdPath)
{
XmlTextReader textReader = getXmlReader(xm lStr);
return Validate(textRe ader, xsdPath);

}

public bool Validate(XmlTex tReader nodeReader, string xsdPath)
{

XmlReader reader = null;
try
{
errors.Clear();
bValid = true;
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Schema s.Add(null, xsdPath);

settings.Valida tionType = ValidationType. Schema; //this line
is neccessary for validation to work
settings.Valida tionEventHandle r += new
ValidationEvent Handler(Validat ionCallBack);
reader = XmlReader.Creat e(nodeReader, settings);

while (reader.Read()) ;
}
catch (XmlException xmle)
{
bValid = false;
errors.Add(xmle .Message);
//errMsg.Append(x mle.Message).Ap pend("\n");
}
finally
{
//Close the reader.
nodeReader.Clos e();
reader.Close();
}

return bValid;
//return validationFlag;
}

------------------
private void ValidationCallB ack(object sender, ValidationEvent Args e)
{
//Logger.Debug("E ntering ValidationCallB ack");
if (e.Severity == XmlSeverityType .Warning)
{
warnings.Add(e. Message);
}
else if (e.Severity == XmlSeverityType .Error)
{
bValid = false;
Console.WriteLi ne(e.Message);
errors.Add(e.Me ssage);

}

//Logger.Debug("E xiting ValidationCallB ack");
}
-----------------------------------------

But another problem with this is it is not accumalting all the errors, once
it encounters the validation error it is coming out, as per my understanding
it shud display all the errors in the XML file
"Jonny" wrote:
Thanks for your response.

The XmlValidatingRe ader is obsolete for 2.0 and therefor I want to find
another solution.

Thanks,
Jonny

"Michael Nemtsev" <ne*****@msn.co mwrote in message
news:9c******** *************** ***@msnews.micr osoft.com...
Hello Jonny,
>
Try to use XmlValidatingRe ader for this
JHi,
JI'm trying to validate my xml against a xsd but I can't get it to
Jwork.
JOriginally, I wanted to validate an xml string but since I didn't get
Jthat
Jto work I tried to validate an xml file instead. Didn't work either.
JActuallty, the xml gets loaded but there are no events raised that
Jsays my
Jxml is incorrect!
JI'm using .NET 2.0 and my code is listed below. ALL help is
Jappreciated!
JJThanks!
JJ/Jonny
JJvoid myValidate()
J{
JFileStream fs = File.Open(@"C:\ Test.xml", FileMode.Open);
JXmlReaderSetti ngs settings = new XmlReaderSettin gs();
Jsettings.Schem as.Add(null,@"C :\Test.xsd");
Jsettings.Valid ationType = ValidationType. Schema; //this line is
Jneccessary for validation to work
Jsettings.Valid ationEventHandl er += new
JValidationEven tHandler(rs_Val idationEventHan dler);
JXmlReader xreader = XmlReader.Creat e(fs, settings);
JJXmlDocument xdoc = new XmlDocument();
Jxdoc.Load(xrea der);
Jfs.Close();
J}
Jvoid rs_ValidationEv entHandler(obje ct sender, ValidationEvent Args e)
J{
JDebug.WriteLin e("e.Message: " + e.Message);
J}
JSchema:
J<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
Jxmlns="urn:boo kstore-schema" elementFormDefa ult="qualified"
JtargetNamespac e="urn:bookstor e-schema">
J<xsd:element name="bookstore " type="bookstore Type" />
J<xsd:element name="comment" type="xsd:strin g" />
J<xsd:element name="author" type="authorNam e"/>
J<xsd:complexTy pe name="authorNam e">
J<xsd:sequence >
J<xsd:element name="first-name" type="xsd:strin g" />
J<xsd:element name="last-name" type="xsd:strin g" />
J</xsd:sequence>
J</xsd:complexType >
J<xsd:complexTy pe name="bookstore Type">
J<xsd:sequence maxOccurs="unbo unded">
J<xsd:element name="book" type="bookType" />
J<xsd:element ref="comment" minOccurs="0" />
J</xsd:sequence>
J</xsd:complexType >
J<xsd:complexTy pe name="bookType" >
J<xsd:sequence >
J<xsd:element name="title" type="xsd:strin g" />
J<xsd:element ref="author" />
J<xsd:element name="price" type="xsd:decim al" />
J</xsd:sequence>
J<xsd:attribut e name="genre" type="xsd:strin g" />
J</xsd:complexType >
J</xsd:schema>
Jxml:
J<?xml version="1.0" encoding="utf-8"?>
J<root xmlns="http://myns/slidesdemo"
Jxmlns:rv="http ://myns/slidesdemo/reviewdate">
J<session name="All about XML">
J<slide>
J<slide position="1">
J<title>Agenda </title>
J<rv:reviewed>2 004-05-10T00:00:00</rv:reviewed>
J</slide>
J<slide position="2">
J<title>Introdu ction</title>
J<rv:reviewed>2 003-10-22T00:00:00</rv:reviewed>
J</slide>
J<ILLEGAL_NODE >
J<NONSENSE>NONS ENSE</NONSENSE>
J</ILLEGAL_NODE>
J<slide position="3">
J<title>Code Examples</title>
J<rv:reviewed>2 004-03-02T00:00:00</rv:reviewed>
J</slide>
J</slide>
J</session>
J</root>
J---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
>
"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche
>
>
Oct 9 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4595
by: SHC | last post by:
Hi all, I have a VC++ .NET 2003 - Windows XP Pro PC. I created a Win32 console application in my VC++ .NET 2003 and copied validateDOM.cpp, books.xml and books.xsd (see the attached files below) from Microfost MSDN Library for my project "validateXML". When I did "Build" on my project, I got the following fatal error C1010: c:\Documents and Settings\SHC\My Documents\Visual Studio Projects\valoidateDOM\valoidateDOM.cpp(273): fatal error...
5
2531
by: Jim Heavey | last post by:
When should you use the Page.Validate() method? I thought you would use this method if you have some Server side validation (CustomControl's) you wanted to use and this would cause them to be invoked. I am probably wrong about that. If I am suppose to use this function, the edits seemed to be invoked even when you have pressed the cancel and the "CausesValidation" is set to false. Is there a way to get around this (might just be an...
11
11772
by: jjbutera | last post by:
I know how to use the ErrorProvider in my winforms..or do I? I validate the values and set the ErrorProvider in the validating event. If not valid, I set e.Cancel = True. I clear the ErrorProvider in the validated event. Is there a way to know if all validated controls pass validation when the user clicks an OK button? In ASP.Net there's the Page.IsValid method. Is there something similar in winforms, or do I still have to write an...
0
2654
by: Marc Scheuner | last post by:
Folks, I'm faced with a dilemma here - I have an XML document and for part of it, I have an XSD schema to validate it - but not for the rest of it. Can I still validate at least part of the XML document? I was hoping to use the XmlDocument.Validate(ValidationEventHandler, XmlNode) method for that - doesn't seem to work...
4
2607
by: Brybot | last post by:
I have a form that i've split up into multiple asp:panels, each panel has a number of validators which work correctly. At on the last panel, i want to commit the data collected to a database. I figured since all the panel data is still being sent through the postbacks, instead of using Sessions, or HttpContext, I could just take the values from the textboxes. This all works fine, except for security. I realized that I could inject...
24
2120
by: Mike Hofer | last post by:
Please forgive the cross-post to multiple forums. I did it intentionally, but I *think* it was appropriate given the nature of my question. I'm working on an open source code library to help automate and clean up parameter validation code. It's almost ready to go into open beta. But one last little glitch is holding me up, and that would be the name of the factory class that serves as the entry point into the library: Validate.
0
10945
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10614
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10674
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10317
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7859
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5886
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4500
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4090
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3146
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.