We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Processing & XML Files
Page Index Toggle Pages: 1
Processing & XML Files (Read 1166 times)
Processing & XML Files
Apr 19th, 2010, 1:37am
 
Hi,

I'm new to the forum and have a question about pulling in data from XML files.

I have a file set out like so:
Code:
<?xml version="1.0"?>
       <library>
           <book>
<id>3</id>
<title>Dragonflight</title>
<author>Anne McCaffery</author>
<genre>Fantasy Fiction</genre>
           </book>

           <book>
<id>4</id>
<title>The DaVinci Code</title>
<author>Dan Brown</author>
<genre>Fiction</genre>
           </book>
        </library>

But I can't get processing to integrate it. Partially the problem is that the help section of the site (which I use a lot) has things set out more like this:
Quote:
<book id="4">Book Title</book>


However that version won't work for what I want to do because I need a LOT more options and variables and eventually want to code a search. Can anyone give me some hints? It's the 'child' and 'parent' thing I'm having trouble with. How could I access the information of 'author' and 'genre' in my file?

Thanks,
Alanna.
Re: Processing & XML Files
Reply #1 - Apr 19th, 2010, 5:54am
 
Perhaps the sample code I give in XML database thread can help you to get started
Page Index Toggle Pages: 1