Click here to Skip to main content
15,889,900 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionQuestion about Convert XML to DataTable Pin
leejs4135-Nov-08 15:10
leejs4135-Nov-08 15:10 
QuestionProblems with XSL Patterns Pin
saanj5-Nov-08 0:10
saanj5-Nov-08 0:10 
QuestionUsing xs:Pattern like sql "Like" statement Pin
saanj4-Nov-08 23:45
saanj4-Nov-08 23:45 
Questionwant to see "<" and ">" instead of "&gt" and "&lt" Pin
idoyohanan4-Nov-08 1:19
idoyohanan4-Nov-08 1:19 
AnswerRe: want to see "<" and ">" instead of ">" and "<" Pin
harold aptroot7-Nov-08 9:17
harold aptroot7-Nov-08 9:17 
QuestionHow to handle fixing XML validation errors in C#.NET? Pin
ritatx253-Nov-08 8:20
ritatx253-Nov-08 8:20 
AnswerRe: How to handle fixing XML validation errors in C#.NET? Pin
led mike4-Nov-08 4:45
led mike4-Nov-08 4:45 
GeneralRe: How to handle fixing XML validation errors in C#.NET? Pin
ritatx254-Nov-08 6:26
ritatx254-Nov-08 6:26 
Below is what I did to be able to delete problematic elements(does not conform to schema) from an XML file.

1. In the event handler, I set the innertext of error nodes to 'ERROR'
static void Schemas_ValidationEventHandler(object sender, ValidationEventArgs e)
{
//Get the Schema Validation Exception
System.Xml.Schema.XmlSchemaValidationException ex = (XmlSchemaValidationException)e.Exception;
//Get the error Xml Node
XmlNode node = (XmlNode)ex.SourceObject;
//Set the text to ERROR so that it can be removed later
//NOTE: trying to delete error nodes here as part of validation causes the validation to break
//that is why i used this method of marking problematic nodes and removing them later
node.InnerText = "ERROR";
}

2. Then I have a method to remove 'ERROR' nodes. This method along with the Validate() method is called in a loop until there are no more ERROR nodes. The resulting XML document is a document conforming to its schema with all other error nodes deleted.

static bool RemoveErrorNodes(XmlDocument xmlDoc)
{
bool deletedNodes = false;
XPathNavigator xpath = xmlDoc.CreateNavigator();
XPathNodeIterator errNodes = xpath.Select("//*");
while (errNodes.MoveNext())
{
XPathNodeIterator errNode = errNodes.Current.Select("*[text()='ERROR']");
while (errNode.MoveNext())
{
errNode.Current.DeleteSelf();
deletedNodes = true;
}
}
return deletedNodes;
}
QuestionFreeThreadedDOMDocument problem of selectsinglenode Pin
Chandra-shekar-Machipeddi2-Nov-08 20:04
Chandra-shekar-Machipeddi2-Nov-08 20:04 
AnswerRe: FreeThreadedDOMDocument problem of selectsinglenode Pin
led mike3-Nov-08 5:00
led mike3-Nov-08 5:00 
GeneralRe: FreeThreadedDOMDocument problem of selectsinglenode Pin
Chandra-shekar-Machipeddi3-Nov-08 18:50
Chandra-shekar-Machipeddi3-Nov-08 18:50 
QuestionXsl problem to find correct nodes using idrefs Pin
BadKarma30-Oct-08 0:44
BadKarma30-Oct-08 0:44 
QuestionSoap Error need help pls !! Pin
purpplepink28-Oct-08 5:43
purpplepink28-Oct-08 5:43 
QuestionConverting Data from row to column wise through xsl Pin
Tarini Singh27-Oct-08 0:32
Tarini Singh27-Oct-08 0:32 
AnswerRe: Converting Data from row to column wise through xsl Pin
led mike27-Oct-08 7:11
led mike27-Oct-08 7:11 
QuestionFormating XML Output File Pin
zjaffary25-Oct-08 3:10
zjaffary25-Oct-08 3:10 
Questionxml parser Pin
jhyn21-Oct-08 1:16
jhyn21-Oct-08 1:16 
AnswerRe: xml parser Pin
led mike21-Oct-08 4:54
led mike21-Oct-08 4:54 
GeneralRe: xml parser Pin
jhyn21-Oct-08 15:42
jhyn21-Oct-08 15:42 
QuestionOOXML parsing problem Pin
don_Pardon20-Oct-08 6:39
don_Pardon20-Oct-08 6:39 
AnswerRe: OOXML parsing problem Pin
led mike20-Oct-08 6:49
led mike20-Oct-08 6:49 
GeneralRe: OOXML parsing problem Pin
don_Pardon20-Oct-08 6:57
don_Pardon20-Oct-08 6:57 
GeneralRe: OOXML parsing problem Pin
led mike20-Oct-08 7:40
led mike20-Oct-08 7:40 
GeneralRe: OOXML parsing problem Pin
don_Pardon20-Oct-08 8:24
don_Pardon20-Oct-08 8:24 
GeneralRe: OOXML parsing problem Pin
don_Pardon21-Oct-08 1:37
don_Pardon21-Oct-08 1:37 

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.