06.01.2013 Views

Learning Processing: A Beginner's Guide to Programming Images ...

Learning Processing: A Beginner's Guide to Programming Images ...

Learning Processing: A Beginner's Guide to Programming Images ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

� student �<br />

� id � 002 � /id �<br />

� name � Zoog � /name �<br />

� phone � 555-555-5555 � /phone �<br />

� email � zoog@planetzoron.uni � /email �<br />

� address �<br />

� street � 45.3 Nebula 5 � /street �<br />

� city � Boolean City � /city �<br />

� state � Booles � /state �<br />

� zip � 12358 � /zip �<br />

� /address �<br />

� /student �<br />

� /students �<br />

Data Input 345<br />

Note the similarities <strong>to</strong> object-oriented programming. We could think of the XML tree in the following<br />

terms. Th e XML document represents an array of student objects. Each student object has multiple pieces<br />

of information, an id, a name, a phone number, an e-mail address, and a mailing address. Th e mailing<br />

address is also an object that also has multiple pieces of data, such as street, city, state, and zip.<br />

Exercise 18-11: Revisit the “ Bubble ” Example 18-3. Design an XML tree structure for<br />

Bubble objects. Diagram the tree and write out the XML source. (Use the empty diagram<br />

and fi ll in the blanks below.)<br />

� ?xml version = "1.0"? �<br />

� ________ �<br />

� bubble �<br />

� ________ � 40 � /________ �<br />

� ________ � 100 � /________ �<br />

� ________ � 255 � /green �<br />

�________ �<br />

� /bubbles �<br />

Returning <strong>to</strong> the weather example, we can now make some sense of Yahoo’s XML data with the tree<br />

structure terms of a tree. Here is the raw XML source. (Note I have edited it for simplifi cation purposes.)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!