Tech Off Thread

8 posts

Patching VS's XHTML XSDs

Back to Forum: Tech Off
  • User profile image
    W3bbo

    Visual Studio's XSDs for XHTML1.x contain a few errors. For instance, they say that <img /> cannot be a member of <button> (when it can), and that type="" is not an attribute of <button> (it is).

    I've had a look for VS's XSD files, but I don't know which one is for XHTML.

    There's "xhtml.xsd" under %VS%\Xml\Schemas
    And there's "xhtml_strict-11.xsd" under %VS%\Common7\Packages\schemas\html

    Which one should I be editing?

    EDIT:

    Okay, this is a mystery. Both XSD files contain the right instructions, but for some reason the VS IDE is just ignoring it. Any ideas?

  • User profile image
    JChung2006

    Is your editor pointed to the right XSD?  Visual Studio points to XHTML 1.0 Transitional, not XHTML 1.1, by default.  You can check this setting in the HTML Source Editing toolbar.

  • User profile image
    JChung2006

    How do you see those XHTML XSD's being right?  In the versions I have, both xhtml_transitional.xsd and xhtml_strict-11.xsd reference a "buttonContentElements" xsd:group that doesn't exist in either file but does exist in the html_401.xsd.

    Changing the mode to HTML 4.01 allows for nested IMG's inside BUTTON elements.

  • User profile image
    W3bbo

    JChung2006 wrote:
    Is your editor pointed to the right XSD?  Visual Studio points to XHTML 1.0 Transitional, not XHTML 1.1, by default.  You can check this setting in the HTML Source Editing toolbar.


    In the Validation selector in the main window I have XHTML1.1 selected.

    JChung2006 wrote:
    

    How do you see those XHTML XSD's being right?  In the versions I have, both xhtml_transitional.xsd and xhtml_strict-11.xsd reference a "buttonContentElements" xsd:group that doesn't exist in either file but does exist in the html_401.xsd.

    This is my xhtml_strict-11.xsd.

    For some reason I have a faint idea that I modified this XSD about a year ago. But it's fuzzy.

    EDIT: I see you're right about the buttonContentElements thing.

    Still, you'll notice the button definition there has the type="" attribute. VS dislikes this for some reason:

    <button type="submit"> <img src="foo.png" alt="" /> Hello</button>

    JChung2006 wrote:
    Changing the mode to HTML 4.01 allows for nested IMG's inside BUTTON elements.

    A compromise.

  • User profile image
    JChung2006

    I didn't mean to suggest changing to HTML 4.01.  What I meant was that the HTML 4.01 XSD has the "buttonContentElements" group defined, and the validation case (IMG inside BUTTON) works there properly.  Both XHTML 1.0 Transitional and XHTML 1.1 XSD's reference the same "buttonContentElements" group, but neither has it defined. Your version of the XHTML 1.1 XSD is also missing the "buttonContentElements" group definition.

    I don't know why Microsoft would bother fiddling with the XHTML XSD when they could just use the one defined by the W3C. Maybe there are some characteristics about the way rules are specified in the original schema that makes it harder to validate quickly and efficiently. That being said, they shouldn't break the schema and get it wrong either.Rule #1 of optimiziation: it still has to work after you have optimized it.

  • User profile image
    W3bbo

    JChung2006 wrote:
    I don't know why Microsoft would bother fiddling with the XHTML XSD when they could just use the one defined by the W3C. Maybe there are some characteristics about the way rules are specified in the original schema that makes it harder to validate quickly and efficiently. That being said, they shouldn't break the schema and get it wrong either.


    In MS's schema there are some VS-specific extensions. Look for attributes beginning with vs:

  • User profile image
    Rossj

    JChung2006 wrote:
     Both XHTML 1.0 Transitional and XHTML 1.1 XSD's reference the same "buttonContentElements" group, but neither has it defined. Your version of the XHTML 1.1 XSD is also missing the "buttonContentElements" group definition.

    Is it in one of the includes?

    <xsd:include schemaLocation="CommonHTMLTypes.xsd" />
    <xsd:include schemaLocation="I18Languages.xsd" />

  • User profile image
    JChung2006

    CommonHTMLTypes.xsd is a bunch of enumerations, ranges, and attribute groups for HTML server-side controls.  I18Languages.xsd is culture codes for internationalization.  It turns out that the missing group is in xhtml_frameset.xsd (why?) but not in xhtml-strict_11.xsd or xhtml_transitional.xsd.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.