Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 18th, 2006, 12:00 PM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default connecting to XML document with Perl script

Can anyone point me in the right direction or throw up an example of a way to connect to a XML document from a Perl script?

I am running Perl 5.8.8 (i think) on a Windows XP Pro machine.

My XML document is shown below. It is just a sample document, is there anything I need to install? Any help appreciated.

Picco

Code:
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="nutrition.css"?>
<nutrition>

<daily-values>
    <total-fat units="g">65</total-fat>
    <saturated-fat units="g">20</saturated-fat>
    <cholesterol units="mg">300</cholesterol>
    <sodium units="mg">2400</sodium>
    <carb units="g">300</carb>
    <fiber units="g">25</fiber>
    <protein units="g">50</protein>
</daily-values>

<food>
    <name>Avocado Dip</name>
    <mfr>Sunnydale</mfr>
    <serving units="g">29</serving>
    <calories total="110" fat="100"/>
    <total-fat>11</total-fat>
    <saturated-fat>3</saturated-fat>
    <cholesterol>5</cholesterol>
    <sodium>210</sodium>
    <carb>2</carb>
    <fiber>0</fiber>
    <protein>1</protein>
    <vitamins>
        <a>0</a>
        <c>0</c>
    </vitamins>
    <minerals>
        <ca>0</ca>
        <fe>0</fe>
    </minerals>
</food>

<food>
    <name>Bagels, New York Style </name>
    <mfr>Thompson</mfr>
    <serving units="g">104</serving>
    <calories total="300" fat="35"/>
    <total-fat>4</total-fat>
    <saturated-fat>1</saturated-fat>
    <cholesterol>0</cholesterol>
    <sodium>510</sodium>
    <carb>54</carb>
    <fiber>3</fiber>
    <protein>11</protein>
    <vitamins>
        <a>0</a>
        <c>0</c>
    </vitamins>
    <minerals>
        <ca>8</ca>
        <fe>20</fe>
    </minerals>
</food>

<food>
    <name>Beef Frankfurter, Quarter Pound </name>
    <mfr>Armitage</mfr>
    <serving units="g">115</serving>
    <calories total="370" fat="290"/>
    <total-fat>32</total-fat>
    <saturated-fat>15</saturated-fat>
    <cholesterol>65</cholesterol>
    <sodium>1100</sodium>
    <carb>8</carb>
    <fiber>0</fiber>
    <protein>13</protein>
    <vitamins>
        <a>0</a>
        <c>2</c>
    </vitamins>
    <minerals>
        <ca>1</ca>
        <fe>6</fe>
    </minerals>
</food>

<food>
    <name>Chicken Pot Pie</name>
    <mfr>Lakeson</mfr>
    <serving units="g">198</serving>
    <calories total="410" fat="200"/>
    <total-fat>22</total-fat>
    <saturated-fat>9</saturated-fat>
    <cholesterol>25</cholesterol>
    <sodium>810</sodium>
    <carb>42</carb>
    <fiber>2</fiber>
    <protein>10</protein>
    <vitamins>
        <a>20</a>
        <c>2</c>
    </vitamins>
    <minerals>
        <ca>2</ca>
        <fe>10</fe>
    </minerals>
</food>

<food>
    <name>Cole Slaw</name>
    <mfr>Fresh Quick</mfr>
    <serving units=" cup">1.5</serving>
    <calories total="20" fat="0"/>
    <total-fat>0</total-fat>
    <saturated-fat>0</saturated-fat>
    <cholesterol>0</cholesterol>
    <sodium>15</sodium>
    <carb>5</carb>
    <fiber>2</fiber>
    <protein>1</protein>
    <vitamins>
        <a>30</a>
        <c>45</c>
    </vitamins>
    <minerals>
        <ca>4</ca>
        <fe>2</fe>
    </minerals>
</food>

<food>
    <name>Eggs</name>
    <mfr>Goodpath</mfr>
    <serving units="g">50</serving>
    <calories total="70" fat="40"/>
    <total-fat>4.5</total-fat>
    <saturated-fat>1.5</saturated-fat>
    <cholesterol>215</cholesterol>
    <sodium>65</sodium>
    <carb>1</carb>
    <fiber>0</fiber>
    <protein>6</protein>
    <vitamins>
        <a>6</a>
        <c>0</c>
    </vitamins>
    <minerals>
        <ca>2</ca>
        <fe>4</fe>
    </minerals>
</food>

<food>
    <name>Hazelnut Spread</name>
    <mfr>Ferreira</mfr>
    <serving units="tbsp">2</serving>
    <calories total="200" fat="90"/>
    <total-fat>10</total-fat>
    <saturated-fat>2</saturated-fat>
    <cholesterol>0</cholesterol>
    <sodium>20</sodium>
    <carb>23</carb>
    <fiber>2</fiber>
    <protein>3</protein>
    <vitamins>
        <a>0</a>
        <c>0</c>
    </vitamins>
    <minerals>
        <ca>6</ca>
        <fe>4</fe>
    </minerals>
</food>

<food>
    <name>Potato Chips</name>
    <mfr>Lees</mfr>
    <serving units="g">28</serving>
    <calories total="150" fat="90"/>
    <total-fat>10</total-fat>
    <saturated-fat>3</saturated-fat>
    <cholesterol>0</cholesterol>
    <sodium>180</sodium>
    <carb>15</carb>
    <fiber>1</fiber>
    <protein>2</protein>
    <vitamins>
        <a>0</a>
        <c>10</c>
    </vitamins>
    <minerals>
        <ca>0</ca>
        <fe>0</fe>
    </minerals>
</food>

<food>
    <name>Soy Patties, Grilled</name>
    <mfr>Gardenproducts</mfr>
    <serving units="g">96</serving>
    <calories total="160" fat="45"/>
    <total-fat>5</total-fat>
    <saturated-fat>0</saturated-fat>
    <cholesterol>0</cholesterol>
    <sodium>420</sodium>
    <carb>10</carb>
    <fiber>4</fiber>
    <protein>9</protein>
    <vitamins>
        <a>0</a>
        <c>0</c>
    </vitamins>
    <minerals>
        <ca>0</ca>
        <fe>0</fe>
    </minerals>
</food>

<food>
    <name>Truffles, Dark Chocolate</name>
    <mfr>Lyndon's</mfr>
    <serving units="g">39</serving>
    <calories total="220" fat="170"/>
    <total-fat>19</total-fat>
    <saturated-fat>14</saturated-fat>
    <cholesterol>25</cholesterol>
    <sodium>10</sodium>
    <carb>16</carb>
    <fiber>1</fiber>
    <protein>1</protein>
    <vitamins>
        <a>0</a>
        <c>0</c>
    </vitamins>
    <minerals>
        <ca>0</ca>
        <fe>0</fe>
    </minerals>
</food>

</nutrition>

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
learning Perl and running script on WinXP Pro IIS crmpicco Perl 4 December 1st, 2006 12:53 PM
delete XML node in Perl crmpicco Perl 4 November 28th, 2006 12:12 PM
optimise it or speed up execution time perl script crmpicco Perl 2 November 22nd, 2006 08:31 AM
How to connecting java script form to xml file ashraf Javascript How-To 1 December 10th, 2004 05:47 AM
How to Perl script in Windows 2000 Pro? mittalpa Flash (all versions) 1 July 9th, 2003 03:12 AM



All times are GMT -4. The time now is 07:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.