BizTalk Utilities Xselerator XSLT IDE


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

validate xml and remove invalid nodes

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Ask XML questions here] >> .NET programming discussions >> validate xml and remove invalid nodes Page: [1]
Login
Message << Older Topic   Newer Topic >>
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
Post #: 1
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.

(in reply to vabbs)
Post #: 2
Page:   [1]
All Forums >> [Ask XML questions here] >> .NET programming discussions >> validate xml and remove invalid nodes Page: [1]
Jump to:





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



Email TopXML

Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.078