[PHP] PHP/XML/XSLT
For better (or in my view worse) the company I work for uses the above combination for rendering it's XHTML. Recent we upgraded our version of libxslt from 1.1.9 to 1.1.17 and for some reason we have lost our error reporting. Unfortunately we have not lost the errors and so are forced with commenting out sections of XSLT until we get the page back. Has anyone else encountered this problem (google was reticent) and do they know of any workarounds/fixes for this? TIA, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
> Look at the SOAP functions. There's a SOAP client & SOAP server. The > applications use SOAP calls to transfer their XML messages over the > Intenet, typically http/https, but could also use smtp for transport. oh... good idea, I didn't even think of SOAP. I'll check with our other developer tomorrow to see if his Side One can handle that.. thanks for the tip. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
Dan Joseph wrote: >> how is the xml being sent to you from the other place on the internet? is >> it being posted in a form, etc.? > > It won't be thru a form. I guess it'll be a direct send, he'll format > something like... > > >Jack >239048098324 > > > ... in a string and send it over. > > What methods are best suited for something like that? Would it be > best Side One to open a socket up to Side Two and send it thru that > way? I'm open to suggestions... > > -Dan Joseph Look at the SOAP functions. There's a SOAP client & SOAP server. The applications use SOAP calls to transfer their XML messages over the Intenet, typically http/https, but could also use smtp for transport. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
> how is the xml being sent to you from the other place on the internet? is > it being posted in a form, etc.? It won't be thru a form. I guess it'll be a direct send, he'll format something like... Jack 239048098324 ... in a string and send it over. What methods are best suited for something like that? Would it be best Side One to open a socket up to Side Two and send it thru that way? I'm open to suggestions... -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP & XML
Hi All, Just looking to be pointed in the right direction... I've googled and all that, but don't know what exactly I should be looking for. I am writing an XML application with PHP. Side one - send XML To side two and wait for a response: Side two - sit and wait for side one to send XML, then process and send a response. I guess I don't know what functions with PHP I should be focusing on. Everything I read tells me to point the code to file.xml, but there is no file. I'll be receiving the XML string from another place on the internet. Help? -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP->XML Parse Problem
At 13:44 11-5-04, you wrote: I wrote a script to parse an XML doc in straightforward PHP, but then decide to write it as objects but now I have a problem, that I hope someone with a little bit more experience can look at: Im at my wits end and would appreciate any help, im getting no errors as such, but it is not parsing the information. You can read the script easier here: http://www.pastebin.com/64934 Have you checked how far the script gets? Could you point the line that you think is the suspect? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP->XML Parse Problem
I wrote a script to parse an XML doc in straightforward PHP, but then decide to write it as objects but now I have a problem, that I hope someone with a little bit more experience can look at: Im at my wits end and would appreciate any help, im getting no errors as such, but it is not parsing the information. You can read the script easier here: http://www.pastebin.com/64934 Thanks in advance, M XML File (tips.xml) HEADLINE 1 ABSTRACT TEXT - STORY 1 PARA TEXT - STORY 1 HEADLINE 2 ABSTRACT TEXT - STORY 2 PARA TEXT - STORY 2 HEADLINE 3 ABSTRACT TEXT - STORY 3 PARA TEXT - STORY 3 HEADLINE 4 ABSTRACT TEXT - STORY 4 PARA TEXT - STORY 4 Class File (xml.class.php) _file = $filename; $this->_xparser = xml_parser_create(); $this->_fp = ""; $this->_data = ""; /* $this->_currentElement = ""; $this->_newstime = ""; $this->_suppliers_id = ""; $this->_article_type = ""; $this->_story_id = ""; $this->_headline = ""; $this->_abstract = ""; $this->_para = ""; */ } //Set callback functions function createCallBacks() { xml_set_element_handler($this->_xparser, array($this, "startElement"), array($this, "endElement")); xml_set_character_data_handler($this->_xparser, array($this, "charData")); } //Open file for reading function openFile() { if(!($this->_fp = fopen($this->_file, "r"))){ die("Cannot locate XML file: " . $this->_file); exit(); } } //Start parsing function parseFile() { while($this->_data = fread($this->_fp, 4096)) { // Error Handler if(!xml_parse($this->_xparser, $this->_data, feof($this->_fp))) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->_xparser)), xml_get_current_line_number($this->_xparser))); exit(); } } } //Free up parser memory function freeParser() { xml_parser_free($this->_xparser); } //Parse START tags function startElement(&$_xparser,$name,$attribs) { $this->_currentElement = $name; if ($name == "NEWSFEED") { $this->_newstime = $attribs['TIMESTAMP']; $this->_suppliers_id = $attribs['TEAMID']; } if ($name == "NEWSSTORY") { $this->_article_type = $attribs['ARTICLETYPE']; $this->_story_id = $attribs['STORYID']; } } //Parse END tags function endElement(&$_xparser,$name) { $this->_currentElement = ""; if($name == "NEWSSTORY"){ // Echo would be queries to screen *DELETE AFTER DEBUG* echo "INSERT INTO table (timestamp, team_id, art_type, story_id, headline, abstract, para) VALUES ('" . $this->_newstime . "','" . $this->_suppliers_id . "','" . $this->_article_type . "','" . $this->_story_id . "','" . $this->_headline ."','" . $this->_abstract . "','" . $this->_para . "')\n"; $this->_currentElement = ""; $this->_article_type = ""; $this->_story_id = ""; $this->_headline = ""; $this->_abstract = ""; $this->_para = ""; } } //Parse MAIN tag content function charData(&$_xparser,$data){ switch($this->_currentElement){ case "HEADLINE": $this->_headline = $data; break; case "ABSTRACT": $this->_abstract = $data; break; case "PARA": $this->_para = $data; break; } } } ?> Index File (index.php) (calls class) createCallBacks(); $xml->openFile(); $xml->parseFile(); $xml->freeParser(); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP & XML
Could someone point me in the right direction to learn how I can programatically validate a XML document against a XML schema? I've looked through the documentation but was unable to find any thing of any relevance (or so my xml newbie mind thought). thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, XML, UTF-8
Im storing a lot of user-entered data in XML files but i have a problem with folks submitting stuff just by copying and pasting from microsoft word. "Smart Quotes" and other awkward text then gets submitted and ruins the xml, meaning i am searching and replacing item by item to replace stuff. Does anyone know how I could do this automatically, as in is there anything that will convert a string to UTF-8 automatically ideally $fixed = convert-to-utf($oldmessedupstring) any ideas? Will CDATA sections allow non UTF-8 text? Russ Jones -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-xml
I think i found it... thank you for trying to help. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-xml
* Thus wrote pnp ([EMAIL PROTECTED]): > Hi, I'm developing a web site for a greek company and I want to show some > greek texts from an xml file to an html page. The pages encoding is utf-8. > So is the xml file and the xmlparses params. But the output is a bunch of > ???... You need to set the charset for the document to a greek charset so it knows how the characters are encoded. You also have to make sure that that charset is on the computer viewing the page. ie: header('Content-Type: text/html; charset=ISO-8895-7'); Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-xml
Please post some of your code. It is incredibly difficult to help you without it. Edward Dudlik "Those who say it cannot be done should not interrupt the person doing it." wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU - Original Message - From: "pnp" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, 17 November, 2003 05:42 Subject: [PHP] php-xml Hi, I'm developing a web site for a greek company and I want to show some greek texts from an xml file to an html page. The pages encoding is utf-8. So is the xml file and the xmlparses params. But the output is a bunch of ???... What am I doing wrong? Is there any way to do this? Thanks in advance, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-xml
Hi, I'm developing a web site for a greek company and I want to show some greek texts from an xml file to an html page. The pages encoding is utf-8. So is the xml file and the xmlparses params. But the output is a bunch of ???... What am I doing wrong? Is there any way to do this? Thanks in advance, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP XML Reference
Hi Tim, I have used the big ass "Professional PHP 4 XML" book from Wrox for the last 6 months, and i have picked up immense knowledge from that resource. Infact i have gone up in my career to being the lead web developer in my team...and i must atribute it to this book. You can find more information here: http://www.amazon.com/exec/obidos/ASIN/1861007213/qid%3D1047628025/sr%3D11-1/ref%3Dsr%5F11%5F1/002-9385423-3309610 Good luck, -Javagal On Fri, 14 Mar 2003 Tim Funk wrote : Hi, I am new to PHP, however i have a good handle on C programming and therefore hope to apply those conceps to PHP programming quickly. I am looking for a print reference that can help me to construct a web-based front-end for an application using XML. Any help in this regard will bemuch appreciated. Thanks, Tim - Do you Yahoo!? Yahoo! Web Hosting - establish your business online ___ Odomos - the only mosquito protection outside 4 walls - Click here to know more! http://r.rediff.com/r?http://clients.rediff.com/odomos/Odomos.htm&&odomos&&wn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP XML Reference
Hi, I am new to PHP, however i have a good handle on C programming and therefore hope to apply those conceps to PHP programming quickly. I am looking for a print reference that can help me to construct a web-based front-end for an application using XML. Any help in this regard will bemuch appreciated. Thanks, Tim - Do you Yahoo!? Yahoo! Web Hosting - establish your business online
[PHP] Php +Xml?
Hello people, I want to start using Xml with php. How do I install xml on Apache with Php? I am running redhat 7.2,Apache 1.3.12 and php latest version. How do I install xml? I am totally new to Xmland want to start somewhere... -Dhaval _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, xml and mysql with netscape and ie
hi.. was just wondering when i use php xml and mysql (standard xml) it seems that netscape 4.7 and below wont see the web page with results from a mysql query on them... we dont know about ie5 or below yet but does anybody know why this is or how to fix it? the nature of the web pages is a table built with standard xml that goes into a loop to get all the rows in a table and show them on a web page but for strange reasons anything below netscape 7 ignores everything except the last entry in the mysql table... trying to get someone i know with ie5 or below to look and see if it doesnt work --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP + XML
Hi, I have a problem with PHP and XML, I can't get the right data out of the XML file. I made a small example of what I want: --- Code --- function startElement($xml_parser, $name, $attrs) { echo "[$name]";} function externalEntityRefHandler($xml_parser, $openEntityNames, $base, $systemId,$publicId) { echo "External ?"; } function endElement($xml_parser, $name) { echo "[/$name]";} function characterData($xml_parser, $text) { echo "Handling characterdata: '".$text."'"; } $xml_parser = xml_parser_create(); xml_parser_set_option( $xml_parser, XML_OPTION_CASE_FOLDING, false ); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler"); // Parse the XML data. // open XML file if (!($fp = fopen("test.xml", "r"))) { die("Cannot locate XML data file"); } // read and parse data while ($data = fread($fp, 4096)) { echo "".$data.""; if (!xml_parse($xml_parser, $data, feof($fp))) { echo "XML error in given {$data} on line ". xml_get_current_line_number($xml_parser) . ' column ' . xml_get_current_column_number($xml_parser) . '. Reason: ' . xml_error_string(xml_get_error_code($xml_parser)); } } --- End Code --- --- text.xml --- "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent";> %ISOlat1; ]> Das Hildebrandslied, circa 775 C.E. Ik gihôrta dhat seggen, dhat sih urhêttun ænon muotîn, Hiltibrant enti Hadhubrant untar heriun tuêm. sunufatarungo: iro saro rihtun, I'll spare you the next 61 lines --- End test.xml --- The output I get is : %ISOlat1; ]> Ik gihôrta dhat seggen, dhat sih urhêttun ænon muotîn, Hiltibrant enti Hadhubrant untar heriun tuêm. sunufatarungo: iro saro rihtun, I'll spare you the next 61 lines [DOCUMENT] Handling characterdata: ' ' Handling characterdata: ' ' [TITLE] Handling characterdata: 'Das Hildebrandslied, circa 775 C.E. ' [/TITLE] Handling characterdata: ' ' Handling characterdata: ' ' [LINE] Handling characterdata: 'Ik gih' Handling characterdata: 'rta dhat seggen,' [/LINE] Handling characterdata: ' ' Handling characterdata: ' ' [LINE] Handling characterdata: 'dhat sih urh' Handling characterdata: 'ttun ' Handling characterdata: 'non muot' Handling characterdata: 'n,' [/LINE] Handling characterdata: ' ' Handling characterdata: ' ' [LINE] Handling characterdata: 'Hiltibrant enti Hadhubrant untar heriun tu' Handling characterdata: 'm. ' Handling characterdata: ' ' Handling characterdata: ' ' [/LINE] Handling characterdata: ' ' Handling characterdata: ' ' Handling characterdata: ' ' [LINE] Handling characterdata: 'sunufatarungo: iro saro rihtun,' [/LINE] Handling characterdata: ' ' Handling characterdata: ' ' [COMMENT] Handling characterdata: 'I'll spare you the next 61 lines' [/COMMENT] Handling characterdata: ' ' [/DOCUMENT] As you can see, all the HTML entities are dissapeard ??? What am I doing wrong ? Regards, Sandy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP: XML + XSL
hello! I have the following problem: I want to display text from nodes in xsm file, but after every text to put picture with link. The rows above dispay the text correctly in a table with 6 columns. But how to put the pucture and to display it only in cells where there is text? Thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP: XML + XSL
Hello falks! I could not enter javascript into my xsl file. Does anyone know how to do it? Thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP XML mailing list
Are any of you subscribed to the above list? If so, do you ever see any traffic on it? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
> > Do you realize more benifit for the back end > > processes when using XML that makes any additional time it takes > > to display a page to the user worth it? > Just ask the user if they really want to wait longer for something they > can't even see, just so you can use the latest buzzword in describing > your site. > I'm sure they'll say NO! Hell, I would answer "No", too. But I'm not considering XML just because it's the latest "buzzword". I've been part of the industry too long to be lulled by such things. The reason I'm considering XML is to allow things like "themes" and also to standardize and optimize messages that would be sent to various services that I could create and set up with a redesign. It would also allow me to create external companion software that could communicate with the website and allow some of the daily work of the end user to take place offline. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
At 09:25 AM 10/15/02 -0500, Chris Boget wrote: > Do you realize more benifit for the back end > processes when using XML that makes any additional time it takes > to display a page to the user worth it? Just ask the user if they really want to wait longer for something they can't even see, just so you can use the latest buzzword in describing your site. I'm sure they'll say NO! It is never worth anything that makes it take longer to display a page to the user. Sorry I missed this in the last message... it is important. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
On Tue, 2002-10-15 at 15:03, Chris Boget wrote: > > Here are some ideas you might want to review these options: > > Other people have suggested variations of the below so I'll just respond > here to cut down on the bandwidth. > > > 1. Try storing the data in the database as xml files them selves. You > > then do not have to create the xml file. This will no doubt increase > > your database size. > > This, unfortunately, is not a possiblity because the databases get updated > too frequently. Plus, I have 2 tables that have in excess of 80k records > which also gets updated frequently. File I/O for updating a flat file DB would > be atrocious. > > 2. Store your xml templates in the database for faster retrieval. > > Please elaborate on this suggestion? sample xml page: So, then in theory, this is a xml template (contains no data) that can be stored in the database. > > 3. Have the xml file reference the xslt file for the translation to > > occur on the client end...they get the HTML and all u really worry about > > is creating the xml file and having the xslt file. > > As far as I know, there are several issues with the various browsers processing > and executing the XSL. There isn't full compliance, particularly with the actual > commands (ie, xsl:copy, xsl:copy-of, etc) and/or if you want to manipulate the > tree/DOM. > Is this untrue? > > > 4. Do the translation of Database -> XML -> XSLT -> HTML all in PHP and > > save the HTML output for caching. > > For the most part, this isn't feasible due to number 1 above. And for those files > that I can cache, the data set being retrieved is so small that any performance > hit (if any) would certainly be insignificant. So there wouldn't be much point in > caching those. > Even so, this does give me a few ideas and could possibly be the solution to a > very different problem I need to address. Actually you do not have to store the data and xml (together) in the database. Here are the steps to perform: 1. Query database getting desired data. 2. get the xml file into PHP XML parser (either from a database or file.) 3. Parse xml file adding data to the file. Result is a new xml file. (XML template + data) 4. Optional (if xslt is compiled into PHP). You can do the translation of your XML file and XSLT file in PHP which could result in a html file or direct output to the browser. 5. Send the XML file to the browser with the XSLT information information in the XML file (not so much XSL). And let the browser handle the transformation to HTML for ya. Also note that the XSLT file is a great place to put all your themes. U can have one XSLT file for each theme that handles your site. The options are endless... That is relatively all that needs to be done. > Thank you all for your ideas and suggestions thus far. Please keep them coming > if you haven't chimed in or if you think of anything else. I'm sure this >information is > helping other people as well! > > Chris > -- .: B i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
At 09:25 AM 10/15/02 -0500, Chris Boget wrote: >Let me preface this by saying that I know the benefits of using >XML It seems to me most of the benefits of XML actually go to the hardware and network suppliers. They get to sell you bigger storage for the bloated data, faster processors for the mindless transformations and bigger pipes to transfer all the extra markup in an XML file. XML has its place in simplifying data exchange (if both parties can find or agree on a common schema) and things like the PHP documentation where there is a real need to present one source document several different ways. Why waste space in a database with XML. The database already is one of the most efficient ways to store the data. So no XML for storage. Unless you have more than one way you need to present the data on your web pages you are wasting both your time, and processor time trying to add XML into the mix. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
> Here are some ideas you might want to review these options: Other people have suggested variations of the below so I'll just respond here to cut down on the bandwidth. > 1. Try storing the data in the database as xml files them selves. You > then do not have to create the xml file. This will no doubt increase > your database size. This, unfortunately, is not a possiblity because the databases get updated too frequently. Plus, I have 2 tables that have in excess of 80k records which also gets updated frequently. File I/O for updating a flat file DB would be atrocious. > 2. Store your xml templates in the database for faster retrieval. Please elaborate on this suggestion? > 3. Have the xml file reference the xslt file for the translation to > occur on the client end...they get the HTML and all u really worry about > is creating the xml file and having the xslt file. As far as I know, there are several issues with the various browsers processing and executing the XSL. There isn't full compliance, particularly with the actual commands (ie, xsl:copy, xsl:copy-of, etc) and/or if you want to manipulate the tree/DOM. Is this untrue? > 4. Do the translation of Database -> XML -> XSLT -> HTML all in PHP and > save the HTML output for caching. For the most part, this isn't feasible due to number 1 above. And for those files that I can cache, the data set being retrieved is so small that any performance hit (if any) would certainly be insignificant. So there wouldn't be much point in caching those. Even so, this does give me a few ideas and could possibly be the solution to a very different problem I need to address. Thank you all for your ideas and suggestions thus far. Please keep them coming if you haven't chimed in or if you think of anything else. I'm sure this information is helping other people as well! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
Chris, Here are some ideas you might want to review these options: 1. Try storing the data in the database as xml files them selves. You then do not have to create the xml file. This will no doubt increase your database size. 2. Store your xml templates in the database for faster retrieval. 3. Have the xml file reference the xslt file for the translation to occur on the client end...they get the HTML and all u really worry about is creating the xml file and having the xslt file. 4. Do the translation of Database -> XML -> XSLT -> HTML all in PHP and save the HTML output for caching. Then u can save a link to that file in your database. This will allow you to have a very good caching system. When a request for a page comes in u can verify if the cached link in the database is too old or not. Then you can either get the link to the cached file or get the data to create the XML file. But, I have a feeling that this will still be extremely sufficient for your speed requirements... On Tue, 2002-10-15 at 08:25, Chris Boget wrote: > Let me preface this by saying that I know the benefits of using > XML with regards to portability and extensibility. > Here is the issue I face. I have all of my data stored in a MySQL > database. I'm considering reworking my website so that it uses > XML (after being converted from resultant records in my DB) to > transmit & XSLT to transform and display the data to my end user. > There are a few benifits I can see in sending XML messages as > part of the back end processing. However, that seems to be out- > weighed by the amount of processing that's going to need to take > place in actually serving the data to the user. > First I have to query and pull the records from the database. Then, > I need to send those records to a function (or functions) to convert > it to XML. Then, I need to take that XML data and have PHP use > an XSL stylesheet to transform it to HTML before it, finally, gets > sent on to the browser. So that's basically 2 conversions that take > place on the back end. > How much experience have any of you had with doing that? Does > it take significantly longer to serve the pages; is there a noticible > performance hit? Do you realize more benifit for the back end > processes when using XML that makes any additional time it takes > to display a page to the user worth it? > I'd love to hear about people's experience with this kind of thing so I > can better make a decision wrt whether or not I should even go down > this route. > > thnx, > Chris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
A few ideas: 1. I have been setting up a system to do almost exactly what you are doing (database --> xml --> xslt-->html via a custom class) and have not noticed any significant performance hit, but this is not in production so your mileage may vary, but my gut feeling is the performance hit is very small (real scientific - not). 2. Does all this data from your database have to be converted on the fly? In other words does it have to be completely dynamic? If some of the content is updated fairly infrequently then you could have a cron-job type process convert from database to xml files at a given interval (hourly, weekly, montly etc..). Or even think about whether your data needs to live in a database. Can it just live in an xml file? 3. Modern browsers can convert using xslt themselves so you could check the user agent and have the browser transform the xml if it is capable (IE5-6, Netscape 6-7, mozilla etc...) I am going to do all the transformation on the server and live with the slight performance hit. I think the benefits are worth it. Making and maintaining a site become so easy once you have this set up. The code on each page is compact and almost exactly the same, the only variance is the sql statement and the name of the xsl file. Go ahead and email me off list if you want to discuss this off list Chris Boget wrote: >Let me preface this by saying that I know the benefits of using >XML with regards to portability and extensibility. >Here is the issue I face. I have all of my data stored in a MySQL >database. I'm considering reworking my website so that it uses >XML (after being converted from resultant records in my DB) to >transmit & XSLT to transform and display the data to my end user. >There are a few benifits I can see in sending XML messages as >part of the back end processing. However, that seems to be out- >weighed by the amount of processing that's going to need to take >place in actually serving the data to the user. >First I have to query and pull the records from the database. Then, >I need to send those records to a function (or functions) to convert >it to XML. Then, I need to take that XML data and have PHP use >an XSL stylesheet to transform it to HTML before it, finally, gets >sent on to the browser. So that's basically 2 conversions that take >place on the back end. >How much experience have any of you had with doing that? Does >it take significantly longer to serve the pages; is there a noticible >performance hit? Do you realize more benifit for the back end >processes when using XML that makes any additional time it takes >to display a page to the user worth it? >I'd love to hear about people's experience with this kind of thing so I >can better make a decision wrt whether or not I should even go down >this route. > >thnx, >Chris > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
"Chris Boget" <[EMAIL PROTECTED]> wrote... : > Let me preface this by saying that I know the benefits of using > XML with regards to portability and extensibility. Yes, there are many benefits. > Here is the issue I face. I have all of my data stored in a MySQL > database. I'm considering reworking my website so that it uses > XML (after being converted from resultant records in my DB) to > transmit & XSLT to transform and display the data to my end user. It is indeed a very elegant way of creating dynamic sites. > There are a few benifits I can see in sending XML messages as > part of the back end processing. However, that seems to be out- > weighed by the amount of processing that's going to need to take > place in actually serving the data to the user. True, it is more that just embedding PHP variables into an HTML templates. > First I have to query and pull the records from the database. Ideally, you could also store some text XML-formatted already in DB. Always, if that makes sense. I do it for the article, long texts to be formatted. > Then, > I need to send those records to a function (or functions) to convert > it to XML. Try modulate it with Classes. (an extra overhead, I know, but adds you the portability.. which, I believe is important for you) > Then, I need to take that XML data and have PHP use > an XSL stylesheet to transform it to HTML before it, finally, gets > sent on to the browser. So that's basically 2 conversions that take > place on the back end. Before actually send it to the browser, save (cache) the HTML file to your local system, so them later you can reuse it directly should no data change in between. > How much experience have any of you had with doing that? Many do that. You can create some real dynamic sites, skins etc.. > Does > it take significantly longer to serve the pages; is there a noticible > performance hit? If well designed, the overhead will only be some few milliseconds. This is not much, considering that now the machines get faster and faster. > Do you realize more benifit for the back end > processes when using XML that makes any additional time it takes > to display a page to the user worth it? Yes, having a more dynamic site means less efforts on additional eventual features to implement. Thus, not only the extra 100 milliseconds for user to wait, but rather the cheaper maintaining costs and higher quality. It often means cheaper services in some businesses. > I'd love to hear about people's experience with this kind of thing so I > can better make a decision wrt whether or not I should even go down > this route. I would go for it (in fact I working myself on similar system these days). One thing I'd recommend you is to invest some relatively sufficient time on studying well the application design so you can make it as dynamic as possible. For speed purpose, you should organize yourself a caching system. An idea would be tracking down the changes on the DB and saving all rendered HTML files to then compare on the request and reuse unchanged sections of the website. It, of course, depends 85% on your application data, logic and specifications. So, invest enough time, prepare your database for cache and add XML/XSLT/PHP trio. Good luck! -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // where PHP Begins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP & XML
Let me preface this by saying that I know the benefits of using XML with regards to portability and extensibility. Here is the issue I face. I have all of my data stored in a MySQL database. I'm considering reworking my website so that it uses XML (after being converted from resultant records in my DB) to transmit & XSLT to transform and display the data to my end user. There are a few benifits I can see in sending XML messages as part of the back end processing. However, that seems to be out- weighed by the amount of processing that's going to need to take place in actually serving the data to the user. First I have to query and pull the records from the database. Then, I need to send those records to a function (or functions) to convert it to XML. Then, I need to take that XML data and have PHP use an XSL stylesheet to transform it to HTML before it, finally, gets sent on to the browser. So that's basically 2 conversions that take place on the back end. How much experience have any of you had with doing that? Does it take significantly longer to serve the pages; is there a noticible performance hit? Do you realize more benifit for the back end processes when using XML that makes any additional time it takes to display a page to the user worth it? I'd love to hear about people's experience with this kind of thing so I can better make a decision wrt whether or not I should even go down this route. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/XML (Validation)
Hello, >From reading the docs on XML functions for PHP, I understand that validation is not included. Does any one know where there is a package for PHP that is already developed or resources where I can learn how to do this myself? Thank you. -Samuel
[PHP] PHP & xml: urgent!
Hello, I have an HTML file. I want to transform it to XML then filter it and transform it to another XML file. I used Sablotron with PHP to apply XSL to XML to filter the XML file. But I'm facing problems when I want to transform HTML to XML. I used TIDY but it seems it transforms to XHTML in a format not appropriate to Sablotron parser. I'm getting this msg: Warning: Sablotron error on line 26: cannot open file '/home/alia/public_html/XHTML/testing.xhtml' in /home/alia/public_html/XHTML/XSLTransformer.php on line 91 Can u plz help me. Thx a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP: XML/XSL
Hi everybody, I'm using Sablotron to transform XML with XSL and this is the PHP file: \n"; $strXhtml = $strXhtml . "\n"; $strXhtml = $strXhtml . "Balance:\n"; $strXhtml = $strXhtml . "\n"; $strXhtml = $strXhtml .""; //echo(trim($strXhtml)); include("XSLTransformer.php"); $xml=$strXhtml; $xsl="testing.xsl"; $transform = new XSLTransformer(); if($transform->setXsl($xsl)) { if($transform->setXmlString($xml)) { $transform->transform(); if ($transform->getError() == 0) { echo $transform->getOutput(); } else { echo "Error transforming ",$xml,".\n"; } } else { echo "",$xml,": ",$transform->getError(),"\n"; } $transform->destroy(); } ?> I'm getting the following warning although I'm sure that if I applied XSL to the XML file without php, it's working. Plz can u help me and tell me what could be the problem? Warning: xslt_process(): supplied argument is not a valid XSLT Processor resource in /home/alia/public_html/XHTML/XSLTransformer.php on line 69 Thx a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, XML and HTML-Tags
On Tue, Aug 13, 2002 at 03:22:03PM +0200, Bernard wrote: > > I am using successfully the PHP XML-parser. But I have one problem. > I like to include html tags into the texts and I don't want them to be > interpreted by the parser. Have you tried putting the XML in CDATA sections? That's really where such things should be. http://www.w3.org/TR/2000/REC-xml-20001006#sec-cdata-sect --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, XML and HTML-Tags
Hi, I am using successfully the PHP XML-parser. But I have one problem. I like to include html tags into the texts and I don't want them to be interpreted by the parser. But I can't prevent it. It tried < and &rt;, but they get interpreted as "<" and ">", and so I get an error message by the parser. I tried including the html stuff in comments, but then they are completely lost, which is of course normal behaviour. I tried quoting with backslash, e.g. \, but in vain as well. I would be very happy and thankful, if anybody could help me. Best wishes Bernard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, xml and flash
i'd like to use the flash xml sendAndLoad method to send a number of variables to a php script. php would process the variables and query a database and dynamically write an xml formatted response. and then obviously load it back into flash. however, i'm having problems with the initial step of php processing the xml formatted variables. how can i structure my php script to get at these variables? the xml would be formatted like : i need the value of variables type and search. the values may also have spaces. cheers Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/XML gap?
Why does it seem that when spoken about XML, PHP is almost always left out? And why does it seem that every XML based CMS is build in a non-php language? Are there any XMLCMS OpenSource Classes/Projects available? Warm regards, Emile Bosch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP, XML
> Does anyone know of a mailing list for PHP and XML or can I > just pose them here?? PHP-XML. The list address is: [EMAIL PROTECTED] Chris
[PHP] PHP, XML
hi, Does anyone know of a mailing list for PHP and XML or can I just pose them here?? Thanks, sandeep -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP XML with Dynamic Content
Writing it on the fly would be kinda redundant.. I think.. :( from mysql data to xml to data.. .. would slow things down a bit i think.. :( "Brian Clark" <[EMAIL PROTECTED]> wrote in message 20020105030550.GD17616@ganymede">news:20020105030550.GD17616@ganymede... > * Emile Bosch ([EMAIL PROTECTED]) [Jan 03. 2002 15:38]: > > > Hi a lot of todays proffesional content management systems use XML, now > > i was wondering how it's possible to mix XML with Dynamic Content, or > > content which is change sensitive, IE A shop, or an auction, > > let's say you have a shop with 1000 products, how am i gonna mix this in > > the XML? > > > Does anyone know how this is solved, because i don't think that you are > > gonna write hundreds of XML files for each article, can someone please help > > me out here? > > I understand the first paragraph up to "how am i gonna mix this in the > XML?" > > Why couldn't you store information in a database and write the XML files > on the fly when you need XML? Or update the XML file when something > changes? Or, why use XML at all? Do you _really_ need it? *confused* > > -- > Brian Clark | Avoiding the general public since 1805! > Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8 > Sex is the most fun you can have without laughing. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP XML with Dynamic Content
* Emile Bosch ([EMAIL PROTECTED]) [Jan 03. 2002 15:38]: > Hi a lot of todays proffesional content management systems use XML, now > i was wondering how it's possible to mix XML with Dynamic Content, or > content which is change sensitive, IE A shop, or an auction, > let's say you have a shop with 1000 products, how am i gonna mix this in > the XML? > Does anyone know how this is solved, because i don't think that you are > gonna write hundreds of XML files for each article, can someone please help > me out here? I understand the first paragraph up to "how am i gonna mix this in the XML?" Why couldn't you store information in a database and write the XML files on the fly when you need XML? Or update the XML file when something changes? Or, why use XML at all? Do you _really_ need it? *confused* -- Brian Clark | Avoiding the general public since 1805! Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8 Sex is the most fun you can have without laughing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP XML with Dynamic Content
Hi a lot of todays proffesional content management systems use XML, now i was wondering how it's possible to mix XML with Dynamic Content, or content which is change sensitive, IE A shop, or an auction, let's say you have a shop with 1000 products, how am i gonna mix this in the XML? Does anyone know how this is solved, because i don't think that you are gonna write hundreds of XML files for each article, can someone please help me out here? Warm regards, Emile Bosch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML (2)
and restart ofcourse ;) bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML
Thanks! Much appreciated. M "Bas Van Rooijen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > > For XML use parser: http://www.php.net/manual/en/ref.xml.php > > PHP in .xsl file is possible, edit your httpd.conf > > find this line: > AddType application/x-httpd-php .phtml .php .php3 > > and add extensions that should be parsed by PHP, like so: > > AddType application/x-httpd-php .phtml .php .php3 .xsl > > be carefull, anything between will be executed by > default. if this may conflict with the nature of the output (like .xml files) > you can edit your php.ini to force long open tags > find this line: > short_open_tag = On > > change On to Off > > > bvr. > > On Thu, 20 Dec 2001 01:34:58 -, Martin Hughes wrote: > > >Heya, > > > >Is it possible to integrate XML with PHP - ie get data out of an XML file > >and format it in html using php? Or alternatively, use php within an XSL > >file...? > > > >Cheers > > > >Mart > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML
For XML use parser: http://www.php.net/manual/en/ref.xml.php PHP in .xsl file is possible, edit your httpd.conf find this line: AddType application/x-httpd-php .phtml .php .php3 and add extensions that should be parsed by PHP, like so: AddType application/x-httpd-php .phtml .php .php3 .xsl be carefull, anything between will be executed by default. if this may conflict with the nature of the output (like .xml files) you can edit your php.ini to force long open tags Heya, > >Is it possible to integrate XML with PHP - ie get data out of an XML file >and format it in html using php? Or alternatively, use php within an XSL >file...? > >Cheers > >Mart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP & XML
Heya, Is it possible to integrate XML with PHP - ie get data out of an XML file and format it in html using php? Or alternatively, use php within an XSL file...? Cheers Mart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML
I thought that short tags were illegal in XHTML and XML. But I could be wrong. On Friday, December 7, 2001, at 01:53 PM, Steve Haemelinck wrote: > Hi Guys > > I am developing with PHP and XML. Now I experience some problem with the > processing instructions of xml () > which causes PHP to return a parsing error. > This is logical because for > PHP. Does anybody got an idea how to solve this problem without > disabling > the short-tags in the php.ini fiel ? > > Thx > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML
You could also do it like: ' ?> Mike Steve Haemelinck wrote: >Hi Guys > >I am developing with PHP and XML. Now I experience some problem with the >processing instructions of xml () >which causes PHP to return a parsing error. >This is logical because PHP. Does anybody got an idea how to solve this problem without disabling >the short-tags in the php.ini fiel ? > >Thx > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML
No, you need to disable short_tags and use for all your PHP tags if you are going to mix PHP and XML tags in the same file. -Rasmus On Fri, 7 Dec 2001, Steve Haemelinck wrote: > Hi Guys > > I am developing with PHP and XML. Now I experience some problem with the > processing instructions of xml () > which causes PHP to return a parsing error. > This is logical because PHP. Does anybody got an idea how to solve this problem without disabling > the short-tags in the php.ini fiel ? > > Thx > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP & XML
Hi Guys I am developing with PHP and XML. Now I experience some problem with the processing instructions of xml () which causes PHP to return a parsing error. This is logical because http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML Parsing
> Interesting.. So to be consistent with proper XML formatting, > should the server hosting the XML file convert the & into > & ? It depends on the situation, I believe. The server that sends you XML should indeed provide you well-formed XML, which it's not doing. Probably what should happen is that the server sending the XML should urlencode URLs in the cdata elements, and then after you parse the XML file you should urldecode the URLs. I would be surprised if this hasn't been done as some standard part of XML parsing and I've just missed it in my limited use of XML parsers. > I certainly feel like I'm missing something... Although I'm a bit at > odds as to how to troubleshoot this new file. > I no longer get the errors, but I'm not getting the results I'm looking for either. I'm not sure what results you're looking for exactly, but if you put in a bunch of echo statements at various points throughout your parsing routines, you will see that none of the "if x = y" conditions are matching. Here's what I'd recommend: 1. put in a bunch of echo statements to print out your variables at different points in your parsing, just to make sure it's doing what you expect it to. Do a full audit of your characterData routine through this method, and I think it will show you where the errors are. (I did not see the exact error right away so I gave up since I do have a day job. :-) 2. keep your first eregi_replace statement, then when you're printing out the links, re-convert it with a reverse eregi_replace to turn the & back into a simple &. This will send it to the HTML browser in the format you want, I hope. I hope this is of some help. Pete. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML Parsing
Hello Peter, Peter Dudley wrote: > The problem is in your link URL, where you pass CGI parameters. When XML > sees the & character, it assumes it's a special character thing such as > & or ", so it's expecting a semicolon. replacing it with & fixed the XML error. Thanks! > http://cupe.ca/news/cupenews/showitem.asp?ID=2823&cl=1 > Just yesterday I discovered a program called XML Spy which you can get on a > 30-day eval from www.tucows.com. This was what pointed out the error to me > in your file. Interesting.. So to be consistent with proper XML formatting, should the server hosting the XML file convert the & into & ? > When I was using XSL last year for the first time, I had a devil of a time > figuring out how to get URLs, particularly with query strings attached, > through the XML parsers. Try using the %codes in your URLs instead of & and > other special characters; that should help, if I remember correctly. > (Similarly, building HREF tags using XSL stylesheets seemed pretty awkward, > but I'm sure I was missing some crucial tidbit of information.) I certainly feel like I'm missing something... Although I'm a bit at odds as to how to troubleshoot this new file. I no longer get the errors, but I'm not getting the results I'm looking for either. The updated script is running here: http://www.airdiv-cupe.org/portal/newsfeed_new_parser.php I've also attached the full script (since I've made some changes to it). Any additional help would be appreciated. Mike > "Mike Gifford" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> Hello, >> >> In looking for a good script to parse XML files I stumbled across the > > following > >> tutorial (which looks very good): >> http://www.wirelessdevnet.com/channels/wap/features/xmlcast_php.html >> >> I have set this script up here: >> http://www.airdiv-cupe.org/portal/newsfeed_new_parser.php >> >> and I keep getting the following error (even after making a number of > > changes): > >> XML error: not well-formed at line 16 >> >> And I'm not sure how to troubleshoot this problem. >> >> I'm assuming that it is referring to line 16 on the XML file, in this > > case: > >> http://cupe.ca/xml/cupenews.rdf >> >> My parsing definitions are as follows >>$itemTitleKey = "^rdf^item^title"; >>$itemLinkKey = "^rdf^item^link"; >>$itemDescKey = "^rdf^item^description"; >> >> Any help would be appreciated. >> >> Mike http://airdiv.cupe.ca/portal/";; $sDescription = "A Portal for the Airline Division of CUPE"; $arItems = array(); $itemCount = 0; // * Start User-Defined Vars // rss url goes here $uFile ="http://cupe.ca/xml/cupenews.rdf";; // descriptions (true or false) goes here $bDesc = ""; // If it exists this should be 'true' // font goes here $uFont = "Verdana, Arial, Helvetica, sans-serif"; $uFontSize = "2"; // * End User-Defined Vars ** function startElement($parser, $name, $attrs) { global $curTag; $curTag .= "^$name"; } function endElement($parser, $name) { global $curTag; $caret_pos = strrpos($curTag,'^'); $curTag = substr($curTag,0,$caret_pos); } function characterData($parser, $data) { global $curTag; // get the Channel information first global $sTitle, $sLink, $sDescription; // $titleKey = "^RSS^CHANNEL^TITLE"; // $linkKey = "^RSS^CHANNEL^LINK"; // $descKey = "^RSS^CHANNEL^DESCRIPTION"; $titlekey = "^rdf:RDF^channel^title"; $linkkey = "^rdf:RDF^channel^link"; $desckey = "^rdf:RDF^channel^description"; if ($curTag == $titleKey) { $sTitle = $data; echo $sTitle; } elseif ($curTag == $linkKey) { $sLink = $data; echo $sLink; } elseif ($curTag == $descKey) { $sDescription = $data; } // now get the items global $arItems, $itemCount; // $itemTitleKey = "^RSS^CHANNEL^ITEM^TITLE"; // $itemLinkKey = "^RSS^CHANNEL^ITEM^LINK"; // $itemDescKey = "^RSS^CHANNEL^ITEM^DESCRIPTION"; $itemtitlekey = "^rdf:RDF^item^title"; $itemlinkkey = "^rdf:RDF^item^link"; $itemdesckey = "^rdf:RDF^item^description"; if ($curTag == $itemTitleKey) { // make new xitem $arItems[$itemCount] = new xitem(); // set new item object's properties $arItems[$itemCount]->xTitle = $data; echo $data; } elseif ($curTag == $itemLinkKey) { $arItems[$itemCount]->xLink = $data; echo $data; } elseif ($curTag == $itemDescKey) { $arItems[$itemCount]->xDescription = $data; // increment item counter $itemCount++; echo $data; } } // main loop $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); if (!($fp = fopen($uFile,"r"))) { die ("could not open RSS for input"); } while ($data = fread($fp, 4096)) { $data=eregi_replace( "&", "&",$data); echo $data; if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprin
Re: [PHP] PHP & XML Parsing
Hello Fabian, This was very helpful. Thanks for letting me know about this little glitch. It almost resolves the problem that I was having. Now I no longer get xml errors. However, I'm not able to output the XML either. Any suggestions would be appreciated. The updated code is available here: http://www.airdiv-cupe.org/portal/newsfeed_new_parser.php And I've included the full script in the email (at the very bottom of this message). Thanks. Mike Fabian Raygosa wrote: > for xml you have to escape certain characters in the file, one is the > ampersand ... > - Original Message - > From: "Mike Gifford" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, May 18, 2001 12:24 PM > Subject: [PHP] PHP & XML Parsing > > > >> Hello, >> >> In looking for a good script to parse XML files I stumbled across the > > following > >> tutorial (which looks very good): >> http://www.wirelessdevnet.com/channels/wap/features/xmlcast_php.html >> >> I have set this script up here: >> http://www.airdiv-cupe.org/portal/newsfeed_new_parser.php >> >> and I keep getting the following error (even after making a number of > > changes): > >> XML error: not well-formed at line 16 >> >> And I'm not sure how to troubleshoot this problem. >> >> I'm assuming that it is referring to line 16 on the XML file, in this > > case: > >> http://cupe.ca/xml/cupenews.rdf >> >> My parsing definitions are as follows >>$itemTitleKey = "^rdf^item^title"; >>$itemLinkKey = "^rdf^item^link"; >>$itemDescKey = "^rdf^item^description"; >> >> Any help would be appreciated. >> >> Mike >> -- >> Mike Gifford, OpenConcept Consulting, http://openconcept.ca >> Offering everything your organization needs for an effective web site. >> Featured Client: http://halifaxinitiative.org >> A good life is one inspired by love and guided by knowledge - B. Russell >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: [EMAIL PROTECTED] http://airdiv.cupe.ca/portal/";; $sDescription = "A Portal for the Airline Division of CUPE"; $arItems = array(); $itemCount = 0; // * Start User-Defined Vars // rss url goes here $uFile ="http://cupe.ca/xml/cupenews.rdf";; // descriptions (true or false) goes here $bDesc = ""; // If it exists this should be 'true' // font goes here $uFont = "Verdana, Arial, Helvetica, sans-serif"; $uFontSize = "2"; // * End User-Defined Vars ** function startElement($parser, $name, $attrs) { global $curTag; $curTag .= "^$name"; } function endElement($parser, $name) { global $curTag; $caret_pos = strrpos($curTag,'^'); $curTag = substr($curTag,0,$caret_pos); } function characterData($parser, $data) { global $curTag; // get the Channel information first global $sTitle, $sLink, $sDescription; // $titleKey = "^RSS^CHANNEL^TITLE"; // $linkKey = "^RSS^CHANNEL^LINK"; // $descKey = "^RSS^CHANNEL^DESCRIPTION"; $titlekey = "^rdf:RDF^channel^title"; $linkkey = "^rdf:RDF^channel^link"; $desckey = "^rdf:RDF^channel^description"; if ($curTag == $titleKey) { $sTitle = $data; echo $sTitle; } elseif ($curTag == $linkKey) { $sLink = $data; echo $sLink; } elseif ($curTag == $descKey) { $sDescription = $data; } // now get the items global $arItems, $itemCount; // $itemTitleKey = "^RSS^CHANNEL^ITEM^TITLE"; // $itemLinkKey = "^RSS^CHANNEL^ITEM^LINK"; // $itemDescKey = "^RSS^CHANNEL^ITEM^DESCRIPTION"; $itemtitlekey = "^rdf:RDF^item^title"; $itemlinkkey = "^rdf:RDF^item^link"; $itemdesckey = "^rdf:RDF^item^description"; if ($curTag == $itemTitleKey) { // make new xitem $arItems[$itemCount] = new xitem(); // set new item object's properties $arItems[$itemCount]->xTitle = $data; echo $data; } elseif ($curTag == $itemLinkKey) { $arItems[$itemCount]->xLink = $data; echo $data; } elseif ($curTag == $itemDescKey) { $arItems[$itemCount]->xDescription = $data; // increment item counter $itemCount++; echo $data; } } // main loop $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "
Re: [PHP] PHP & XML Parsing
for xml you have to escape certain characters in the file, one is the ampersand ... - Original Message - From: "Mike Gifford" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, May 18, 2001 12:24 PM Subject: [PHP] PHP & XML Parsing > Hello, > > In looking for a good script to parse XML files I stumbled across the following > tutorial (which looks very good): > http://www.wirelessdevnet.com/channels/wap/features/xmlcast_php.html > > I have set this script up here: > http://www.airdiv-cupe.org/portal/newsfeed_new_parser.php > > and I keep getting the following error (even after making a number of changes): > XML error: not well-formed at line 16 > > And I'm not sure how to troubleshoot this problem. > > I'm assuming that it is referring to line 16 on the XML file, in this case: > http://cupe.ca/xml/cupenews.rdf > > My parsing definitions are as follows >$itemTitleKey = "^rdf^item^title"; >$itemLinkKey = "^rdf^item^link"; >$itemDescKey = "^rdf^item^description"; > > Any help would be appreciated. > > Mike > -- > Mike Gifford, OpenConcept Consulting, http://openconcept.ca > Offering everything your organization needs for an effective web site. > Featured Client: http://halifaxinitiative.org > A good life is one inspired by love and guided by knowledge - B. Russell > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & XML Parsing
The problem is in your link URL, where you pass CGI parameters. When XML sees the & character, it assumes it's a special character thing such as & or ", so it's expecting a semicolon. http://cupe.ca/news/cupenews/showitem.asp?ID=2823&cl=1 Just yesterday I discovered a program called XML Spy which you can get on a 30-day eval from www.tucows.com. This was what pointed out the error to me in your file. When I was using XSL last year for the first time, I had a devil of a time figuring out how to get URLs, particularly with query strings attached, through the XML parsers. Try using the %codes in your URLs instead of & and other special characters; that should help, if I remember correctly. (Similarly, building HREF tags using XSL stylesheets seemed pretty awkward, but I'm sure I was missing some crucial tidbit of information.) Pete. "Mike Gifford" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > In looking for a good script to parse XML files I stumbled across the following > tutorial (which looks very good): > http://www.wirelessdevnet.com/channels/wap/features/xmlcast_php.html > > I have set this script up here: > http://www.airdiv-cupe.org/portal/newsfeed_new_parser.php > > and I keep getting the following error (even after making a number of changes): > XML error: not well-formed at line 16 > > And I'm not sure how to troubleshoot this problem. > > I'm assuming that it is referring to line 16 on the XML file, in this case: > http://cupe.ca/xml/cupenews.rdf > > My parsing definitions are as follows >$itemTitleKey = "^rdf^item^title"; >$itemLinkKey = "^rdf^item^link"; >$itemDescKey = "^rdf^item^description"; > > Any help would be appreciated. > > Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP & XML Parsing
Hello, In looking for a good script to parse XML files I stumbled across the following tutorial (which looks very good): http://www.wirelessdevnet.com/channels/wap/features/xmlcast_php.html I have set this script up here: http://www.airdiv-cupe.org/portal/newsfeed_new_parser.php and I keep getting the following error (even after making a number of changes): XML error: not well-formed at line 16 And I'm not sure how to troubleshoot this problem. I'm assuming that it is referring to line 16 on the XML file, in this case: http://cupe.ca/xml/cupenews.rdf My parsing definitions are as follows $itemTitleKey = "^rdf^item^title"; $itemLinkKey = "^rdf^item^link"; $itemDescKey = "^rdf^item^description"; Any help would be appreciated. Mike -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Featured Client: http://halifaxinitiative.org A good life is one inspired by love and guided by knowledge - B. Russell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP XML
does anybody know how to switch off entities resoving in PHP XML? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]