Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Extending the XHTML transitional XSD [Thread Next] Re: Extending the XHTML transitional XSDTo: NULL Date: 9/15/2006 2:49:00 PM Helio Miranda <heliomx@g...> writes: > ... I've extended some XHTML tags to add an form > validation functionality in the client side (implemented with javascript > ). I've created a set of attributes that indicates what kind of > validation check is needed for the form field before it was submitted to > the server. Like this: > > <input type="text" v:type="email" /> > <input type="text" v:type="name" /> > > Then a javascript function processes all the tags and validates the form > accordingly to the v:type attribute. > > Everything was fine. All the modern desktop browsers supported the > extension, but that's not enough for the project I've been working on. > The code must be validated by some XHTML validators around the web. The > code validation is required for "quality of the product" reasons. These > validators were complaining about the invalid/unspecified attribute used > in the <input /> tag. > > So I've created a Schema for the "v" namespace. The problem is: I've > tried to extend the XHTML specification and turn the code into a valid > XML document (the input tag must be expecting a possible v:type > attribute occurrence) . I found it was a hard task to conclude. > > So, can you give me suggestions of a painless way for doing it? And what > validation engines support such schema extension? Painless? I doubt it - judging by your description, pain is part of the structure of the situation. HTML validators that use the standard HTML DTDs are unlikely to aceept your attribute, because DTDs have no construct for saying "any attribute in any namespace other than the HTML namespace is OK here". The HTML DTDs are heavily parameterized, so in theory you may be able to define a parameter entity that makes the attribute v:type legal in the input element. But it won't be much fun. (X)HTML validators that use XSD schemas to validate will, or won't, accept your attribute as legal, depending on whether the schema they are using does or does not have an attribute wildcard on the input element. There are several sets of XSD schema documents for XHTML on the Web, some of which are attempting to mimic the behavior of the DTDs as exactly as possible (so they don't have attribute wildcards), and some of which are attempting to match the spec more closely (so they do). Schemas with the latter should accept your v:type attribute whether you provide a schema for your namespace or not (because the wildcards in question are lax). Whether a validation service supports extensions or modifications to the schema being used depends on the purpose and policy of the service. If the point is to provide a running validator, so that users of the service don't need to install one, then it's plausible to allow the user to specify what schema is to be used. But if the point is to provide some more or less objective test of the conformance of a document to a specified schema, then the service won't typically want to use the schema you provide -- it will want to use the schema it already knows about from trusted sources. You aren't a trusted source - if you were, your document wouldn't need validating, would it? So I wouldn't expect most HTML validators to allow you to specify your own copy of the relevant schema documents. Whether that puts you irrevocably at loggerheads with those who want validation of the document, I can't tell. If you absolutely must make the HTML valid against the DTD, or against a schema that doesn't allow for out-of-namespace attributes, then I can think of one possible way out: use the built-in semantic extension provided by the 'class' attribute. So instead of v:type="email", you write class="email". It's not even tag abuse -- that kind of thing is (as far as I understand) what class was introduced for. I hope this helps. --C. M. Sperberg-McQueen World Wide Web Consortium | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
