TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
olaitan temi
NA
8
2.4k
upload xml file to validate xsd file already store in mvc
Sep 23 2015 5:42 AM
already create my controller
public ActionResult Index()
{
Validations Validate = new Validations();
string isValidate = Validate.ValidateXMlUsingXSD();
if (isValidate == string.Empty)
isValidate = "xml is well formed according to XSd.";
ViewBag.Validate=isValidate;
return View();
}
]
}
and the service code
namespace ValidateXmlUsingXsd1.Service
{
public class Validations
{
public string ValidateXMlUsingXSD()
{
try
{
string xmlPath = @"C:\Users\topcrat\Documents\Visual Studio 2013\Projects\ValidateXmlUsingXsd1\ValidateXmlUsingXsd1\XML\XMLFile1.xml";
string xsdPath = @"C:\Users\topcrat\Documents\Visual Studio 2013\Projects\ValidateXmlUsingXsd1\ValidateXmlUsingXsd1\XSD\XMLSchema1.xsd";
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
settings.Schemas.Add(null, XmlReader.Create(xsdPath));
XmlReader xmlReader = XmlReader.Create(xmlPath, settings);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);
return string.Empty;
}
catch(Exception e )
{
return e.Message;
}
}}
i want to be able to upload my xml file via view and validate it against the schema.
Reply
Answers (
3
)
Timer in mvc4?
How to Intigrate with twitter