Note that there are some explanatory texts on larger screens.

plurals
  1. POScript to parse XML and download a file from certain URL then transfer it to another computer
    primarykey
    data
    text
    <p>Dear Stackoverflowers:</p> <p>I need your kind help to accomplish the following task: I need a master computer to be able to download a predefined XML file then parse it; with the available info, a script should identify the correct file to be downloaded from a web server periodically. Finally this file must be transfered to another computer without internet access in the same LAN and extract it to a given location. However I have bounds: I can't use PHP to accomplish this because and I can't install anything there; I've proposed to do this via MD5sums but a given day and hour must be given to be able to download the file to the master computer and another hour and day to transfer it to the slim terminal.</p> <p>I'll explain then ask. Thanks!</p> <p>I've designed this XML:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;updateXML id="subdirectory1"&gt; &lt;file&gt; &lt;tarname&gt;compressedFile.tar.gz&lt;/tarname&gt; &lt;name&gt;fileInsideName&lt;/name&gt; &lt;filExtension&gt;.ext&lt;/filExtension&gt; &lt;url protocol="http://"&gt;someurl.com/mainDirectory&lt;/url&gt; &lt;/file&gt; &lt;update&gt; &lt;download&gt;2012-02-02T03:00:00.00000&lt;/download&gt; &lt;copyTo terminal="1"&gt;2012-02-02T09:00:00.00000&lt;/copyTo&gt; &lt;/update&gt; &lt;/updateXML&gt; </code></pre> <p>And this working XML Schema (XSD)</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:element name="updateXML"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="file" minOccurs="1" maxOccurs="unbounded"&gt; &lt;xsd:complexType&gt; &lt;xsd:all&gt; &lt;xsd:element name="tarname" type="xsd:string"/&gt; &lt;xsd:element name="name" type="xsd:string"/&gt; &lt;xsd:element name="filExtension" type="xsd:string"/&gt; &lt;xsd:element name="url"&gt; &lt;xsd:complexType&gt; &lt;xsd:simpleContent&gt; &lt;xsd:extension base="xsd:string"&gt; &lt;xsd:attribute name="protocol" type="xsd:string" /&gt; &lt;/xsd:extension&gt; &lt;/xsd:simpleContent&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:all&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="update" minOccurs="1" maxOccurs="1"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="download" type="xsd:dateTime" /&gt; &lt;xsd:element name="copyTo"&gt; &lt;xsd:complexType&gt; &lt;xsd:simpleContent&gt; &lt;xsd:extension base="xsd:string"&gt; &lt;xsd:attribute name="terminal" type="xsd:int" /&gt; &lt;/xsd:extension&gt; &lt;/xsd:simpleContent&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;xsd:attribute name="id" type="xsd:string"/&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:schema&gt; </code></pre> <p>I've researched and I've found XMLlint can parse XML files. No problems here now:</p> <pre><code>$ xmllint --noout --schema updatemenus.xsd updatemenus.xml updatemenus.xml validates </code></pre> <p>I've thought in a process that can help me accomplish the given task. Please tell me if my proposed steps are correct:</p> <ol> <li>Generate the XML and validate it with it's XSD.</li> <li>Download it to the master computer and parse it there. Use the available info to construct a complete URL to download.</li> <li>Once downloaded secure copy it to the needed terminal in the LAN</li> <li>Check if a newer XML it's available and download it (a cron process?)</li> </ol> <p><strong>Do you think this is correct? If so, now that my XML it's valid, NOW WHAT??? ='/ How can I use it's info?? I'm new to XMLlint and to XPath. What can I do now???</strong></p> <p>Thanks a lot.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload