Click here to Skip to main content
15,915,611 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: Accessing attributes without knowing there names Pin
Elina Blank21-Jun-06 4:30
sitebuilderElina Blank21-Jun-06 4:30 
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 
hi,

i'm a newbie with XML and i need some help with my problem.

here it goes.. i'm trying to validate an xml document against an xml schema using the code below.. however, when in debug mode, i'm getting this error message (>> "object reference not set to an instance of an object" when i run thru this part of the code [>> while (vr.Read()); ]..

what am i missing here.. pls help... Cry | :((

thanks in advance...
lupin



here's the code:
public bool ValidateMapData(string strXMLDoc, string urlPath)
// (e.g. urlPath = "C:\MyXML\myschema.xsd")
{
bool isValidXml = true;

try
{
XmlSchemaCollection sc = new XmlSchemaCollection();
sc.ValidationEventHandler += new ValidationEventHandler(ValidationFailed);
sc.Add(null, urlPath);

if(sc.Count > 0)
{
StringReader sr = new StringReader(strXMLDoc);
XmlTextReader tr = new XmlTextReader(sr);
XmlValidatingReader vr = new XmlValidatingReader(tr);

vr.ValidationType = ValidationType.Schema;
vr.Schemas.Add(sc);
vr.ValidationEventHandler += new ValidationEventHandler(ValidationFailed);

while (vr.Read());

vr.Close();

if (errorCount > 0)
{
throw new Exception(errorMessage);
}

}
}
catch(Exception e)
{
myLog.Error(this, e.Message);
isValidXml = false;
}

return isValidXml;
}

public void ValidationFailed(object sender, ValidationEventArgs e)
{
myLog.Error(this, e.Message);
errorCount ++;
}


AnswerRe: validating XML document against an XML schema Pin
BoneSoft19-Jun-06 4:41
BoneSoft19-Jun-06 4:41 
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 

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.