<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: How to read XML file and pass to JS object</title>
		<atom:link href="http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 21:39:56 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-55338</guid>
					<title><![CDATA[How to read XML file and pass to JS object]]></title>
					<link>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-55338</link>
					<pubDate>Tue, 05 Jun 2012 14:54:26 +0000</pubDate>
					<dc:creator>dusx</dc:creator>

					<description>
						<![CDATA[
						<p>I am rather new to Max and have been pretty successful so far, however I am now trying to branch out a bit.</p>
<p>What I am trying to do is:<br />
-Read a XML file (currently I am using the &#8216;text&#8217; object)<br />
-Pass the files contents as a string to a &#8216;js&#8217; object (I have been trying messages and using &#8216;prepend&#8217; to add a function to the beginning..)<br />
note: the bang message is received and works</p>
<p>my JS test script:<br />
===================================</p>
<p>autowatch = 1; // allow Max to watch for changes.</p>
<p>inlets = 1;<br />
outlets = 1;</p>
<p>function bang(){<br />
post(&#8220;JS is working n&#8221;); // includes new line char<br />
}</p>
<p>function msg_string(stringArg){<br />
post(&#8220;your string&#8221; + stringArg);<br />
post(); // create new line<br />
}</p>
<p>===================================</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199164</guid>
					<title><![CDATA[Re: How to read XML file and pass to JS object]]></title>
					<link>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199164</link>
					<pubDate>Tue, 05 Jun 2012 16:56:02 +0000</pubDate>
					<dc:creator>Siska Ádám</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>unless you have some explicit reason to process the XML file in JS, you could use the XML processing tools which I created for Max. The <code>[sadam.dom]</code> and <code>[sadam.sax]</code> objects work with MXJ and they implement a complete W3C-compliant DOM and SAX parser. There&#8217;s also a native object called <code>[sadam.rapidXML]</code> which is not 100% W3C-compliant (mainly because it ignores DOCTYPE declarations), but is very fast. They are part of my library which you can get for free from <a href="http://www.sadam.hu/software" rel="nofollow">http://www.sadam.hu/software</a> .</p>
<p>Hope this helps,<br />
Ádám</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199165</guid>
					<title><![CDATA[Re: How to read XML file and pass to JS object]]></title>
					<link>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199165</link>
					<pubDate>Tue, 05 Jun 2012 18:44:04 +0000</pubDate>
					<dc:creator>dusx</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks, Adam<br />
I have infact looked at your tools, and they seem to be very good.<br />
The one thing that turned me away was the non-commercial license. Although I am very far away from a commercial product (just starting) that is my goal, therefore I do not want to build upon a component that is not available for this purpose.<br />
Do you offer a commercial version?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199166</guid>
					<title><![CDATA[Re: How to read XML file and pass to JS object]]></title>
					<link>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199166</link>
					<pubDate>Thu, 07 Jun 2012 10:12:15 +0000</pubDate>
					<dc:creator>Siska Ádám</dc:creator>

					<description>
						<![CDATA[
						<p>Hi dusx,</p>
<p>I&#8217;ve sent you a message regarding the possibilities of a commercial version.</p>
<p>Best,<br />
Ádám</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199167</guid>
					<title><![CDATA[Re: How to read XML file and pass to JS object]]></title>
					<link>http://cycling74.com/forums/topic/how-to-read-xml-file-and-pass-to-js-object/#post-199167</link>
					<pubDate>Fri, 14 Dec 2012 06:57:21 +0000</pubDate>
					<dc:creator>tkzic</dc:creator>

					<description>
						<![CDATA[
						<p>Hi dusx,</p>
<p>Have been trying to do the same thing with the [js] object. Tried several libraries with no luck, but did find a workaround:</p>
<p>1. Use aka.shell to convert the xml file to a JSON file using this python script: <a href="https://github.com/hay/xml2json" rel="nofollow">https://github.com/hay/xml2json</a> &#8211; (note you&#8217;ll need to change the json &#8216;import&#8217; statement to: import json as simplejson, optparse, sys, os) and the actual command line syntax is: xml2json.py -t xml2json file.xml > file.json.  Or you can use any other command line xml to json converter.</p>
<p>2. Then read in the JSON file with the [js] object using the patch from Peter Nyoeber (near the bottom of the following post):</p>
<p><a href="http://cycling74.com/forums/topic.php?id=33601" rel="nofollow">http://cycling74.com/forums/topic.php?id=33601</a></p>
<p>You can then access all the data using JSON format inside the [js] object, which is about a thousand times easier than parsing xml anyway.</p>
<p>Note: If you&#8217;re using http: requests to get xml data via [jit.uldl] &#8211; you can write it out to an xml file using [jit.textfile]. See the CNMAT weather report example. Or let me know and I can post an example.</p>
<p>Hope this helps.</p>
<p>tz</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

