Re: SVG RNGs

On Sun 2003-12-07 Chris Lilley wrote:
> TR> [...] And there's an increasing number of editors which
> TR> support context-aware entry help driven by RNGs (for those who want or
> TR> need entry help).
> 
> Any recommendations for editors that seem to work well?

Unfortunately I can't recommend any specific editor supporting this,
there probably are good ones but I didn't try any.

My XML editor
http://www.pinkjuice.com/howto/vimxml/
doesn't offer entry help (since Vim is extensible it could be
implemented though) and I don't miss that functionality.

Vim when set up as described in the above howto is a great XML editor
which I can really recommend, but if you want RNG-driven entry help
(now, without having to implement it first :), then you could try some
of those:
* nXML
  http://www.thaiopensource.com/download/
  http://www.xmlhack.com/read.php?item=2061
  http://groups.yahoo.com/group/emacs-nxml-mode/
* oXygen
  http://www.xmlhack.com/read.php?item=2072
  http://www.oxygenxml.com/ :
  "Content completion driven by Relax NG Schemas. When editing
  documents associated with a Relax NG schema the editor will offer
  content completion proposals for elements and attributes."
Google found more:
* http://www.xmloperator.net/
  "Any RELAX NG schema or DTD can be used for guiding editing."
* Don't know if http://www.topologi.com supports this.

> TR> tobi ~/del $ xmllint --noout --relaxng
> TR> ~/bulk/xml/schemas/svg/1_1/rng/svg11.rng vimxml.svg
> TR> file:///home/tobi/bulk/xml/schemas/svg/1_1/dtd/svg11-flat.dtd:2278:
> 
> You are validating the dtd against the rng?

No, the above commandline asks xmllint to validate the SVG against the
RNG. But since http://www.pinkjuice.com/howto/vimxml/pics/vimxml.svg
references a DTD xmllint loads it (the local copy listed in the OASIS
catalog) and reports any problems it encounters. If I add --nonet ("Do
not use the Internet to fetch DTD's or entities") and remove the DTD
from my catalog the warning regarding the DTD content will disappear;
xmllint doesn't load the DTD then.

BTW:
xmllint validates the SVG against the RNG as requested, and doesn't
validate it against the DTD referenced in the doctype declaration:

tobi ~/data/run/xval/tests $ xmllint --nonet --noout --relaxng \
 ~/bulk/xml/schemas/svg/1_1/rng/svg11.rng 1_1_with_doct_decl.svg
I/O error : Attempt to load network entity
  http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd
1_1_with_doct_decl.svg:6: element ellipse: Relax-NG validity error :
  Expecting an element desc, got nothing
1_1_with_doct_decl.svg:6: element ellipse: Relax-NG validity error :
  Invalid attribute x for element ellipse
1_1_with_doct_decl.svg:6: element ellipse: Relax-NG validity error :
  Expecting element polyline, got ellipse
1_1_with_doct_decl.svg:6: element ellipse: Relax-NG validity error :
  Element svg has extra content: ellipse
1_1_with_doct_decl.svg fails to validate
tobi ~/data/run/xval/tests $

The invalid attribute x on element ellipse is flagged as RNG error not
as DTD error, as expected/intended. (The other two messages mentioning
desc and polyline are strange but disappear when the invalid attribute
is removed)

> TR> validity warning : Attribute space of element style: already
> TR> defined
> TR>     type %ContentType.datatype; #REQUIRED
> TR>     ^
> TR> vimxml.svg:32: element font-face: Relax-NG validity error :
> TR> Expecting an element desc, got nothing
> 
> Now that one has to be a bug. desc is part of SVG.Description.class
> and its clearly enclosed in a zeroOrMore implying zero of them is
> fine....

I should try to reproduce it with small snippets and report it, I hope
to find the time (I suspect it won't be trivial to reproduce it with
small snippets, and I don't feel confident referring to the RNG before
it's more mature ...).

> TR> Can you recommend any RNG validators other than Jing and xmllint?
> 
> There is also a multischema validator, converts everything into rng
> internally by Sun
> http://wwws.sun.com/software/xml/developers/multischema/

Thanks for the tip (actually a reminder :).

> TR> The DTD would not have to be downloaded if there was a real system
> TR> identifier since it could be used by catalog tools.
> 
> The DTD does not have to be downloaded anyway, since its the external
> DTD subset and thus optional.

Yes, but some parsers understandably are be afraid they could miss
document content and potentially important information contained in
the DTD.

What I meant was that if the XML parser of the RNG validator chooses
to load the DTD then things may go smoother if there's a system ID
since it can be listed in an OASIS catalog.

> TR> You could omit the DTD doctype declaration, and if you had it in there
> TR> for validation you could use RNG instead
> 
>  You can use the RNG anyway, if you prefer, no?

Yes, I just wanted to say that the DTD doctype declaration could
perhaps be omitted, and if it is to remain it would simplify stuff for
some if it would feature a real system identifier instead of a
relative path.

No offense, just one possible POV:
An RNG is being written in order to progress towards namespace-aware
schemas, but the RNG itself references a schema (a DTD) which isn't :)

(And if that DTD happens to set attributes then two RNG validators
will use two potentially different RNGs, but this is probably not the
case and just a minor general point.)

> I think that the xsi:schemaLocation does exactly that - suggests but
> does not require.

I think so too, and I'd like to see a standardised equivalent for use
with RNG (or better with any schema language).

> Mind you, in theory, so does a DOCTYPE

I know :) ... but if parser x follows the suggestion and parser y
doesn't then they might see different infosets/documents; this would
not be the case with RNG.

> TR> [...] an XHTML
> TR> document with no doctype declaration or an XHTML fragment (both in the
> TR> XHTML 1 namespace) doesn't specify if it's written in XHTML 1.0
> TR> Strict, Transitional, or in XHTML 1.1.
> 
> Ah, okay. Sounds like an architectural principle lurking in there
> somewhere.

TAG to the rescue :)

> TR> And then there is the issue of fully independent and automatic
> TR> validation: [...] no way of knowing which schema I should or
> TR> could use
> 
> You might be able to get that information by dereferencing the
> namespace URI, seeing if there is a RDDL document there, and
> looking for a link to your preferred schema type.

Good idea, but the "might" is the problem: I fear that often this will
fail due to RDDL not being very popular. A simple mechanism such as
xsi:schemaLocation might become more popular ...

> TR> [...] Although I prefer the way the SVG WG chose: have one NS URI
> TR> for all versions, then specify versions and profiles with attributes.
> 
> Yes I think thats better too, so a viewer does not need to have a
> collection of near-identical namespaces that  it recognises.

Yes, and it's also a semantical/philosophical matter: an SVG 1.0 and
an SVG 1.2 document both are written in the same language (namely
SVG), thus it makes sense that they share the same namespace. A tool
knowing SVG 1.0 will also know that the other document is SVG,
although it doesn't know SVG 1.2 yet.

Tobi

-- 
http://www.pinkjuice.com/

Received on Sunday, 7 December 2003 13:20:00 UTC