PHP xml and sax

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bikeboardsurf
Forum Newbie
Posts: 1
Joined: Sat Dec 09, 2006 7:32 pm

PHP xml and sax

Post by bikeboardsurf »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,
I wanted to use XML to transform a webpage into different languages (german, english, french). I wasnt sure how to search and display xml tag data that has embedded xml tags for example:

[syntax="xml"]<language>
  <index>
     <title lang="english">THIS IS A TITLE</title>
     <title lang="german">THIS IS A TITLE in German</title>
     <title lang="french">THIS IS A TITLE in French</title>
     <main lang="english">THIS IS the main body</main >
     <main lang="german">THIS IS the main body in German</main >
     <main lang="french">THIS IS the main body in French</main >
  </index>
  <page2>
      <mainheading lang="english">blah blah</mainheading>
      <mainheading lang="french">blah blah in french</mainheading>
      <mainheading lang="german">blah blah in german</mainheading>
   </page2>
</language>
So say for the index page I would like to display all the information inbetween the index tags and where those tags have an 'english' attribute. Then for the second page I would like to display all tags inbetween page 2 etc etc etc. I would ideally like to use SAX to do this rather than DOM as dom isnt really supported by the host Im using.

Thanks
bikeboardsurf


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'd suggest using separate files for each language. Your handling code will be far more basic then.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

You Can Use php xml Parser Functions
Sloth
Forum Newbie
Posts: 18
Joined: Thu Dec 07, 2006 7:29 pm

Post by Sloth »

In a pinch you could do that using PRCE too, I was once stuck with a crappy host as well :P
Post Reply