Click here to Skip to main content
15,916,019 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: Accessing attributes without knowing there names Pin
MODI_RAHUL22-Jun-06 1:34
MODI_RAHUL22-Jun-06 1:34 
Questionhow to create multiple xml files from a single excel sheet having huge data. Pin
yekanth.v20-Jun-06 21:29
yekanth.v20-Jun-06 21:29 
AnswerRe: how to create multiple xml files from a single excel sheet having huge data. Pin
Rizwan Bashir20-Jun-06 22:14
Rizwan Bashir20-Jun-06 22:14 
QuestionText, XML Parsing Pin
VK-Cadec20-Jun-06 3:12
VK-Cadec20-Jun-06 3:12 
QuestionVB6 Or Visual Studio - MFC CC++ Pin
sweep12319-Jun-06 0:37
sweep12319-Jun-06 0:37 
AnswerRe: VB6 Or Visual Studio - MFC CC++ Pin
Paddy Boyd19-Jun-06 3:24
Paddy Boyd19-Jun-06 3:24 
Questionvalidating XML document against an XML schema Pin
lupin9918-Jun-06 18:29
lupin9918-Jun-06 18:29 
AnswerRe: validating XML document against an XML schema Pin
BoneSoft19-Jun-06 4:41
BoneSoft19-Jun-06 4:41 
I'm not sure off hand what's happening in your code, but I have an example that's worked for me. strXMLDoc should be the full XML text, and urlPath should be the path to your schema, which I believe is what your example was expecting. Try this...

private System.Collections.Specialized.StringCollection errors =
    new System.Collections.Specialized.StringCollection();
private System.Collections.Specialized.StringCollection warns =
    new System.Collections.Specialized.StringCollection();
public bool ValidateMapData(string strXMLDoc, string urlPath) {
    errors.Clear();
    warns.Clear();
    System.Xml.XmlTextReader tr = new System.Xml.XmlTextReader(new System.IO.StringReader(strXMLDoc));
    System.Xml.XmlValidatingReader vr = new System.Xml.XmlValidatingReader(tr);
    try {
        vr.Schemas.Add(System.Xml.Schema.XmlSchema.Read(new System.IO.StringReader(urlPath),
	    new System.Xml.Schema.ValidationEventHandler(MessageHandler)));
        vr.ValidationType = System.Xml.ValidationType.Schema;
    } catch (Exception ex) {
        while (ex != null) {
            errors.Add(ex.Message);
            ex = ex.InnerException;
        }
    }
    try {
        while(vr.Read());
    } catch (Exception ex) {
        while (ex != null) {
            errors.Add(ex.Message);
            ex = ex.InnerException;
        }
    }

    string msgs = string.Empty;
    foreach (string s in errors) {
        msgs += "\r\nError: " + s;
    }
    foreach (string s in warns) {
        msgs += "\r\nWarning: " + s;
    }
    if (errors.Count > 0) {
        msgs = "Errors validating..." + msgs;
        MessageBox.Show(this, msgs, "Schema validation", MessageBoxButtons.OK, MessageBoxIcon.Error);
    } else if (warns.Count > 0) {
        msgs = "Warnings validating..." + msgs;
        MessageBox.Show(this, msgs, "Schema validation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
    } else {
        return true;
    }
    return false;
}
private void MessageHandler(object sender, System.Xml.Schema.ValidationEventArgs args) {
    if (args.Severity == System.Xml.Schema.XmlSeverityType.Error) {
        errors.Add(args.Message);
    } else {
        warns.Add(args.Message);
    }
}


Visit BoneSoft.com
QuestionXpath invalid token with concat Pin
Duncan Sample16-Jun-06 0:25
Duncan Sample16-Jun-06 0:25 
QuestionHow Retrive XML File in Memory Streams !!!! [modified] Pin
HatakeKaKaShi15-Jun-06 17:14
HatakeKaKaShi15-Jun-06 17:14 
QuestionCreating An XML file In MemoryStream (Urgent ! ) [modified] Pin
HatakeKaKaShi15-Jun-06 16:25
HatakeKaKaShi15-Jun-06 16:25 
AnswerRe: Creating An XML file In MemoryStream (Urgent ! ) Pin
BoneSoft16-Jun-06 11:33
BoneSoft16-Jun-06 11:33 
QuestionRead a XML Document and extract a node value Pin
chandler8314-Jun-06 5:51
chandler8314-Jun-06 5:51 
AnswerRe: Read a XML Document and extract a node value Pin
Elina Blank20-Jun-06 3:25
sitebuilderElina Blank20-Jun-06 3:25 
AnswerRe: Read a XML Document and extract a node value Pin
braber29-Jun-06 7:27
braber29-Jun-06 7:27 
QuestionHow do you get XSL to just read any element? Pin
Red_Wizard_Shot_The_Food14-Jun-06 4:41
Red_Wizard_Shot_The_Food14-Jun-06 4:41 
AnswerRe: How do you get XSL to just read any element? Pin
Dustin Metzgar14-Jun-06 4:45
Dustin Metzgar14-Jun-06 4:45 
Questionremove a table with xsl Pin
Yustme14-Jun-06 4:13
Yustme14-Jun-06 4:13 
AnswerRe: remove a table with xsl Pin
Elina Blank14-Jun-06 4:38
sitebuilderElina Blank14-Jun-06 4:38 
GeneralRe: remove a table with xsl Pin
Yustme14-Jun-06 4:41
Yustme14-Jun-06 4:41 
GeneralRe: remove a table with xsl Pin
Elina Blank14-Jun-06 4:53
sitebuilderElina Blank14-Jun-06 4:53 
QuestionHow to validate one file using multiple schemas? Pin
Arve Bjørnerud14-Jun-06 1:58
Arve Bjørnerud14-Jun-06 1:58 
QuestionAlmost there! [modified] Pin
Arve Bjørnerud15-Jun-06 2:54
Arve Bjørnerud15-Jun-06 2:54 
Questionknow the size of DOM Pin
myvisualcplusplus13-Jun-06 19:34
myvisualcplusplus13-Jun-06 19:34 
QuestionDiff functionality for xml Pin
anidarsha13-Jun-06 19:07
anidarsha13-Jun-06 19:07 

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.