InfoPath keeps breaking mySchema.xsd - InfoPath Dev
in

InfoPath Dev

InfoPath keeps breaking mySchema.xsd

Last post 11-17-2005 03:55 PM by franck. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-16-2005 10:19 PM

    • adamw
    • Not Ranked
    • Joined on 11-14-2005
    • Posts 12

    InfoPath keeps breaking mySchema.xsd

    Hi

    I'm having a problem where InfoPath kills my working schema mySchema.xsd. I have the following:

    <xsd:element name="list">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="my:list-item" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute name="is-condition-list" type="xsd:string"/>
    <xsd:attribute name="type" type="xsd:string"/>
    </xsd:complexType>
    </xsd:element>

    I can easily populate these "lists" attributes easily in code like this:

    Dim newListNode As IXMLDOMNode = sectionsNode.ownerDocument.createNode(DOMNodeType.NODE_ELEMENT, "my:list", myNameSpace)
    Dim listType As IXMLDOMAttribute = sectionsNode.ownerDocument.createAttribute("my:type")
    Dim isConditionList As IXMLDOMAttribute = sectionsNode.ownerDocument.createAttribute("my:is-condition-list")
    listType.text = theDeterm.sections(i).list.type
    isConditionList.text = theDeterm.sections(i).list.isconditionlist
    newListNode.attributes.setNamedItem(listType)
    newListNode.attributes.setNamedItem(isConditionList)

    Problem is, whenever I save my form Infopath goes and changes my schema to

    <xsd:element name="list">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="my:list-item" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute ref="my:is-condition-list"/>
    <xsd:attribute ref="my:type"/>
    </xsd:complexType>
    </xsd:element>

    Note the attribute ref's.

    I'm not too fussed about that except it breaks my code. Everytime I try to create the attribute and attach it to the node in Managed code (as per above), InfoPath says the attribute doesnt belong.

    This is an example (on another schema element).. and Yep I've checked that it exists and is fine.. it works fine before infopath molests it and changes it to ref=

    System.Runtime.InteropServices.COMException
    The attribute 'heading' on the element 'http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-10-31T06-47-55}section' is not defined in the DTD/Schema.

    at Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode.appendChild(IXMLDOMNode newChild)
    at Microsoft.Office.Interop.InfoPath.SemiTrust.DOMNodeWrapper.appendChild(IXMLDOMNode newChild)
    at Microsoft.Office.Interop.InfoPath.SemiTrust.DOMNodeWrapper.appendChild(IXMLDOMNode newChild)
    at PlanningDeterminationClient.PlanningDeterminationClient.populateDetermination(PlanningApplicationType thePlanningApp, DeterminationType theDeterm) in C:\Projects\Visual Studio Projects\PlanningDeterminationClient\PlanningDeterminationClient\FormCode.vb:line 294
    at PlanningDeterminationClient.PlanningDeterminationClient.btnRetrieve_OnClick(DocActionEvent e) in C:\Projects\Visual Studio Projects\PlanningDeterminationClient\PlanningDeterminationClient\FormCode.vb:line 185
    at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
  • 11-16-2005 11:07 PM In reply to

    Re: InfoPath keeps breaking mySchema.xsd

    Hi Adam,

    you could try 2 things:
    1. Work with your attributes as if they were nodes, not attributes (if you built your schema using InfoPath).
    2. Keep you code but create your schema with XMLSpy.

    Tell me if it helps.



    Regards,

    Franck Dauché
    InfoPathDev
  • 11-17-2005 03:21 PM In reply to

    • adamw
    • Not Ranked
    • Joined on 11-14-2005
    • Posts 12

    Re: InfoPath keeps breaking mySchema.xsd

    quote:
    Originally posted by franck

    Hi Adam,

    you could try 2 things:
    1. Work with your attributes as if they were nodes, not attributes (if you built your schema using InfoPath).



    I'll try this one. Thanks.

    quote:

    2. Keep you code but create your schema with XMLSpy.



    This is what I've been doing this far but it just breaks everytime I save my Infopath form as Infopath goes and molests the schema and overwrites it. :(

    Adam


    Regards,

    Franck Dauché
    InfoPathDev
  • 11-17-2005 03:55 PM In reply to

    Re: InfoPath keeps breaking mySchema.xsd

    Adam,

    Did you try with a schema built in IP? IP won't overwrite that for sure.
    If you are using XMLSpy an IP is overwriting things, you have a prefix/Namespace issue.

    Regards,

    Franck Dauché
    InfoPathDev
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.