Generate XML file as Data Source via C# - InfoPath Dev
in

InfoPath Dev

Generate XML file as Data Source via C#

Last post 03-12-2009 07:01 AM by BNO2006. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-12-2009 06:01 AM

    • BNO2006
    • Not Ranked
      Male
    • Joined on 03-12-2009
    • Germany
    • Posts 2

    Generate XML file as Data Source via C#

    Hello, I am pretty new to InfoPath development and I am currently trying to export data form an .Net Application written in C# to use it as Data Source in InfoPath.

    The generated XML file looks like this:

    <?xml version="1.0"?>
    <XMLRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <XMLArray>
    <XMLObject xsi:type="Entry">
    <ID>1132</ID>
    <Name>Hans</Name>
    </XMLObject>
    </XMLArrray>
    </XMLRoot>

    When trying to add this file as Data Connection (Resource File) I get an "Unknown error".
    My guess iis that InfoPath cannot handle the schema, but I was not able to find any
    definition how these xml files have to look like.

    It would be great if someone could help me solve this issue.

    Kind regards
    Filed under: , , , ,
  • 03-12-2009 06:34 AM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 525

    Re: Generate XML file as Data Source via C#

    Hi,

    I think the easiest way to get started is to create a list in Excel and then save it as XML.

    Then open the XML file in Notepad and you can see a basic structure.

    Here is one example for Xml format.

    <?xml version="1.0" encoding="UTF-8"?>
    <Vehicles>
        <Year value="1963">
            <Make value="Chevrolet">
                <Model value="Corvette"/>
                <Model value="Nova"/>
            </Make>
            <Make value="Porsche">
                <Model value="356"/>
                <Model value="Carrera"/>
            </Make>
        </Year>
        <Year value="1973">
            <Make value="Ford">
                <Model value="Bronco"/>
                <Model value="Mustang"/>
                <Model value="Pinto"/>
            </Make>
            <Make value="Toyota">
                <Model value="Celica"/>
                <Model value="Land Cruiser"/>
            </Make>
        </Year>
    </Vehicles>

     

    Anuma Chinthapalli /
    http://www.GGKTech.com
  • 03-12-2009 07:01 AM In reply to

    • BNO2006
    • Not Ranked
      Male
    • Joined on 03-12-2009
    • Germany
    • Posts 2

    Re: Generate XML file as Data Source via C#

    Thanks for the quick reply.

    Based on the XML code you posted I just removed the schema descriptions and he xsi:type part and now it works.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.