I was trying a simple Try It editor and i wanted to know that how do i validate the code that the user has entered be it HTML or a script , how do i know if it has any errors? also, are there any library's for doing that
-
1Check here for JS validation github.com/jshint/jshintelclanrs– elclanrs2013-07-30 04:21:47 +00:00Commented Jul 30, 2013 at 4:21
-
okay ty got it , btw any clues for HTML syntax checking too....?Harshit Laddha– Harshit Laddha2013-07-30 04:23:32 +00:00Commented Jul 30, 2013 at 4:23
-
HTML here validator.w3.orgelclanrs– elclanrs2013-07-30 04:24:18 +00:00Commented Jul 30, 2013 at 4:24
-
no but if i use w3.org wont it require internet connection always, as what i am trying to do here (sorry did not mention it earlier) is make an local app and so i want offline options for validating the syntax, and i saw some such validators in some text editors i use but could not figure out how they workHarshit Laddha– Harshit Laddha2013-07-30 04:37:46 +00:00Commented Jul 30, 2013 at 4:37
Add a comment
|
3 Answers
I just check stackoverflow, and found this one,maybe it helps you.
var xml = 'Caleb';
var parser = new DOMParser();
var doc = parser.parseFromString(xml, 'text/xml');
Comments
if you are using chrome, then use google developer tools (press ctrl+shift+i), there you will find various options in the tab like ELEMENT(to see html code, styles of your document),CONSOLE(you will find errors and warning there), this is very useful, try and explore this one only.
1 Comment
Harshit Laddha
no actually what i wanted to do was ask the user to write some script on the fly and then the backend will process it for any errors so chrome developer tools wont help there i feel