XML File loads existing data source - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » XML File loads existing data source XML File loads existing data source Last post 08-04-2005 10:10 PM by Patrick Halstead. 9 replies. Page 1 of 1 (10 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 08-01-2005 05:08 PM Richard Joined on 06-16-2005 Posts 51 XML File loads existing data source Reply Contact I have made a form from an existing schema file my.xsd,At run time, I want to open an xml file my.xml , validate it against the schema file my.xsd, and once validated , have it populate the data sources in the main DOM.I can not use the my.xml to create a dataconnection as this tries to create a xsd file which will not be the one I want. and secondly , it may not have all the possible fields. 08-02-2005 12:06 AM In reply to Patrick Halstead Joined on 08-07-2006 Posts 5,112 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact Hi Richard,Can you use a main data source for your my.xsd and a secondary data source for the other data connections?Patrick Halstead [InfoPath MVP]InfoPathDev Patrick HalsteadProject Manager at Qdabra 08-02-2005 09:37 AM In reply to Richard Joined on 06-16-2005 Posts 51 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact No.Each time the data from the xml file could be different , and it may not include some fields , so if I build a dataconnection with a sample file, that schema will not fit other files. 08-02-2005 09:44 AM In reply to Patrick Halstead Joined on 08-07-2006 Posts 5,112 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact Well, you could use a generic XSD in your ImportFiles and use the merge forms functionality to import the data. You'll want something like this:<?xml version="1.0" encoding="UTF-8" standalone="no"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-08-02T09:10"><xsd:element name="root"> <xsd:complexType> <xsd:sequence> <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/> </xsd:sequence> <xsd:anyAttribute processContents="skip" /> </xsd:complexType></xsd:element></xsd:schema>You'll have to have a similar node in your main schema and do custom import, but it should be doable.Patrick Halstead [InfoPath MVP]InfoPathDev Patrick HalsteadProject Manager at Qdabra 08-03-2005 03:47 PM In reply to Richard Joined on 06-16-2005 Posts 51 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact I have a known schema my.xsd , so, I have 2 options:1- design a form using schema my.xsd as the main form. Upon importFile anytime the file matches the schema of my.xsd , the form will update with data. However, I learned from the SDK that the merge occurs only for the repeating items.. So , this will not work for standard import, Does Custom import work without having to create xsl ? after all, I have the view.xsl designed already based on my.xsd .2- build a main form with the schema as you suggested., do a custom import and in the manifest specify the my.xsd as the schema , and a designed my.xsl to transform it to the main.If all above is right , then I have this question:Why is it that you can specify schema for the main ( design from given schema ) but not for the secondary dataconnection.??? 08-03-2005 06:10 PM In reply to Patrick Halstead Joined on 08-07-2006 Posts 5,112 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact 1. Merge works fine for other things (not just repeating) if you do custom import which will require creating your own import.xsl. This xsl is different from the view xsl. This import.xsl is used to transform the incoming xml document into your main DOM or wherever you choose to store it.2. Yes, this is what I am suggesting. Sorry... I guess my answer above overlaps...Re: your question -Because it's tied to the data source. For the 2DS (secondary data connection) that is tied to another XML file, you can specify your own XSD.Patrick Halstead [InfoPath MVP]InfoPathDev Patrick HalsteadProject Manager at Qdabra 08-03-2005 07:18 PM In reply to Richard Joined on 06-16-2005 Posts 51 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact Re: your question ->> For the 2DS (secondary data connection) that is tied to another XML file, you can specify your own XSD.It still does not make sense, why is it not possible to have infopath create a second datasource ( not in the main DOM) using a specified schema, this comes handy if you do not want to mix the 2 DOMs and you do not have a sample xml file for the second xsd. 08-03-2005 11:25 PM In reply to Patrick Halstead Joined on 08-07-2006 Posts 5,112 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact Hi Richard,Sorry for the confusion, but I believe you can do this manually. Need to check, but my guess is the wizard doesn't support it. However, you can extract the form files, and manually modify the xsf to include xsd for your 2DS xml file.Patrick Halstead [InfoPath MVP]InfoPathDev Patrick HalsteadProject Manager at Qdabra 08-04-2005 11:12 AM In reply to Richard Joined on 06-16-2005 Posts 51 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact Hi Patrick,Thanks for checking this, in the mean time, let me tell you what I am trying to do , perhaps you have a better suggestion..I have web service sending me document files that I want to edit in infopath and send it back .The documents are based on a published schema file.1- If I try to have the webservice return the file as xmldoc, then infopath tries to create the schema for it at design time. so if at run time , the document has fields other than the initial sample we run into error and the document can not be edited.2- If I try to have the webservice return the file as text, then , what needs to happen is to save it locally , call importFile, use a xsl file, and do the custom import, this assumes that I have created a form with the original schema, this should work, provided that I have created the main DOM using the specified schema. the trouble here is that I have to mix form's data together with this schema. that was the basis for my previous question .3- I could try to generate a class from the schema and send the object from web service. I am not sure how infopath treats this as dataconnection ? or do I have anything to gain this way . 08-04-2005 10:10 PM In reply to Patrick Halstead Joined on 08-07-2006 Posts 5,112 Re: XML File loads existing data source Mark as Not AnswerMark as Answer... Reply Contact Hi Richard,#1 seems like the sensible approach. I don't understand why you are having problems with the schema. Is the web service morphing? If it changes, you realize that you'll have binding problems. #2 provides a nice abstraction if the schema in your WS keeps changing, and in general is a good practice. I don't understand why #2 is so hard. It should be doable. You could do #1 but use a 2DS instead of your main data source but you'd have to write a lot of code and this isn't exactly a best practice since you are sidestepping InfoPath's main data source and with it, a ton of features. #3 would work.. this is the most custom option. It's just code. My suggestion would be to do something between 2 and 3. :)Patrick Halstead [InfoPath MVP]InfoPathDev Patrick HalsteadProject Manager at Qdabra Page 1 of 1 (10 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.