Validating an XForms document

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Will

    #1

    Validating an XForms document

    I have been having problems validating an XForms document against the
    XForms schema located at
    http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd.

    I have reduced the XForm to its bare bones as follows:

    <?xml version="1.0" encoding="iso-8859-1"?>
    <xf:model xmlns:xf="http://www.w3.org/2002/xforms">
    <xf:instance xmlns=""/>
    </xf:model>

    However, it still does not validate according to any of:

    1) http://www.gotdotnet.com/services/xsdvalidator/
    2) http://tools.decisionsoft.com/schemaValidate.html
    3) msxml 4.0 sp2

    I get errors relating to "model" and "instance" not being declared in
    the schema.

    Can anyone shed any light on this.

    Regards

    WH
  • Martin Honnen

    #2
    Re: Validating an XForms document



    Will wrote:
    [color=blue]
    > I have been having problems validating an XForms document against the
    > XForms schema located at
    > http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd.
    >
    > I have reduced the XForm to its bare bones as follows:
    >
    > <?xml version="1.0" encoding="iso-8859-1"?>
    > <xf:model xmlns:xf="http://www.w3.org/2002/xforms">
    > <xf:instance xmlns=""/>
    > </xf:model>
    >
    > However, it still does not validate according to any of:
    >
    > 1) http://www.gotdotnet.com/services/xsdvalidator/
    > 2) http://tools.decisionsoft.com/schemaValidate.html
    > 3) msxml 4.0 sp2[/color]

    I have tried validating your simple document against the schema you have
    listed above with MSXML 4 with the following JScript program

    var schemaCache = new ActiveXObject(' Msxml2.XMLSchem aCache.4.0');
    schemaCache.add ('http://www.w3.org/2002/xforms',
    'http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd');

    var xmlDocument = new ActiveXObject(' Msxml2.DOMDocum ent.4.0');
    xmlDocument.asy nc = false;
    xmlDocument.sch emas = schemaCache;

    var loaded = xmlDocument.loa d('test20040812 04.xml');
    if (!loaded) {
    alert(xmlDocume nt.parseError.r eason + '\r\n' +
    xmlDocument.par seError.line + '\r\n' +
    xmlDocument.par seError.srcText );
    }
    else {
    alert("valid");
    }

    and I already get an error when the schema is processed, the error
    happens when the included schema for XML schema
    http://www.w3.org/2001/XMLSchema.xsd
    is processed so it doesn't look like MSXML 4 is able to help you with
    validation here.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Martin Honnen

      #3
      Re: Validating an XForms document



      Will wrote:
      [color=blue]
      > I have been having problems validating an XForms document against the
      > XForms schema located at
      > http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd.
      >
      > I have reduced the XForm to its bare bones as follows:
      >
      > <?xml version="1.0" encoding="iso-8859-1"?>
      > <xf:model xmlns:xf="http://www.w3.org/2002/xforms">
      > <xf:instance xmlns=""/>
      > </xf:model>
      >
      > However, it still does not validate according to any of:
      >
      > 1) http://www.gotdotnet.com/services/xsdvalidator/
      > 2) http://tools.decisionsoft.com/schemaValidate.html
      > 3) msxml 4.0 sp2
      >
      > I get errors relating to "model" and "instance" not being declared in
      > the schema.
      >
      > Can anyone shed any light on this.[/color]

      Trying jEdit on your file by adding the schemaLocation attribute e.g.

      <?xml version="1.0" encoding="iso-8859-1"?>
      <xf:model
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocat ion="http://www.w3.org/2002/xforms
      http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd">
      <xf:instance xmlns=""/>
      </xf:model>

      I do not get any validation errors, jEdit uses Xerces-J from
      http://xml.apache.org/.


      --

      Martin Honnen
      http://JavaScript.FAQTs.com/

      Comment

      Working...