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

C#

 
AnswerRe: Problem in work with ocx file Pin
Rob Philpott24-Aug-11 5:17
Rob Philpott24-Aug-11 5:17 
GeneralRe: Problem in work with ocx file Pin
SajjadZare24-Aug-11 5:34
SajjadZare24-Aug-11 5:34 
GeneralRe: Problem in work with ocx file Pin
Rob Philpott24-Aug-11 6:00
Rob Philpott24-Aug-11 6:00 
AnswerRe: Problem in work with ocx file Pin
Nagy Vilmos24-Aug-11 5:18
professionalNagy Vilmos24-Aug-11 5:18 
QuestionModifying HTTP POST data Pin
Amit7Verma24-Aug-11 4:11
Amit7Verma24-Aug-11 4:11 
Questionget log call via RS232c Pin
jojoba201124-Aug-11 3:46
jojoba201124-Aug-11 3:46 
AnswerRe: get log call via RS232c Pin
BobJanova24-Aug-11 5:08
BobJanova24-Aug-11 5:08 
QuestionXml validation. Please help. Pin
paper6724-Aug-11 3:35
paper6724-Aug-11 3:35 
I want to validate an XML file through a schema.

XML
<?xml version="1.0" encoding="utf-8" ?>

<Units>
  <Unt Text="stuks" Service="False" Value="0" />
  <Unit Text="km" Service="True" Value="1" />
</Units>


XML
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Unit" targetNamespace="http://tempuri.org/Unit.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/Unit.xsd"
           xmlns:mstns="http://tempuri.org/Unit.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="UnitType">
    <xs:attribute name="Text" type="xs:string" use="required" />
    <xs:attribute name="Service" type="xs:boolean" use="required" />
    <xs:attribute name="Value" type="xs:byte" use="required" />
  </xs:complexType>

  <xs:element name="Units">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Unit" type="UnitType" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>


I use the following code :
C#
Settings = new XmlReaderSettings();
Settings.ValidationType = ValidationType.Schema;
Settings.Schemas.Add("http://tempuri.org/Unit.xsd", Directory.GetCurrentDirectory() + strXmlSchema);
Settings.ValidationEventHandler += new ValidationEventHandler(OnSchemaValidationError);

using (XmlReader Reader = XmlReader.Create(Directory.GetCurrentDirectory() + strXmlFile, Settings))
{
    if (Reader != null)
    {
        XmlDocument Doc = new XmlDocument();
        Doc.Load(Reader);
        Reader.Close();
        :
    }
}


My handler OnSchemaValidationError never gets called, even when
there is clearly a mistake in my XML. Why ??
AnswerRe: Xml validation. Please help. Pin
simplefolk25-Aug-11 4:03
simplefolk25-Aug-11 4:03 
QuestionHelp finding a mac address on a remote server? Pin
turbosupramk324-Aug-11 3:27
turbosupramk324-Aug-11 3:27 
AnswerRe: Help finding a mac address on a remote server? Pin
BobJanova24-Aug-11 5:06
BobJanova24-Aug-11 5:06 
GeneralRe: Help finding a mac address on a remote server? Pin
turbosupramk324-Aug-11 5:25
turbosupramk324-Aug-11 5:25 
GeneralRe: Help finding a mac address on a remote server? Pin
BobJanova24-Aug-11 5:44
BobJanova24-Aug-11 5:44 
AnswerRe: Help finding a mac address on a remote server? Pin
turbosupramk324-Aug-11 9:34
turbosupramk324-Aug-11 9:34 
Questionadd number Pin
imanaa24-Aug-11 3:16
imanaa24-Aug-11 3:16 
AnswerRe: add number Pin
Not Active24-Aug-11 3:24
mentorNot Active24-Aug-11 3:24 
AnswerRe: add number Pin
MicroVirus24-Aug-11 3:46
MicroVirus24-Aug-11 3:46 
JokeRe: add number Pin
Peter_in_278024-Aug-11 18:59
professionalPeter_in_278024-Aug-11 18:59 
AnswerRe: add number Pin
BobJanova24-Aug-11 4:16
BobJanova24-Aug-11 4:16 
AnswerRe: add number Pin
Luc Pattyn24-Aug-11 5:06
sitebuilderLuc Pattyn24-Aug-11 5:06 
Questionhow to simplify the loop? Pin
SRKSHOME23-Aug-11 23:15
SRKSHOME23-Aug-11 23:15 
AnswerRe: how to simplify the loop? Pin
Luc Pattyn24-Aug-11 0:14
sitebuilderLuc Pattyn24-Aug-11 0:14 
GeneralRe: how to simplify the loop? Pin
RobCroll24-Aug-11 1:39
RobCroll24-Aug-11 1:39 
AnswerRe: how to simplify the loop? Pin
V.24-Aug-11 0:38
professionalV.24-Aug-11 0:38 
AnswerRe: how to simplify the loop? Pin
PIEBALDconsult24-Aug-11 2:53
mvePIEBALDconsult24-Aug-11 2:53 

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.