Hi All,
I want some good implementation in Javascript for validating XML data.
If user enters some text in the textarea control, before XML data is saved in the database, the validation should happen in terms of whether it is well-formed or not, etc. Can you please point me to the same?
Thanks in advance!
Regds,
Sivakumar
10 1956
Use a server-side language to do the validation. You could make an Ajax request to validate the XML string.
Use a server-side language to do the validation. You could make an Ajax request to validate the XML string.
Hi acoder,
This is my last resort. I want to implement using client side validation.
Please help !
Thanks,
Sivakumar
if you run it through a parser, the parser will error out if the xml is semantically broken.
true validity is harder to validate, and i am not aware of any javascript-based validator, not that it's impossible.
this might interest you for the well-formedness part: -
function makeWellFormed(str){
-
var b = document.createElement("b");
-
b.innerHTML = str;
-
return b.innerHTML;
-
}
-
-
makeWellFormed("<ber>frefg</ber") //returns "<ber>frefg</ber>"
-
makeWellFormed("<ber>frefg</ber>") //returns "<ber>frefg</ber>"
-
makeWellFormed("<ber>frefg") //returns "<ber>frefg</ber>"
-
if you run it through a parser, the parser will error out if the xml is semantically broken.
true validity is harder to validate, and i am not aware of any javascript-based validator, not that it's impossible.
this might interest you for the well-formedness part: -
function makeWellFormed(str){
-
var b = document.createElement("b");
-
b.innerHTML = str;
-
return b.innerHTML;
-
}
-
-
makeWellFormed("<ber>frefg</ber") //returns "<ber>frefg</ber>"
-
makeWellFormed("<ber>frefg</ber>") //returns "<ber>frefg</ber>"
-
makeWellFormed("<ber>frefg") //returns "<ber>frefg</ber>"
-
Thanks for the reply! the function you provided just returns the wellformed strings. I was looking for some xml validation code.
Thanks for the reply! the function you provided just returns the wellformed strings. I was looking for some xml validation code.
Have you seen the link I posted?
Have you seen the link I posted?
Yes! I have seen it. But the problem with that is, it is a validation of xml using a DTD schema. I was looking for a gereric validator for just well formedness.
In the mean time we had written a validator ourselves. But unfortunately that was not very robust :(
Please help if you can !
Yes! I have seen it. But the problem with that is, it is a validation of xml using a DTD schema. I was looking for a gereric validator for just well formedness.
The first section (Syntax check your XML) does exactly that!
The first section (Syntax check your XML) does exactly that!
This is right on spot and thanks for pointing me to this. Earlier when you posted this I didn't look at it correctly. But now it really solved the problem.
Thank you very very much for helping me on this !!
No problem, you're welcome. Glad I was able to help.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mkremser |
last post by:
Hi NG!
In a XSD, we (try to) specify that a node ("BsqCallInfo") has two
attributes and can have any nodes as its children:
<xsd:element name="BsqCallInfo">
<xsd:complexType>
<xsd:choice...
|
by: Boris Kester |
last post by:
Hello,
I tried to validate this page: http://www.traveladventures.org/xhtml/
daralhajar01.html on validator.w3.org and got a message that the page is
not valid transitional xhtml. However, after...
|
by: Ali-R |
last post by:
Hi,
Is there a parser which parses CSV files?
Thanks for your help.
Reza
|
by: Herve MAILLARD |
last post by:
Hi,
J'ai un bouton ASPX qui doit déclencher un script java.
I have an ASPX button running a javascript.
To do this, I have added in the codebehind :...
|
by: Paul |
last post by:
I am trying to setup a field validator and tried using the control to validate set to a dropdown list box but did not seem to work. Is there anyway to set this up or do you need to use client side...
|
by: M Arora |
last post by:
Hi All
I am using Xerces parser to convert my xml to the output given below
and for this i am using the xslt. How shall i create href attribute in
xerces parser?
When i am using MSDOM parser...
|
by: gullyou |
last post by:
Sorry I crossposted this to java group. Didn't know distinction
between Java & Javascript
Hi,
I'm not a Java script programmer but have this web page with a form
form that
includes a...
|
by: Mike Collins |
last post by:
Is it possible to use a required field validator and have it make a user
answer a comment field based on a drop down value picked? For instance, if
the user selects "It was terrible", make them...
|
by: Prasanth Nair |
last post by:
hi,
When I add the following in struts-config.xml, I am getting the below mentioned error while starting the server.
/***********************Struts entry**********************/
<plug-in...
|
by: UncleRic |
last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro
I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env):
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |