Namespaces are a pain. You can declare a "default' namespace, assigning it "http://www.w3.org/1999/xhtml". That will give you access to the nodes without a specific namespace. Then I guess you will need to use the "::" syntax for the specified namespcaces.
Google this there are several detailed discussions. Tracy Spratt, Lariat Services, development services available _____ From: [email protected] [mailto:[email protected]] On Behalf Of luketvanderfluit Sent: Thursday, January 21, 2010 10:04 PM To: [email protected] Subject: [SPAM] [flexcoders] How to parse xml with namespaces Hi. Here is a snippet of xml: It contains an element with a namespace (c:question) and several elements without a namespace. If I get the whole thing as an XML object, how do I go about accessing all the different fields. E.G. I need to access the c:question text or c:question subelements So: 1. c:question text: "This is a wine question" 2. c:question subelements: p.ul.li: "Penfolds Grange - no effect" or p: "A bottle shop in a remote country pub sells five different bottled wines. The publican increases the price of a bottle of Jacob's Creek core range by 50 cents." 3. question attribute format: "radio" Ive tried setting a namespace for c and a default namespace but cannot consistently access elements and values from both namespaces. Id love your help.. Thanks. Kr. Luke. ===================== <?xml version=\"1.0\" encoding=\"UTF-8\"?> <c:question xmlns=\"http://www.w3. <http://www.w3.org/1999/xhtml> org/1999/xhtml\" xmlns:c=\"http://www.eddygord <http://www.eddygordon.com/namespaces/course> on.com/namespaces/course\">This is a wine question <p>A bottle shop in a remote country pub sells five different bottled wines. The publican increases the price of a bottle of Jacob's Creek core range by 50 cents. </p> <p>Assuming that the prices of the other wines do not change, the Jacob's Creek price increase is likely to affect sales of the other products as follows: </p> <p> <ul> <li>Penfolds Grange - no effect; </li> <li>Wyndham Estate Bin Range - the Wyndham Estate products are slightly more expensive but the price increase has narrowed the gap so a slight increase can be expected; </li> <li>Lindemans Bin Range - large increase in sales as this is a direct competitor; </li> <li>Rosemount Split Label Range - large increase in sales as this is a direct competitor </li> </ul></p><p>Based on this information, which wines are in the same market as Jacob's Creek? </p> <question format=\"radio\" name=\"part1\"> <answer correct=\"true\">Lindemans Bin Range and Rosemount Split Label Range are definitely in the same market and Wyndham Estate may be. </answer> <answer>Penfolds Grange is the only wine in the same market. </answer> <answer>Lindemans Bin Range and Rosemount Split Label Range are the only wines in the same market. </answer> </question><p/> </c:question> ========================

