Page 1 of 1

PHP xml and sax

Posted: Sat Dec 09, 2006 7:51 pm
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]

Posted: Sun Dec 10, 2006 3:02 am
by feyd
I'd suggest using separate files for each language. Your handling code will be far more basic then.

Posted: Sun Dec 10, 2006 10:40 pm
by neel_basu
You Can Use php xml Parser Functions

Posted: Sun Dec 10, 2006 11:37 pm
by Sloth
In a pinch you could do that using PRCE too, I was once stuck with a crappy host as well :P