•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,518 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,812 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 516 | Replies: 2
![]() |
| |
Hi everyone. I am new to PHP and XML and would like to take the following example xml,
And display it on,screen using PHP in this format,
Long Sleved, blue, index/1/1/1/17743/60088
Long Sleved, green, index/1/1/1/1/1
Long Sleved, red, index/1/1/1/2/2
Long Sleved, yellow, index/1/1/1/3/3
Long Sleved, orange<, index/1/1/1/4/4
short sleved, light blue, index/1/1/1/17743/60089
short sleved, green, index/1/2/1/1/1
short sleved, red, index/1/2/1/2/2
short sleved, yellow, index/1/2/1/3/3
short sleved, orange<, index/1/2/1/4/4
My actual xml file is a lot bigger than the example but in the same format. I hope that someone can show me how to do this. Have tried using simpleXML dom functions and others but just cant seem to do it.
Thanks
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<shirt>
<name>Long Sleved></name>
<link>index/1/1</link>
<Types>
<Type>
<name>blue</name>
<link>index/1/1/1/17743/60088</link>
</Type>
<Type>
<name>green</name>
<link>index/1/1/1/1/1</link>
</Type>
<Type>
<name>red</name>
<link>index/1/1/1/2/2</link>
</Type>
<Type>
<name>yellow</name>
<link>index/1/1/1/3/3</link>
</Type>
<Type>
<name>orange</name>
<link>index/1/1/1/4/4</link>
</Type>
</Types>
</shirt>
<shirt>
<name>short sleved</name>
<link>index/1/1</link>
<Types>
<Type>
<name>light blue</name>
<link>index/1/1/1/17743/60089</link>
</Type>
<Type>
<name>green</name>
<link>index/1/2/1/1/1</link>
</Type>
<Type>
<name>red</name>
<link>index/1/2/1/2/2</link>
</Type>
<Type>
<name>yellow</name>
<link>index/1/2/1/3/3</link>
</Type>
<Type>
<name>orange</name>
<link>index/1/2/1/4/4</link>
</Type>
</Types>
</shirt>Long Sleved, blue, index/1/1/1/17743/60088
Long Sleved, green, index/1/1/1/1/1
Long Sleved, red, index/1/1/1/2/2
Long Sleved, yellow, index/1/1/1/3/3
Long Sleved, orange<, index/1/1/1/4/4
short sleved, light blue, index/1/1/1/17743/60089
short sleved, green, index/1/2/1/1/1
short sleved, red, index/1/2/1/2/2
short sleved, yellow, index/1/2/1/3/3
short sleved, orange<, index/1/2/1/4/4
My actual xml file is a lot bigger than the example but in the same format. I hope that someone can show me how to do this. Have tried using simpleXML dom functions and others but just cant seem to do it.
Thanks
there is a syntax error on the 3rd line, it could be why simpleXML isnt working
<name>Long Sleved></name> No its not a syntax error in the xml. The code i provided is an example of my xml structure and i think i made the error when pasting it to the forum. I need to know how to pull the information out of the xml and place it into the above structure. When using xmlsimple i could only get the first name and link nodes from each type. I would like to get all of them.
Would like to cycle through each shirt and corresponding type and output it to the display like this.
Long Sleved, blue, index/1/1/1/17743/60088
Long Sleved, green, index/1/1/1/1/1
Long Sleved, red, index/1/1/1/2/2
Long Sleved, yellow, index/1/1/1/3/3
Long Sleved, orange<, index/1/1/1/4/4
short sleved, light blue, index/1/1/1/17743/60089
short sleved, green, index/1/2/1/1/1
short sleved, red, index/1/2/1/2/2
short sleved, yellow, index/1/2/1/3/3
short sleved, orange<, index/1/2/1/4/4
Thanks
Would like to cycle through each shirt and corresponding type and output it to the display like this.
Long Sleved, blue, index/1/1/1/17743/60088
Long Sleved, green, index/1/1/1/1/1
Long Sleved, red, index/1/1/1/2/2
Long Sleved, yellow, index/1/1/1/3/3
Long Sleved, orange<, index/1/1/1/4/4
short sleved, light blue, index/1/1/1/17743/60089
short sleved, green, index/1/2/1/1/1
short sleved, red, index/1/2/1/2/2
short sleved, yellow, index/1/2/1/3/3
short sleved, orange<, index/1/2/1/4/4
Thanks
It aint what you do its the way that you do it
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- php socket server - can't connect from flash xml client socket (PHP)
- XML and PHP (PHP)
- xml and php (PHP)
- Getting info from an XML file (PHP)
- using php to check for filenames (PHP)
- checking for recently added xml files (RSS, Web Services and SOAP)
- Seeking Experienced, Creative Graphic Web Designer (Web Development Job Offers)
- Zend PHP Certification (PHP)
Other Threads in the PHP Forum
- Previous Thread: PHP mail question
- Next Thread: MySQL date formatting


Hybrid Mode