User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,860 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,943 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: 447 | Replies: 2
Reply
Join Date: Oct 2007
Posts: 2
Reputation: bean1000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bean1000's Avatar
bean1000 bean1000 is offline Offline
Newbie Poster

Question pase xml with php

  #1  
Oct 3rd, 2007
Hi everyone. I am new to PHP and XML and would like to take the following example xml,

<?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>
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2006
Location: in a dream
Posts: 124
Reputation: nschessnerd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
nschessnerd's Avatar
nschessnerd nschessnerd is offline Offline
Junior Poster

Re: pase xml with php

  #2  
Oct 3rd, 2007
there is a syntax error on the 3rd line, it could be why simpleXML isnt working

<name>Long Sleved></name>
Reply With Quote  
Join Date: Oct 2007
Posts: 2
Reputation: bean1000 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bean1000's Avatar
bean1000 bean1000 is offline Offline
Newbie Poster

Re: pase xml with php

  #3  
Oct 3rd, 2007
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
It aint what you do its the way that you do it
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 1:21 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC