Click here to Skip to main content
15,889,281 members
Home / Discussions / C#
   

C#

 
QuestionException while creating table in azure. Pin
VasntKrish1-Oct-09 9:23
VasntKrish1-Oct-09 9:23 
QuestionXML, XSD VALIDATION Pin
waqasm1-Oct-09 8:16
waqasm1-Oct-09 8:16 
AnswerRe: XML, XSD VALIDATION Pin
Henry Minute1-Oct-09 10:50
Henry Minute1-Oct-09 10:50 
GeneralRe: XML, XSD VALIDATION Pin
waqasm1-Oct-09 11:09
waqasm1-Oct-09 11:09 
GeneralRe: XML, XSD VALIDATION Pin
Henry Minute1-Oct-09 11:48
Henry Minute1-Oct-09 11:48 
GeneralRe: XML, XSD VALIDATION Pin
waqasm2-Oct-09 3:56
waqasm2-Oct-09 3:56 
GeneralRe: XML, XSD VALIDATION Pin
Henry Minute2-Oct-09 5:29
Henry Minute2-Oct-09 5:29 
GeneralRe: XML, XSD VALIDATION Pin
waqasm7-Oct-09 6:14
waqasm7-Oct-09 6:14 
Yes, I know the help here is for free. But im sure that everyone benefits from knowledge, whether they are helping someone or being helped. I did manage to use the debugger, so thank you for your professional advice.

Anyhow, the code is finished so anyone having trouble with what I'm doing can benefit from my code.

using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Xml;
using System.Xml.Schema;

namespace ValidateXML
    
{
    public partial class Form1 : Form    
   {
        public Form1()
        
        {
            InitializeComponent();
          
        }

        string strXML; 
        string strXSD;  
      //  string strXSDNS;
       
   
  private void button1_Click(object sender, EventArgs e)
        
   {
            if (txt_inputXML.Text == String.Empty)

            {
                output.Text = ("Warning: Upload a XML file");
            }

            else if (txt_inputXSD.Text == String.Empty)
            {
                output.Text = ("Warning: Upload a XSD File");
            }

            else
                
            {                             
                strXML = txt_inputXML.Text;
                strXSD = txt_inputXSD.Text;
                //XmlReader reader = null;
                //XmlSchemaSet myschema = new XmlSchemaSet();
                XmlValidatingReader reader = null;
               
                XmlSchemaCollection myschema = new XmlSchemaCollection();
                //ValidationEventHandler EventHandler = new ValidationEventHandler();
                //XmlValidatingReader reader = new XmlValidatingReader(reader);
                //XmlSchemaTotalDigitsFacet reader1 = new XmlSchemaTotalDigitsFacet(output);

                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(strXSD, @"C:\Umar\H1N1_Schema.xsd");
                   myschema.Add("http://tempuri.org/dsMinistryH1N1Export.xsd", strXSD);

                   //***reader.ValidationType = ValidationType.Schema; 
                   
                   //myschema.Add(null, reader);
                   reader.Schemas.Add(myschema);
                 
                    
                    //***myschema.Add("H1N1_Schema.xsd", @"C:\Umar\H1N1_Schema.xsd");
                   //reader.ValidationEventHandler += new ValidationEventHandler(ValidationError);

                   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);
               } 
            }

        }
               
        private void button2_Click(object sender, EventArgs e)
        
       {        
            OpenFileDialog openFile1 = new OpenFileDialog();
            openFile1.Filter = "(*.xml)|*.xml";
            if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txt_inputXML.Text = openFile1.FileName;
            }
       }

        private void button3_Click(object sender, EventArgs e)
        
       {
            
            OpenFileDialog openFile1 = new OpenFileDialog();
            openFile1.Filter = "(*.xsd)|*.xsd";
            if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txt_inputXSD.Text = openFile1.FileName;
            }
       }
    }
}

QuestionSqlServerCeException "There was an error parsing the query" help .... Pin
hande541-Oct-09 6:22
hande541-Oct-09 6:22 
AnswerRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Md. Marufuzzaman1-Oct-09 7:07
professionalMd. Marufuzzaman1-Oct-09 7:07 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
hande541-Oct-09 7:57
hande541-Oct-09 7:57 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Md. Marufuzzaman1-Oct-09 8:29
professionalMd. Marufuzzaman1-Oct-09 8:29 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
hande541-Oct-09 8:50
hande541-Oct-09 8:50 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Abhishek Sur1-Oct-09 10:31
professionalAbhishek Sur1-Oct-09 10:31 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
hande541-Oct-09 10:33
hande541-Oct-09 10:33 
GeneralRe: SqlServerCeException "There was an error parsing the query" help .... Pin
Md. Marufuzzaman1-Oct-09 20:15
professionalMd. Marufuzzaman1-Oct-09 20:15 
Questionsocket problem: works in visual studio, not as release Pin
TimWallace1-Oct-09 5:49
TimWallace1-Oct-09 5:49 
AnswerRe: socket problem: works in visual studio, not as release Pin
Luc Pattyn1-Oct-09 6:22
sitebuilderLuc Pattyn1-Oct-09 6:22 
GeneralRe: socket problem: works in visual studio, not as release Pin
TimWallace1-Oct-09 6:56
TimWallace1-Oct-09 6:56 
GeneralRe: socket problem: works in visual studio, not as release Pin
Luc Pattyn1-Oct-09 7:09
sitebuilderLuc Pattyn1-Oct-09 7:09 
General[SOLVED] Re: socket problem: works in visual studio, not as release Pin
TimWallace1-Oct-09 8:34
TimWallace1-Oct-09 8:34 
GeneralRe: [SOLVED] Re: socket problem: works in visual studio, not as release Pin
Luc Pattyn1-Oct-09 8:41
sitebuilderLuc Pattyn1-Oct-09 8:41 
QuestionMethod not calculating properly‏ Pin
Marcus Farrugia1-Oct-09 5:09
Marcus Farrugia1-Oct-09 5:09 
AnswerRe: Method not calculating properly‏ [modified] Pin
harold aptroot1-Oct-09 5:22
harold aptroot1-Oct-09 5:22 
GeneralRe: Method not calculating properly‏ Pin
PIEBALDconsult1-Oct-09 15:31
mvePIEBALDconsult1-Oct-09 15:31 

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.