discuss: XML validation service?
Subject:
Re: XML validation service?
From:
John Fleck ####@####.####
Date:
17 Nov 2002 21:45:25 -0000
Message-Id: <1037569553.1102.6.camel@jelloiii>
On Sun, 2002-11-17 at 14:13, David Horton wrote:
> Hi Everyone,
>
> I am in the process of converting some stuff that I originally wrote in
> HTML into Dockbook XML. As a result I am pretty familiar with HTML and
> the tools that go with it, but not so familiar with XML and its tools.
> I generally I write HTML in vi, preview it with Mozilla and check it
> using the validator at w3c.org. I like this method, because vi and
> Mozilla are platform independent. I am trying something similar as I
> move to XML. I'm editing in vi and previewing in Mozilla. Mozilla does
> a nice job of displaying the XML when given a stylesheet, but I am
> wondering if I am making any XML syntax errors that it doesn't catch. I
> tried the w3c.org validator on my XML and it choked on my use of
> "xlink". For example, it didn't like:
>
> |<link xlink:type="simple" xlink:href="intro.xml">Introduction</link>|
>
> Mozilla didn't have a problem with it at all. Unfortunately since I
> am not an XML guru I don't know if this is a mistake on my part or
> something that is not part of a standard now, but will be in the future.
> The reason I am using xlink is because it allows me to preview raw XML
> documents in Mozilla and have hyperlinks that work.
>
> If anyone is writing in Dockbook XML using a similar approach and has
> any tips or tricks, I would really appreciate it. I want to learn how
> to do it right from the beginning.
>
You most likely have libxml2 installed on your machine. It includes a
command line parsing tool called xmllint. At the command line, type:
xmllint --noout --valid --noent filename.xml
The --noout suppresses output, --valid tells it to validate, and --noent
tells it to substitute entity values for entity references. Those are
the standard flags I use, but there are a ton more to handle other
cases.
Cheers,
John
--
John Fleck
####@####.#### (h) ####@####.#### (w)
http://www.inkstain.net http://www.abqjournal.com
"Sometimes, a diner is all about the mac and cheese."
- Zippy the Pinhead