<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Importing Multiple xml files From a Folder Location in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18034#M16446</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the prompt reply but I cannot get this to work with xml files, do I need to parse these or some other technique to open this type of file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Apr 2016 10:02:56 GMT</pubDate>
    <dc:creator>d_barnett</dc:creator>
    <dc:date>2016-04-18T10:02:56Z</dc:date>
    <item>
      <title>Importing Multiple xml files From a Folder Location</title>
      <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18032#M16444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a folder containing lots of xml files that I would like to open, extract information from, save this new information separately ,&amp;nbsp; and then close both files. I can do this singularly using the 'Import xml' add-in but would like to go through a complete folder automatically to reduce the amount of effort and time I spend on doing this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached an example folder with xml files in to help if anyone has the time to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Apr 2016 08:38:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18032#M16444</guid>
      <dc:creator>d_barnett</dc:creator>
      <dc:date>2016-04-18T08:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Multiple xml files From a Folder Location</title>
      <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18033#M16445</link>
      <description>&lt;P&gt;You will need something like this, with 'Open()' instead of 'Print()' of course:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0px; font-size: 12px; line-height: normal; font-family: Courier; color: #942193;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dir = PickDirectory("Select the directory containing your files", "$DESKTOP");
fList = FilesInDirectory(dir);
for(i=1, i&amp;lt;=NItems(fList), i++,
Print(dir||"/"||fList[i]);

);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin: 0px; font-size: 12px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 14:51:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18033#M16445</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2019-12-11T14:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Multiple xml files From a Folder Location</title>
      <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18034#M16446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the prompt reply but I cannot get this to work with xml files, do I need to parse these or some other technique to open this type of file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Apr 2016 10:02:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18034#M16446</guid>
      <dc:creator>d_barnett</dc:creator>
      <dc:date>2016-04-18T10:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Multiple xml files From a Folder Location</title>
      <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18035#M16447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I thought the issue was the looping, not the reading in. Yes, you will need to parse the XML to pull out what you want once you have used 'LoadTextFile()' to put the contents into a JSL variable. 'ParseXML()' should help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Apr 2016 11:44:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18035#M16447</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2016-04-18T11:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Multiple xml files From a Folder Location</title>
      <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18036#M16448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Check out the XML addin &lt;/SPAN&gt;&lt;A class="jive-link-wiki-small" data-containerid="2042" data-containertype="14" data-objectid="7728" data-objecttype="102" href="https://community.jmp.com/docs/DOC-7728"&gt;https://community.jmp.com/docs/DOC-7728&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; This in combination with what &lt;/SPAN&gt;&lt;A href="https://community.jmp.com/people/Ian@JMP"&gt;Ian@JMP&lt;/A&gt;​ provided should get you going. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Stan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Apr 2016 12:08:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18036#M16448</guid>
      <dc:creator>stan_koprowski</dc:creator>
      <dc:date>2016-04-18T12:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Multiple xml files From a Folder Location</title>
      <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18037#M16449</link>
      <description>&lt;P&gt;This addin code is very well organized and all its power and functionality can be accessed by running one "master" function. Hence, here it is quite easy to circumvent the addin's GUI and let it work on your xml-files in a loop.&lt;/P&gt;
&lt;P&gt;Below is one way to combine the addin with Ian's loop. Note that you may need to set the path variable, i.e. the path to where the addin is installed on your computer. Also, if expanding this code, avoid using variable names that are already used by the included code from the addin, or you may run into problems (e.g. I could not use &lt;EM&gt;i&lt;/EM&gt; as a loop iterator).&lt;/P&gt;
&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; min-height: 13px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #008f00;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Define path variable (may already be defined)
Set Path Variable("ADDIN_HOME", "Path/to/my/Addins");

// Define all the functions of the Addin but skip the GUI
Include("$ADDIN_HOME/com.jmp.matthew.wolfe.xml.importer/xml parser III.jsl") &amp;lt;&amp;lt; close window;

dir = Pick Directory("Select the directory containing your files", "$DESKTOP");
fList = Files In Directory(dir);
myInfo = [];

For(filenr = 1, filenr &amp;lt;= N Items(fList), filenr++,
// Use Function from Addin to parse file into a data table
&amp;nbsp;&amp;nbsp;&amp;nbsp; dt = runParser(dir || "/" || fList[filenr]);
//Extract your information here! (e.g n rows of dt)
&amp;nbsp;&amp;nbsp;&amp;nbsp; myInfo |/= N Rows(dt);
//Close the data table
&amp;nbsp;&amp;nbsp;&amp;nbsp; Close(dt, no save);
);

// Did it work? Summarize in a new data table
New Table("my xml files",
&amp;nbsp;&amp;nbsp;&amp;nbsp; add rows(N Items(fList)),
&amp;nbsp;&amp;nbsp;&amp;nbsp; New Column("Sample", character, Values(fList)),
&amp;nbsp;&amp;nbsp;&amp;nbsp; New Column("n rows", numeric, values(myInfo))

);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV&gt;&lt;SPAN style="color: #011993;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 Dec 2019 14:50:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/18037#M16449</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2019-12-11T14:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Multiple xml files From a Folder Location</title>
      <link>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/238207#M47057</link>
      <description>&lt;P&gt;Just to update for anyone searching on this...&lt;BR /&gt;&lt;BR /&gt;This is now handled with ease in JMP 15 with the &lt;A href="https://www.jmp.com/support/help/en/15.0/#page/jmp/import-xml-and-json-files.shtml#" target="_blank"&gt;XML Import Wizard&lt;/A&gt; and &lt;A href="https://www.jmp.com/support/help/en/15.0/%23page/jmp/import-multiple-files.shtml" target="_blank"&gt;Import Multiple Files&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;You can use the Import Wizard on a single file to define the XML structure. Then copy the XML settings from the Source script and paste into the Settings in the Import Multiple Files dialog.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 14:58:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Importing-Multiple-xml-files-From-a-Folder-Location/m-p/238207#M47057</guid>
      <dc:creator>Phil_Kay</dc:creator>
      <dc:date>2019-12-11T14:58:27Z</dc:date>
    </item>
  </channel>
</rss>

