Forum main page
Most
active member
Login page
Register
Log out
Search page
View our event calendar
Add general event such as an
upcoming software release or conference
View all birthdays
Public image gallery
Upload your images in your profile
Profile editing page
Subscription list page
Address book page
Member list page
View the most
active member
User groups listing
Private message page
|
|
Users viewing this topic: none
|
|
Login | |
|
validate xml and remove invalid nodes - 3 March 2008
|
|
|
vabbs
Posts: 2
Score: 0 Joined: 3 March 2008 Status: offline
|
Hi, I would like to validate an xml doc against an xsd and remove the invalid nodes. For eg in the below xml if any of the element data(supplier in this case) for order 3 is invalid then the validation procedure should remove that entire order element and come up with a xml doc with only valid orders. eg <Orders> <Order><id>1</id><Quantity>123</Quantity><Supplier>A</Supplier></Order>. <Order><id>2</id><Quantity>124</Quantity><Supplier>B</Supplier></Order>. <Order><id>3</id><Quantity>125</Quantity><Supplier></Supplier></Order>. <Order><id>4</id><Quantity>126</Quantity><Supplier>D</Supplier></Order>. </Orders> could someone tell me how to do this in .NET 2.0 Thanks in advance
|
|
|
|
RE: validate xml and remove invalid nodes - 4 March 2008
|
|
|
JohnD
Posts: 141
Score: 0 Joined: 13 April 2004 Status: offline
|
Vabbs, validating against a schema will tell you that something is wrong, but you will need to edit the instance some other way - for example using an XmlDocument. I don't think there is any kind of "auto correcting" function available. Also, the schema validation will be able to you simple things (such as this element is empty) but it will not tell you other faults (such as this record already occurred). So, (IMHO) to fix any errors you will need to edit the document in code, and to detect some sorts of errors you will also need to be in code. John D.
|
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|