[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Validation question


kiia kallio
Kiia Kallio scripsit:

> - Some elements (such as "feConvolveMatrix") have a matrix as their
> parameter. This matrix is defined with two attributes: "order"
> (number-optional-number) and "kernelMatrix" (list of numbers). In
> order for the attributes to be valid, the "kernelMatrix" should have as
> many values as the order defines (for instance order = "3, 2" means
> that the matrix should have 6 values). There are also other cases of
> cross-dependencies like this.

I think that Schematron can handle this, though I am no expert on it.

> - Animation elements ("animate", "set", "animateColor",
> "animateTransform", "animateMotion") have some attributes ("by", "from",
> "to", "values") that define the new values for the animated attribute
> of some other element. The valid values for the attribute depend on the
> target attribute and the target element that has the attribute. For
> instance markup <set xlink:href = "#foobar" attributeName="type"
> to="turbulence" begin="3s" dur="6s"/> is completely valid if the element
> whose id is "foobar" is "feTurbulence". If it happens to be for instance
> "feColorMatrix", this is not valid. "feColorMatrix" does have "type"
> attribute, but "turbulence" is not a valid value for that. (And it
> is not even necessary to define "xlink:href" attribute to specify the
> animated element, but if the attribute is missing, the animation target
> is the parent element.)

I think that this is quite beyond the power of any validator not
written for the purpose, especially given that the xlink:href
attribute contains a general URI, not merely an IDREF.

> - Then there's all kind of little issues where the data to be validated
> is stored in the attribute (for conserving space) although an XML
> representation would be much more nicer and easier to parse. For example:
> <path d="M100,200 C100,100 250,100 250,200 S400,300 400,200" />
> would be much easier to process and validate if it was something like this:

[snip]

> but unfortunately it isn't. (And I very well understand why, considering
> the space it takes...) So now the validator has to check if there
> is correct amount of numbers after each letter code, if the letter
> codes are valid etc. The valid format can be expressed with a BNF,
> but there are also even more complex ones to validate, such as datetime
> strings in ISO8601 format where BNF is not enough.

Such datetime strings can be handled by W3C XML Schema or RELAX NG.
The path strings are an excellent use case for RELAX NG pluggable
datatypes; you could write a recognizer for them.

> And of course there are all kinds of normal validation issues like
> restricted ranges for numeric values, checking if URI's are valid etc.

WXS and RNG can both handle these.

> So, I'd like to know if any validation schema can handle such things
> like cross- dependencies of attributes, dependencies between attributes
> and element types, and parsing of complex attributes for validating
> them, or (as the designers of various schemas are probably reading
> the list) if there are any plans for the features I'm looking for.

RELAX NG is good at this kind of dependency.  It can easily handle
attribute vs. attribute (on the same element) and attributes that
control the possible child elements, using its general choice pattern.

Overall I recommend that you write a RELAX NG schema, starting with the
DTD and converting it to RNG using Trang.  Then add restrictions and
refinements, including specifying XML Schema and custom datatypes as
needed; you can then write validators for the custom datatypes.
A few embedded Schematron rules, and you should have 95% of the job done.

-- 
It was impossible to inveigle           John Cowan <jcowan@r...>
Georg Wilhelm Friedrich Hegel           http://www.ccil.org/~cowan
Into offering the slightest apology     http://www.reutershealth.com
For his Phenomenology.                      --W. H. Auden, from "People" (1953)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.