Expand my Community achievements bar.

Creating an XML data connection

Avatar

Former Community Member
I'm trying to create a data connection to a XML file, but the dialog box for "New Data Connection..." has the options for "XML Schema" and "XML Data File" grayed out so that I can only choose "OLEDB Database" or "WSDL File." Can anyone tell me why, or what I need to do to fix that?



Background:

I've created a form that needs to import a few data values when opened in Acrobat. Right now, I can get the values by using the "Import data.." command and browsing for the XML file, but I do not want the end user having to browse for the data. I would like the data to import either 1) When the PDF opens or 2) when the user pushes a "import data" button.



I would greatly appreciate any input or suggestions!
4 Replies

Avatar

Former Community Member
typically they are greyed out if there is already a schema (XSD) connection or a sample data file in place. You cannot bind to more than one schema.



You will have to have th euser hit the import button to get it to import data...you cannot do an unattended operation for this. You can use the xfa.host.importData() command on th eclick event of the button.

Avatar

Former Community Member
I added a button and under the click event, I typed:



xfa.host.importData("DataPoints.xml");



DataPoints.xml is the file with the data I need to import. When I open the form in Acrobat and push the button, the Javascript debugger comes up with the following:



NotAllowedError: Security settings prevent access to this property or method.

Doc.importXFAData:-1:XFA:root_node[0]:Page1[0]:Button1[0]:click



When I look at my security settings, the "Changing the Document" setting and "Document Assembly" setting are set to Not Allowed, but I can't seem to change them. I already set the preference to No Security. Any suggestions?

Avatar

Former Community Member
You cannot automatically import the data unless you certify the form (security will not allow it), but if you leave the command as I had it, a dialog will come up and allow the user to choose the file they want to load.

Avatar

Former Community Member
Even if certification of trusted identity, file name can not be specified in importData operation. I have tested on certified document:

xfa.host.importData("data.xml");

and

xfa.host.importData("\c\\data.xml");



both of them opens the dialog box to select the data file.

Is there an another way?



Asiye