Form preview issue | lang attribute on Root node? - InfoPath Dev
in

InfoPath Dev

Form preview issue | lang attribute on Root node?

Last post 09-28-2006 04:29 AM by TRashid. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-26-2006 05:23 AM

    Form preview issue | lang attribute on Root node?

    I'm keep getting the following error when i try to preview my infopath form

    InfoPath cannot open the selected form because of an error in the form's code.
    The attribute 'http://www.w3.org/XML/1998/namespace}lang' on the element 'http://namespace}InfoPathRoot' is not defined in the DTD/Schema.


    InfoPathRoot is the root element of the schema.

    To avoid this issue, i added the "anyAttribute" to my schema definition

    <xs:anyAttribute namespace="http://www.w3.org/XML/1998/namespace" processContents="skip"/>

    I was hoping that with anyAttribute and processContents=skip, the infopath form would not attempt to find
    or validate the lang attribute in the InfoPathRoot element. However, once i've added this, i get the following error

    InfoPath cannot open the selected form because of an error in the form's code.
    A floating attribute may not be passed as the context node for an XSLT transform or an XPath query.


    The form has managed code attached to it(C# , Visual Studio 2005 and Infopath 2003)

    An interesting observation is that if the same schema is imported into an infopath form that does not have any code behind it, then the first (lang) error does not occur and the form can be previewed successfully

    Is there something that i'm missing?

    I thank you in advance

    -Tanveer Rashid
  • 09-26-2006 11:56 AM In reply to

    Re: Form preview issue | lang attribute on Root node?

    The second error you are seeing seems to be coming from the view, or XSL file. When you said that you imported the same schema to a form without code in it, did you mean that you also recreated the view as this is where the error seems to be coming from.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-28-2006 03:31 AM In reply to

    Re: Form preview issue | lang attribute on Root node?

    No, I didn't make any changes to the view. Just selected the same schema after clicking "Design form from a Xml Document and/or schema" and then previewed the form after completing the wizard.

    Any ideas?

    I've faced this problem even with a simple schema such as the one below.

    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://namespace" elementFormDefault="qualified" targetNamespace="http://namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Root">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Child1">
    <xs:complexType />
    </xs:element>
    <xs:element name="Child2">
    <xs:complexType />
    </xs:element>
    </xs:sequence>
    <xs:anyAttribute namespace="http://www.w3.org/XML/1998/namespace" processContents="lax" />
    </xs:complexType>
    </xs:element>
    </xs:schema>

    I still run into the second issue when previewing a form that uses the schema above. Can someone check if they face the same problem? Just create a new infopath project in VS2005 and then once the form is opened, use Convert Main Data source to point to the schema above.

    Once the schema has been imported, rebuild the project and click on preview.

    -Tanveer Rashid
  • 09-28-2006 04:29 AM In reply to

    Re: Form preview issue | lang attribute on Root node?

    I've just verified that this issue did not occur on another machine.

    The difference between the two machines? -

    - The machine that it works on has only InfoPath 2003 SP1
    installed + infopath toolkit + VS 2005

    - The machine that it does not work on (i.e. it gives the problem as described above) has InfoPath 2007 beta installed in addition to the infopath 2003 SP2 installation + infopath toolkit + VS 2005


    -Tanveer Rashid
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.