O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Data Binding with XML

I'll start by converting ch08_01.html to XML. In ch08_01.html, I had to use the ID attribute of <SPAN> elements to name the fields in a record; in XML, I can simply create a new element. Here's what ch08_01.html looks like in XML format, ch08_03.xml:

Listing . ch08_03.xml
 <?xml version="1.0"?> <CUSTOMERS> <CUSTOMER> <NAME>Charles</NAME> <CUSTOMER_ID>58704</CUSTOMER_ID> <PURCHASE_DATE>10/15/2003</PURCHASE_DATE> <DEPARTMENT>Meat</DEPARTMENT> <PRODUCT_NAME>Ham</PRODUCT_NAME> </CUSTOMER> <CUSTOMER> <NAME>Franklin</NAME> <CUSTOMER_ID>58705</CUSTOMER_ID> <PURCHASE_DATE>10/15/2003</PURCHASE_DATE> <DEPARTMENT>Produce</DEPARTMENT> <PRODUCT_NAME>Tomatoes</PRODUCT_NAME> </CUSTOMER> <CUSTOMER> <NAME>Phoebe</NAME> <CUSTOMER_ID>58706</CUSTOMER_ID> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required