List Info

Thread: XML validation




XML validation
user name
2007-01-15 16:18:41
I have an embedded system that uses XML extensively.  Many
of the XML 
files are modified and generated by other software.  I am
looking for a 
simple XML well-formedness checker, something I can point at
an XML file 
and tell the user that s/he has a problem with file xyz.xml
around line 
YYY or maybe element XXX.

Does any such thing exist?  I've found RXP, but it doesn't
use 
libxml.... I really don't want to introduce more stuff into
my (already 
bloated) embedded box...

--Yan
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: XML validation
user name
2007-01-15 19:52:19
Yan Seiner wrote:
> I have an embedded system that uses XML extensively. 
Many of the XML 
> files are modified and generated by other software.  I
am looking for a 
> simple XML well-formedness checker, something I can
point at an XML file 
> and tell the user that s/he has a problem with file
xyz.xml around line 
> YYY or maybe element XXX.
> 
> Does any such thing exist?  I've found RXP, but it
doesn't use 
> libxml.... I really don't want to introduce more stuff
into my (already 
> bloated) embedded box...

The obvious answer is xmllint (which needs a DTD). That
makes me suspect 
that I am misinterpreting something and it's the wrong
answer, but you 
get what you pay for. 

- Rush
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: XML validation
user name
2007-01-16 10:38:40
Daniel Veillard wrote:
> On Mon, Jan 15, 2007 at 05:52:19PM -0800, Rush Manbert
wrote:
>   
>> Yan Seiner wrote:
>>     
>>> I have an embedded system that uses XML
extensively.  Many of the XML 
>>> files are modified and generated by other
software.  I am looking for a 
>>> simple XML well-formedness checker, something I
can point at an XML file 
>>> and tell the user that s/he has a problem with
file xyz.xml around line 
>>> YYY or maybe element XXX.
>>>
>>> Does any such thing exist?  I've found RXP, but
it doesn't use 
>>> libxml.... I really don't want to introduce
more stuff into my (already 
>>> bloated) embedded box...
>>>       
>> The obvious answer is xmllint 
>>     
>
>   yes
>
>   
>> (which needs a DTD).
>>     
>
>   no  . Well
formedness is tested just by running
>     xmllint --noout file.xml
>
> and only well-formedness errors will be printed there,
and possibly some
> warning (which can be suppressed with --nowarning).
> Then validity can be checked against the DTD (--valid
or --dtdvalid),
> or XSD and Relax-NG (see xmllint help), but that
doesn't seems to be the
> question.
>
> Daniel
>
>   

My bad for not reading the docs on xmllint far enough.  I
missed the 
well-formedness check it does completely.....

Has anyone written it as a function, so I could call it from
within 
PHP?  What I would like to do is the following:

1.  PHP backend parses XML file using domxml_open_file
2.  parse fails
3.  PHP then invokes xmllint on the failed xml file, and the
PHP backend 
presents the user with a coherent message as to where the
parse failed.

I could probably hack something together using the xmllint
--htmlout 
option, but it would be neater if it was all packaged up...


--Yan
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: XML validation
user name
2007-01-16 12:02:02
Daniel Veillard wrote:
> On Mon, Jan 15, 2007 at 05:52:19PM -0800, Rush Manbert
wrote:
> 
>>Yan Seiner wrote:
>>
>>>I have an embedded system that uses XML
extensively.  Many of the XML 
>>>files are modified and generated by other
software.  I am looking for a 
>>>simple XML well-formedness checker, something I
can point at an XML file 
>>>and tell the user that s/he has a problem with
file xyz.xml around line 
>>>YYY or maybe element XXX.
>>>
>>>Does any such thing exist?  I've found RXP, but
it doesn't use 
>>>libxml.... I really don't want to introduce more
stuff into my (already 
>>>bloated) embedded box...
>>
>>The obvious answer is xmllint 
> 
> 
>   yes
> 
> 
>>(which needs a DTD).
> 
> 
>   no  . Well
formedness is tested just by running
>     xmllint --noout file.xml
> 
> and only well-formedness errors will be printed there,
and possibly some
> warning (which can be suppressed with --nowarning).

Oh. Cool! I've never used it without a DTD. Sorry for the
misinformation 
and thanks for the clarification. I have a use for this...

- Rush
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: XML validation
user name
2007-01-16 12:21:58
On Tue, Jan 16, 2007 at 08:38:40AM -0800, Yan Seiner wrote:
> Daniel Veillard wrote:
> My bad for not reading the docs on xmllint far enough. 
I missed the 
> well-formedness check it does completely.....
> 
> Has anyone written it as a function, so I could call it
from within 
> PHP?  What I would like to do is the following:

  Hum, PHP uses libxml2 at least starting from 5.0. You
should be 
able to capture the parsing error messages, check the docs,
I would
be really surprized if it wasn't there.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )