Load & Parse an XML file without using JS or IE data Islands

  • bgraybr
  • Novice
  • Novice
  • bgraybr
  • Posts: 26

Post 3+ Months Ago

Like I said, I'm wondering if there is a way to load and parse an XML file without using JavaScript or Internet Explorer data Islands. I'm using XML to store data for a news bar on a website (Ex. instead of having to edit the news bar on every single page I can edit just the XML file). I'd rather not use JavaScript. The only other way I could find is IE data islands, which would only work in IE.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • bgraybr
  • Novice
  • Novice
  • bgraybr
  • Posts: 26

Post 3+ Months Ago

In other words, I want to know if its possible to do http://www.w3schools.com/xml/xml_parser.asp <-that without using any JavaScript.
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Are you willing to do this server-side? If so, there are several language choices for this. If you maintain that it must be done client-side, then JS may be your only choice.
  • bgraybr
  • Novice
  • Novice
  • bgraybr
  • Posts: 26

Post 3+ Months Ago

UPSGuy wrote:
Are you willing to do this server-side? If so, there are several language choices for this. If you maintain that it must be done client-side, then JS may be your only choice.


Now that you mentioned that, I just found out how to do something similar in PHP. Thanks for the help. (http://www.w3schools.com/php/php_xml_parser_expat.asp)
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Great choice for PHP. If you're willing to work with PEAR, then this is a good choice, too.
  • PatrickMc
  • Born
  • Born
  • PatrickMc
  • Posts: 1

Post 3+ Months Ago

I have been using biterscripting. It works without anything else and is free. For example, if you want to extract <newsitem></newsitem> from an XML file something.xml,

Code: [ Select ]
var str xml ; cat "something.xml" > $xml
stex -cr "^<newsitem\>&</newsitem\>^" $xml
  1. var str xml ; cat "something.xml" > $xml
  2. stex -cr "^<newsitem\>&</newsitem\>^" $xml


will print the news item. To replace the news items to your own string "Latest News - XYZ",

Code: [ Select ]
var str xml ; cat "something.xml" > $xml
sal -cr "^<newsitem\>&</newsitem\>^" "^<newsitem\>Latest News - XYZ</newsitem\>^" $xml > "something.xml"
  1. var str xml ; cat "something.xml" > $xml
  2. sal -cr "^<newsitem\>&</newsitem\>^" "^<newsitem\>Latest News - XYZ</newsitem\>^" $xml > "something.xml"


will do that. stex = string extractor, sal = string alterer, -c = case insensitive, -r = regular expression, etc.

I have been using it. Downloaded biterscripting from http://www.biterscripting.com .I use it for system admin purposes - parsing things, logs, web pages, xml and other files, ... There are several posts on various forums about parsing XML with biterscripting - google up biterscripting and XML.

Patrick

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 88 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.