[PHP] Re: XML to Array
Hi, use https://github.com/theseer/fDOMDocument. You can install it over PEAR. You can use it like $xml = 'xmlroottest id=my_id /'; $dom = new fDOMDocument(); $dom-loadXML($xml); // get attribute $elementNode = $dom-queryOne('//test[@id=my_id]'); echo $elementNode-nodeValue; Greetings Carlos Medina Am 10.03.2013 11:47, schrieb Karl DeSaulniers: Hi Guys, I am hoping someone can guide me or help me fix this issue. I have been lost in the code for some time now. I am trying to get the attributes of an xml node. I have this code: function xml_parse_into_assoc($data) { $p = xml_parser_create(); if(stripos($data, http, 0) !== false) { if (!($fp = @ fopen($data, 'rb'))) { return array (); } while (!feof($fp)) { $xml .= fread($fp, 8192); } fclose($fp); } else if(stripos($data, ?, 0) !== false) { $xml .= $data; } xml_parser_set_option($p, XML_OPTION_TARGET_ENCODING, ISO-8859-1); //xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($p, $xml, $vals, $index); xml_parser_free($p); $levels = array(null); foreach ($vals as $val) { if ($val['type'] == 'open' || $val['type'] == 'complete') { if (!array_key_exists($val['level'], $levels)) { $levels[$val['level']] = array(); } } $prevLevel = $levels[$val['level'] - 1]; $parent = $prevLevel[sizeof($prevLevel)-1]; if ($val['type'] == 'open') { $val['children'] = array(); $val['attributes'] = array(); array_push($levels[$val['level']], $val); continue; } else if ($val['type'] == 'complete') { $parent['children'][$val['tag']] = $val['value']; } else if ($val['type'] == 'close') { $pop = array_pop($levels[$val['level']]); $tag = $pop['tag']; if ($parent) { if (!array_key_exists($tag, $parent['children'])) { $parent['children'][$tag] = $pop['children']; } else if (is_array($parent['children'][$tag])) { if(!isset($parent['children'][$tag][0])) { $oldSingle = $parent['children'][$tag]; $parent['children'][$tag] = null; $parent['children'][$tag][] = $oldSingle; } $parent['children'][$tag][] = $pop['children']; } else if (array_key_exists('attributes', $val)) { if (isset($val['value'])) { $parent['children'][$tag] = $val['value']; } foreach ($val['attributes'] as $key=$value) { $parent['children'][$tag][$key] = $value; } } } else { return(array($pop['tag'] = $pop['children'])); } } $prevLevel[sizeof($prevLevel)-1] = $parent; } } This is the part I am adding to try and acheive this. ... else if (array_key_exists('attributes', $val)) { if (isset($val['value'])) { $parent['children'][$tag] = $val['value']; } foreach ($val['attributes'] as $key=$value) { $parent['children'][$tag][$key] = $value; } } ... I do admit I haven't the foggiest idea what I am doing here, so I am noobing out here on how this php function is really working. I got it off php.net and am trying to implement it in my code. Without my addition it works well except it doesn't grab any attributes which I need in order for my script to work properly. Any ideas on what I am doing wrong? TIA, Best, Karl PS: please be gentle.. (: )) Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML enabled but not working
On 09/15/2011 01:20 PM, Matthew Pounsett wrote: I seems to behaving issues with php5 on one particular server, and I haven't been able to find the issue. Basically, php says XML is enabled, but xml functions are missing. php -i | grep XML support libXML support = active Perhaps you need to install libxml[2]? -- James Moe jmm-list at sohnen-moe dot com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML... Useful or another layer of complexity?
On 03/04/11 19:41, Jason Pruim wrote: So the subject says it all... And yes I know this isn't related to PHP but it's the weekend and I trust the opinions on this list more then any other list I have seen. I've been doing alot of reading on XML and honestly it looks pretty cool... BUT the question is... Is it truly useful or is it just another layer that we have to write? From what I can tell it looks like it could stabilize some of my programming in regards to databases, and possibly if I have to move information from one application to another. But is it worth the added coding or should I just interact with the pieces directly? Thoughts? Questions? Flames? :) Yes :) -- Peter Ford, Developer phone: 01580 89 fax: 01580 893399 Justcroft International Ltd. www.justcroft.com Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom Registered in England and Wales: 2297906 Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML DOM problem with getAttribute(string)
Thank you again for your help. I've popped the file to http://FileHost.JustFreeSpace.Com/157index.php . A typical file that'll be plugged into this template lives at http://FileHost.JustFreeSpace.Com/940index.htm . With thanks, Borden On 11/06/2008, Rob Richards [EMAIL PROTECTED] wrote: You might want to put a link to a complete example because $page-documentElement-getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); is how you access it. Rob [EMAIL PROTECTED] wrote: Thank you, Rob, Unfortunately, that didn't work, either (though I'll keep it in mind). The returned string is still empty. I also unsuccessfully fetched the 'xmlns' attribute using getAttribute(). Interestingly, although hasAttributes(void) returns true, hasAttribute('xmlns'), and hasAttribute(' xml:lang') both return false. On 11/06/2008, Rob Richards [EMAIL PROTECTED] wrote: Borden Rhodes wrote: I'm having a pig of a time trying to figure this one out: I have an XHTML document which I've loaded into a DOMDocument because I want to add more tags to it. However, since I live in a bilingual country, I want to get the document's xml:lang attribute so I know what language to add my new tags in. I want to write $lang = $page-documentElement-getAttribute('xml:lang'); OR $lang = $page-documentElement-getAttributeNS('xml', 'lang'); but both of these return empty strings, indicating that it cannot find the xml:lang attribute. And yet, $page-documentElement-hasAttributes() returns true and $page-documentElement-attributes-getNamedItem('xml:lang')-nodeValue; works correctly. So why doesn't my preferred code? The xml prefix is bound to the http://www.w3.org/XML/1998/namespace namespace. $lang = $page-documentElement-getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML DOM problem with getAttribute(string)
Borden Rhodes wrote: I'm having a pig of a time trying to figure this one out: I have an XHTML document which I've loaded into a DOMDocument because I want to add more tags to it. However, since I live in a bilingual country, I want to get the document's xml:lang attribute so I know what language to add my new tags in. I want to write $lang = $page-documentElement-getAttribute('xml:lang'); OR $lang = $page-documentElement-getAttributeNS('xml', 'lang'); but both of these return empty strings, indicating that it cannot find the xml:lang attribute. And yet, $page-documentElement-hasAttributes() returns true and $page-documentElement-attributes-getNamedItem('xml:lang')-nodeValue; works correctly. So why doesn't my preferred code? The xml prefix is bound to the http://www.w3.org/XML/1998/namespace namespace. $lang = $page-documentElement-getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML DOM problem with getAttribute(string)
Thank you, Rob, Unfortunately, that didn't work, either (though I'll keep it in mind). The returned string is still empty. I also unsuccessfully fetched the 'xmlns' attribute using getAttribute(). Interestingly, although hasAttributes(void) returns true, hasAttribute('xmlns'), and hasAttribute(' xml:lang') both return false. On 11/06/2008, Rob Richards [EMAIL PROTECTED] wrote: Borden Rhodes wrote: I'm having a pig of a time trying to figure this one out: I have an XHTML document which I've loaded into a DOMDocument because I want to add more tags to it. However, since I live in a bilingual country, I want to get the document's xml:lang attribute so I know what language to add my new tags in. I want to write $lang = $page-documentElement-getAttribute('xml:lang'); OR $lang = $page-documentElement-getAttributeNS('xml', 'lang'); but both of these return empty strings, indicating that it cannot find the xml:lang attribute. And yet, $page-documentElement-hasAttributes() returns true and $page-documentElement-attributes-getNamedItem('xml:lang')-nodeValue; works correctly. So why doesn't my preferred code? The xml prefix is bound to the http://www.w3.org/XML/1998/namespace namespace. $lang = $page-documentElement-getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML DOM problem with getAttribute(string)
You might want to put a link to a complete example because $page-documentElement-getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); is how you access it. Rob [EMAIL PROTECTED] wrote: Thank you, Rob, Unfortunately, that didn't work, either (though I'll keep it in mind). The returned string is still empty. I also unsuccessfully fetched the 'xmlns' attribute using getAttribute(). Interestingly, although hasAttributes(void) returns true, hasAttribute('xmlns'), and hasAttribute(' xml:lang') both return false. On 11/06/2008, Rob Richards [EMAIL PROTECTED] wrote: Borden Rhodes wrote: I'm having a pig of a time trying to figure this one out: I have an XHTML document which I've loaded into a DOMDocument because I want to add more tags to it. However, since I live in a bilingual country, I want to get the document's xml:lang attribute so I know what language to add my new tags in. I want to write $lang = $page-documentElement-getAttribute('xml:lang'); OR $lang = $page-documentElement-getAttributeNS('xml', 'lang'); but both of these return empty strings, indicating that it cannot find the xml:lang attribute. And yet, $page-documentElement-hasAttributes() returns true and $page-documentElement-attributes-getNamedItem('xml:lang')-nodeValue; works correctly. So why doesn't my preferred code? The xml prefix is bound to the http://www.w3.org/XML/1998/namespace namespace. $lang = $page-documentElement-getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML editors
16 aug 2007 kl. 13.12 skrev Colin Guthrie: Frank Arensmeier wrote: Although I am not able to give you any helping advice, I would like to know if there are any PHP based XML online - editors out there (that would allow me to edit XML files online so to say). One thing that poped up in my mind was Tiny MCE. Sure, it could be possible to customise Tiny MCE, but I think one of the most important drawbacks with Tiny MCE is that it is not working with all browsers. Since my site is based on a XML/PHP template engine, it would be very convenient to be able to edit XML files online (instead of editing XML files locally and uploading them to the server). Any ideas? I'd be interested to know this too. There are a few places I can think of where it would be quite a nice addition. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Maybe this could be a good idea for a project? I am sure that there are people who are interested in such an editor. //frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML editors
Frank Arensmeier wrote: Although I am not able to give you any helping advice, I would like to know if there are any PHP based XML online - editors out there (that would allow me to edit XML files online so to say). One thing that poped up in my mind was Tiny MCE. Sure, it could be possible to customise Tiny MCE, but I think one of the most important drawbacks with Tiny MCE is that it is not working with all browsers. Since my site is based on a XML/PHP template engine, it would be very convenient to be able to edit XML files online (instead of editing XML files locally and uploading them to the server). Any ideas? I'd be interested to know this too. There are a few places I can think of where it would be quite a nice addition. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML editors
Since posting this, I found what appears to be an excellent choice. http://xml-copy-editor.sourceforge.net/ Al wrote: What do you guys use for casual XML editing, besides plain text editors? Ones that'll error check and allow fixing files with errors? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Parsing simpleXML Arrays Question
Richard Luckhurst wrote: Hi List I have taken the advice of a number of people on the list and am back trying to write my XML parser using SimpleXML. I am having a problem and I believe the problem is my lack of understanding of arrays and simpleXML in spite of much google searching and manual reading. I would appreciate some help. The piece of XML I am parsing is as follows. I am working with a small section to see if I can get my head around it. ?xml version=1.0 encoding=UTF-8? ?ypsilon RNGSchema=fareResponse.rnc type=compact? fareResponse cntTarifs=122 offset=0 vcrSummary vcr minPrice=1667 maxPrice=1667 totalTarifs=1 currency=USDAA/vcr vcr minPrice=1374 maxPrice=4704 totalTarifs=2 currency=USDPR/vcr /vcrSummary /fareResponse If I use the following $file = test.xml; $data = simplexml_load_file($file); foreach ($data-vcrSummary as $vcrSummary) { var_dump($vcrSummary); } Then I get object(SimpleXMLElement)#5 (1) { [vcr]= array(2) { [0]= string(2) AA [1]= string(2) PR } } Which is pretty much what I would expect as there are 2 vcr tags. If I then use $file = test.xml; $data = simplexml_load_file($file); foreach($data as $vcrSummary) { $z = $vcrSummary-vcr; print $z \n; } I get 3 blank lines and then AA which is the first of the two vcr values. The examples I am looking at suggest I should have gotten both of the vcr values. Many of the examples I am looking at say to use echo instead of print, eg echo $vcrSummary-vcr; and that just gives me AA and not both values that I would expect. Can anyone point me in the right direction here. Regards, Richard Luckhurst Product Development Exodus Systems - Sydney, Australia. [EMAIL PROTECTED] ?php $string = XML ?xml version=1.0 encoding=UTF-8? ?ypsilon RNGSchema=fareResponse.rnc type=compact? fareResponse cntTarifs=122 offset=0 vcrSummary vcr minPrice=1667 maxPrice=1667 totalTarifs=1 currency=USDAA/vcr vcr minPrice=1374 maxPrice=4704 totalTarifs=2 currency=USDPR/vcr /vcrSummary /fareResponse XML; $xml = simplexml_load_string($string); echo VCR - 0\n; echo $xml-vcrSummary-vcr[0] .\n; echo Min Price: . $xml-vcrSummary-vcr[0]['minPrice'] .\n; echo \nVCR - 1\n; echo $xml-vcrSummary-vcr[1] .\n; echo Min Price: . $xml-vcrSummary-vcr[1]['minPrice'] .\n; /* Result: Result: VCR - 0 AA Min Price: 1667 VCR - 1 PR Min Price: 1374 */ ? -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML parser error ..
Delete the initial extra line in: $xml_data = EOF ?xml version=1.0? The XML Parser expects the XML document to start with a valid XML statement, which in your file is: ?xml version=1.0? but yours starts with an newline. $xml_data = EOF //newline ?xml version=1.0? onewaylife wrote: Hi all I am novice in XML. I have just started to creating PHP parser for XML files. I am using SAX. the file is : - html head basefont face=Arial /head body ?php // cdata handler function characterDataHandler($parser, $data) { echo $data . p; } // PI handler function PIHandler($parser, $target, $data) { // if php code, execute it if (strtolower($target) == php) { eval($data); } // otherwise just print it else { echo PI found: [$target] $data; } } // XML data $xml_data = EOF ?xml version=1.0? article headerinsert slug here/header bodyinsert body here/body footer?php print Copyright UNoHoo Inc, . date(Y, mktime()); ?/footer /article EOF; // initialize parser $xml_parser = xml_parser_create(); // set cdata handler xml_set_character_data_handler($xml_parser, characterDataHandler); // set PI handler xml_set_processing_instruction_handler($xml_parser, PIHandler); if (!xml_parse($xml_parser, $xml_data)) { die(XML parser error: . xml_error_string(xml_get_error_code($xml_parser))); } // all done, clean up! xml_parser_free($xml_parser); ? /body /html it give this output XML parser error: Reserved XML Name even i created two more php files but it give same message as out put. I am unable to understand why its come. Please help me out. onewaylife -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML
Add on : I got this error when i using xmldocfile() function to read the xml file , Warning: xmldocfile(): /home/gvintranet/datacraft/htdocs/uploads/test_cdata.xml:99: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): error: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): CData section not finished ù?¸ü÷úù?àù?Ø in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): InstanceName![CDATA[ù?¸ü÷úù?àù?ØZ4ÀÏ]]/I in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): ^ in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 weetat wrote: Hi all, I am using PHP 4.3.2 in Red Hat Entreprise. I have xml file which have tags as show below: HardwareVersion![CDATA[ù?¸€ü÷Œúù?àù?Ø€Z4À„Ï]]/HardwareVersion I need to lookup for Hardware Version tag in php ,and edit the value to empty string and save the modified xml file. Any one have any ideas how to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML
Hi all , Can I edit the xml file before doing xml parsing ? My xml file is around 16MB size. Anyone have any ideas how to do that? Thanks weetat wrote: Add on : I got this error when i using xmldocfile() function to read the xml file , Warning: xmldocfile(): /home/gvintranet/datacraft/htdocs/uploads/test_cdata.xml:99: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): error: in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): CData section not finished ù?¸ü÷úù?àù?Ø in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): InstanceName![CDATA[ù?¸ü÷úù?àù?ØZ4ÀÏ]]/I in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 Warning: xmldocfile(): ^ in /home/gvintranet/datacraft/htdocs/admin/test_writexml.php on line 6 weetat wrote: Hi all, I am using PHP 4.3.2 in Red Hat Entreprise. I have xml file which have tags as show below: HardwareVersion![CDATA[ù?¸€ü÷Œúù?àù?Ø€Z4À„Ï]]/HardwareVersion I need to lookup for Hardware Version tag in php ,and edit the value to empty string and save the modified xml file. Any one have any ideas how to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Session serializer - XMLDBX
Mark wrote: Well, last week or so I noticed that Squirrelmail's session array contained recursive variable references and caused my serializer to crash on infinite recursion. Oh well, that's life. I found the time to add a variable stack for encoding to XML. If a variable is is_ref or has a refcount greater than 1, the variable stack is searched for a previous occurrence. If the variable has not been seen previously, it is push onto the stack. If it has, only a reference ID of the previous variable is saved in the xml stream. is_ref and refcount are now added as attributes in the XML stream. Anyone want to lend a hand and test the serializer? Doh!! www.mohawksoft.org In the Code and Documentation section, click on CVS Access and follow the instructions for XMLDBX PHP Extension -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml
Andy Pieters wrote: Hi all I recently decided to switch to xml for the configuration of our programs. I am now looking for a good way to handle that xml data. Basically, what I am looking for is a functionality where I say Get tag x with attribute1=y, attribute2=z,..., read its contents and put it in an associative array. If you want that much granular detail then you might want to use XPATH. The syntax is obviously a little different than PCRE, but once you understand it you'll find it's much more efficient (and easier) than building monstrously large PCRE's. http://php.net/manual/en/function.dom-domxpath-query.php http://www.w3.org/TR/xpath#path-abbrev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML language for database schema definitions
Hello, on 04/27/2005 10:04 AM Nsk said the following: I am developing a PHP-implemented library which would allow a PHP programmer to write pre-defined data to a database. The library would be able to work with different database schemas and I need a way to inform the library with what kind of database schema it has to work with. I thought a good way to do that would be to describe the database schemas in XML. Because I don't want to write a new DTD just for this application, do you have any idea whether a database schema definition DTD already exists which allows XML documents to describe how a database is structured? That is an old idea introduced by Metabase in 1999: http://www.phpclasses.org/metabase -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Filters for illegal characters
Douglas 1 Jones wrote: Hello, I'm wondering if anyone knows of a filter that can take data to be wrapped in XML tags and filter this data encoding any illegal XML characters or, if they cannot be encoded, remove them. The problem I have is a database that contains text that must be wrapped in XML. Some of this text has illegal characters in it (probably copied from MS Word). Some of the characters that keep popping up are not very frequently used, so I'm hoping whatever filters get suggested, they can simply strip out these characters if they cannot encode them. thanks for your help. Perhaps I am misunderstanding your problem, so let me ask it another way. Is the problem that you are getting characters entered into the database that are encoded in one way (e.g. UTF-8) when you expected the characters to be encoded in another way (e.g. ISO-8859-1)? -- Teach a person to fish... Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html PHP Manual: http://php.net/manual/ php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Filters for illegal characters
Perhaps I am misunderstanding your problem, so let me ask it another way. Is the problem that you are getting characters entered into the database that are encoded in one way (e.g. UTF-8) when you expected the characters to be encoded in another way (e.g. ISO-8859-1)? No, the problem involves characters in the text that are Illegal XML characters much like is an Illegal XML character. Only, the one the character that my software is reporting as illegal is apparently not one that is caught by the normal filters (like htmlentities or even some functions specifically coded for XML that I found on the PHP.net website). I think the problem with the filters that I have tried is that they only attempt to change entities that are can be encoded to something XML safe. Ideally, what I want is something that just removes the offending character if it cannot make it safe for XML. So, say is made into amp; but an unexpected symbol is simply removed. For example (suppose ^ is a symbol that cannot be encode for this example): input: string output: stramp;ing input: str^ing output: string I hope this makes things clear. I think that a function just like htmlentities but one that just removes characters that are illegal but can not be fixed would be the ideal solution. If anyone needs further clarification, I would be happy to try to provide it. -- Doug Jones Co-Op Web Developer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML Filters for illegal characters
Jones, Douglas 1 wrote: I think that a function just like htmlentities but one that just removes characters that are illegal but can not be fixed would be the ideal solution. How do you define what can and cannot be fixed, though? You'd have to know the bad characters and in that case, a simple str_replace() is all you need. $bad_characters = array('^','*','#'); $text = str_replace($bad_characters,'',$text); $text = htmlentities($text); Or, since you don't really know what's bad then you'd want to define what's good. You could use get_html_translation_table() to find everything that htmlentities() will convert and then combine those characters, alphanumeric characters and whitespace into a preg_replace to match anything that's *not* one of those characters and erase it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML parser for PHP5
Matthew Sims wrote: Anyone know any good XML parsers that work with PHP5? Most of what I can find on freshmeat are still using PHP4 classes and Google isn't turning up much either. What do you want to do? This parses xml pretty well: ?php $parsed = simplexml_load_file('filename.xml'); ? as does this ?php $dom = new DOMDocument; $dom-load('filename.xml'); ? The first one is brilliant for reading xml whose structure you know, the second is better for xml whose structure you wish to manipulate or transform. best, it's built into PHP. If you want a system that can be easily serialized and unserialized as an object (as in sessions), you're probably best off using XML_Serializer from PEAR, as neither simplexml nor DOM retains any useful information when serialized and unserialized. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML parser for PHP5
Matthew Sims wrote: Anyone know any good XML parsers that work with PHP5? Most of what I can find on freshmeat are still using PHP4 classes and Google isn't turning up much either. What do you want to do? This parses xml pretty well: ?php $parsed = simplexml_load_file('filename.xml'); ? as does this ?php $dom = new DOMDocument; $dom-load('filename.xml'); ? The first one is brilliant for reading xml whose structure you know, the second is better for xml whose structure you wish to manipulate or transform. best, it's built into PHP. If you want a system that can be easily serialized and unserialized as an object (as in sessions), you're probably best off using XML_Serializer from PEAR, as neither simplexml nor DOM retains any useful information when serialized and unserialized. Greg My fault, I should have been more specific. An RSS reader. :) I was using xmlParser-0.3 and feedParser-0.5 to display news sites. Since I've converted to PHP5, they no longer work for me. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML parser for PHP5
Matthew Sims wrote: My fault, I should have been more specific. An RSS reader. :) I was using xmlParser-0.3 and feedParser-0.5 to display news sites. Since I've converted to PHP5, they no longer work for me. definitely a combination of simplexml and DOM would work. You need DOM in order to determine what the name of the root node's namespace is to find RSS 1.0. http://php.net/simplexml http://php.net/DOM for example: ?php $rss = simplexml_load_file('http://www.example.com/blah.rss'); $dom = new domdocument(1.0); $dom_rss = $dom-importnode($rss, true); $dom_rss = $dom-appendchild($rss); if ($dom_rss-namespaceURI == '') { $rssversion = '1.0'; } else { $rssversion = $rss['version']; } switch ($rssversion) { case '1.0' : case '2.0' : if (isset($rss-channel-pubDate)) { echo Publication Date: . $rss-channel-pubDate . br /; } case '0.91' : case '0.92' : case '0.93' : case '0.94' : echo 'a href='; echo $rss-channel-link; echo '' . $rss-channel-title . '/abr /'; foreach ($rss-channel-item as $item) { echo $item-title . 'br /'; echo 'a href='; echo $item-link; echo '' . $item-description . '/abr /'; } break; } ? Of course, the full range RSS tags are available to you as object properties, and attributes as array access (like $rss['version']) Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML parser for PHP5
Matthew Sims wrote: My fault, I should have been more specific. An RSS reader. :) I was using xmlParser-0.3 and feedParser-0.5 to display news sites. Since I've converted to PHP5, they no longer work for me. definitely a combination of simplexml and DOM would work. You need DOM in order to determine what the name of the root node's namespace is to find RSS 1.0. http://php.net/simplexml http://php.net/DOM for example: ?php $rss = simplexml_load_file('http://www.example.com/blah.rss'); $dom = new domdocument(1.0); $dom_rss = $dom-importnode($rss, true); $dom_rss = $dom-appendchild($rss); if ($dom_rss-namespaceURI == '') { $rssversion = '1.0'; } else { $rssversion = $rss['version']; } switch ($rssversion) { case '1.0' : case '2.0' : if (isset($rss-channel-pubDate)) { echo Publication Date: . $rss-channel-pubDate . br /; } case '0.91' : case '0.92' : case '0.93' : case '0.94' : echo 'a href='; echo $rss-channel-link; echo '' . $rss-channel-title . '/abr /'; foreach ($rss-channel-item as $item) { echo $item-title . 'br /'; echo 'a href='; echo $item-link; echo '' . $item-description . '/abr /'; } break; } ? Of course, the full range RSS tags are available to you as object properties, and attributes as array access (like $rss['version']) Greg Very nice, thank you. This should get my feet wet with a little XML. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml tags interfere with php tags
Josh Close wrote: How do I get an xml tag to work with a php script? ?xml version=1.0? php is trying to parse that. -Josh turn OFF short_open_tag in php.ini, or using the PHP_FLAG short_open_tag Off in your apache .htaccess file (if you're using that). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml tags interfere with php tags
Just do it like this: ?php echo '?xml version=1.0?'; ? Josh Close wrote: How do I get an xml tag to work with a php script? ?xml version=1.0? php is trying to parse that. -Josh -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- PGP Key ID: 0x3968B5EE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: xml tags interfere with php tags
From: M. Sokolewicz [EMAIL PROTECTED] Josh Close wrote: How do I get an xml tag to work with a php script? ?xml version=1.0? php is trying to parse that. -Josh turn OFF short_open_tag in php.ini, or using the PHP_FLAG short_open_tag Off in your apache .htaccess file (if you're using that). or echo '?xml version=1.0?'; or ?='?=xml version=1.0?'? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: xml tags interfere with php tags
?='?xml version=1.0?'? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML session
Miguel Manso wrote: Hi. I'm trying to create a session support where i can keep persistent objects. I'm using XML to structure the data in the session file. But i've come into a problem. When i execute the following code the (--) marked instruction simply breaks the function execution: $sess = $xml-documentElement; --$sessIdElem = $xml-createElement(session_id()); $sessVarsElem = $xml-createElement(vars); $sessVarsNode = $sessIdElem-appendChild($sessVarsElem); $sess-appendChild($sessIdElem); In the HTML output i get the following error: Exception thrown without a stack frame in Unknown on line 0 I read the docs on createElement and it doesn't throw exectpions... Can anyone tell me waht i'm doing wrong? Thanks! Forgot to say that this code is executed on the __destruct() function of a class. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML validation with XML Schema
Matias Bagini matiasb at netlabs.com.ar writes: Is there any way to validate an XML with XML Schema using PHP4... I need something like the bool DOMDocument-schemaValidate ( string filename) that exists on PHP5 Thanks, Matias. I use an external validator called XSV. It's the official W3C validator, i guess... http://www.ltg.ed.ac.uk/~ht/xsv-status.html You'll just have to develop a little script to access it. This validator is quite useful, because he sends you back an xml log for each validation. That log describes each error. Ace -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Cdata problem
Forget myt post, its a stupid error from my part because of object references and stuff like that. I'll fix it myself. Mathieu Dumoulin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] PHP 4.3.7 on Linux Red Hat 7.3 full patch and updates, Expat expat_1.95.2 Problem: I am reading the XML file below and at path: advantage/route/origin/status/ The CDATA inside the STATUS node cannot be read (Current value 1900), there isnt much information on how to use the EXPAT library on PHP.Net apart from the extensive definition of all functions so i'm not sure im using EXPAT the correct way. Please tell me if im doing something wrong, here is my code and the XML file is further below: * PHP CODE * //Load the XML like it was a XML reponse $xml = implode('', file('xml.xml')); echo 'PRE'.str_replace(array('', ''), array('lt;', 'gt;'), $xml).'/PRE'; /*For now all objects are empty shells without data in them, the XML parser will link everything together nicely and will add the CDATA for objects if there is some. Later we will add the standard options to each class and create functions for output.*/ //Contains an advantage server response, very basic object with only one thing below class advantage_node { function advantage_response() {} } //Contains an advantage server data representing a route class route_node { function route_node() {} } //Contains an advantage server data representing a parsed input data from the server class origin_node { function origin_node() {} } //Contains an advantage server data representing a status class status_node { function status_node() {} } //Contains an advantage server data representing a location class location_node { function location_node() {} } //Contains an advantage server data representing a number class number_node { function number_node() {} } //In charge of making the object tree and handling first level objects function xml_to_class_tag_start($parser, $element, $attributes){ $element_class = $element.'_node'; if(class_exists($element_class) isset($GLOBALS['element_levels'][$GLOBALS['element_level']-1])){ $new_element = new $element_class; if(is_array($attributes)){ foreach($attributes as $attribute = $value){ $new_element-$attribute = $value; }} if($GLOBALS['element_level']-1 = 0){ $GLOBALS['element_levels'][$GLOBALS['element_level']-1]-$element = $new_element; } $GLOBALS['element_levels'][$GLOBALS['element_level']] = $new_element; } ++$GLOBALS['element_level']; } //In charge of closing the current object and rolling back to the previous one function xml_to_class_tag_end($parser, $element){ if($GLOBALS['element_level'] 1){ unset($GLOBALS['element_levels'][$GLOBALS['element_level']]); } $GLOBALS['element_level']--; } function xml_to_class_tag_data($parser, $data){ if(trim($data) != ''){ $GLOBALS['element_levels'][$GLOBALS['element_level']]-cdata = $data; } } //Setup the objects $element_level = 0; $element_levels = array(-1 = ''); //Start the XML parsing $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); xml_set_element_handler($parser, 'xml_to_class_tag_start', 'xml_to_class_tag_end'); xml_set_character_data_handler($parser, 'xml_to_class_tag_data'); xml_parse($parser, $xml); xml_parser_free($parser); //Output echo 'pre'.print_r($element_levels[0], true).'/pre'; * RESULT *advantage_node Object ( [ROUTE] = route_node Object ( [STATUS] = 0 [ORIGIN] = origin_node Object ( [COUNT] = 1 [STATUS] = status_node Object ( ) [LOCATION] = location_node Object ( [NUMBER] = number_node Object ( ) ) ) ) ) * XML DATA * advantage - route status=0 - parameters clientId[protected]/clientId destcountryca/destcountry destpostalcodeh1p 2w8/destpostalcode origcountryca/origcountry origpostalcodeh1z 2l2/origpostalcode transactionroute/transaction /parameters - input - origin count=1 - location postalCodeh1z 2l2/postalCode countryca/country /location /origin - destination count=1 - location postalCodeh1p 2w8/postalCode countryca/country /location /destination /input - origin count=1 status1900/status - location number1/number cityMONTREAL/city stateProvinceQC/stateProvince postalCodeH1Z 2L2/postalCode countryCA/country
[PHP] Re: xml - xslt - xsl:fo - pdf
Hi I'm afraid I don't know anything about the xml/xsl:fo part of the process but once you have the data in a usable form in your program you can use PDFLIB functions to create a pdf from it. I have used it very successfully. It does involve compiling libraries and you may well have to pay a license fee (although there are free but more complex options). The following page gives info and links: http://uk2.php.net/pdf regards Hilary Boyce On 24 May 2004 at 18:53, juan vazquez wrote: Hi, I am trying to transform a xsl:fo file to pdf. I generate xml files from mysql and I can convert them to xsl:fo using xslt but I can't find information for the last step (XSL:FO to PDF) I just know that a formatter is needed but all what I found where java, jade or .net based solutions. is there any 100% php solution for this problem?. Environment: Apache 2.0.47, PHP 4.3.2, mysql 4.0.13 running on WXP Thanks a lot in advance for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml posts
Hello, On 02/04/2004 12:59 PM, Diana Castillo wrote: does anyone know why some xml applications that work when sent with active-x objects dont work when I send the xml with php instead? what can I do to make them arrive in the same way as they do when sent with active-x objects? What are you talking about? Do you mean sending HTTP requests with XML data? If so, try this class: http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML to PDF with XSL
If this is Possible, Please Tell me, i'm also very interested in this. Or if you know any method to 'find and replace' a string in a PDF file please also tell me e.g, i want to replace all occurnces of [name] with John From a PDF file on the server, when i open it ofcourse it won't have [name] as name, it encodes it. Regards Aidan Lister [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is this possible? I'm purely interested in PHP5 examples of transforming an XML file into PDF using an XSL stylesheet. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML?
Hi there, Jake, On 9 Jan 2004 at 2:30, Jake McHenry wrote: Can someone point me in the right direction towards creating and implementing XML with php? I've heard it can make things much easier on me, and would like more info on it. Also, if anyone has any storys from using it, might give me an idea of what I'm getting into. Is it easy to implement? Does it make things easier on me in the future? Etc.etc. First of all, please tell us what use you think you might have for XML. XML can be used in several different ways for several different things, but of course it's completely useless for several other things. Your question about whether or not XML is easy to implement cannot be answered if we don't know what you might be trying to implement. XML is a fairly complex technology that takes some studying; that much I can tell you right now. Cheers, Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML?
Hello, On 01/09/2004 05:30 AM, Jake McHenry wrote: Hi everyone, Can someone point me in the right direction towards creating and implementing XML with php? I've heard it can make things much easier on me, and would like more info on it. Also, if anyone has any storys from using it, might give me an idea of what I'm getting into. Is it easy to implement? Does it make things easier on me in the future? Etc.etc. It depends on what you want to do. XML can be a means of many thing, not an end in itself. Once you realize what XML can be good for you, you may want to try this XML generation class that can make your life much easier: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML/HTML encoding?
Hello, On 01/09/2004 01:23 PM, Vincent Jansen wrote: I'm doing some XML processing with PHP5 I'm using UTF-8 encoding When I look at my xml doc it looks something like ?xml version=1.0 ? doc textdotted e (ë) works/text /doc (I hope you see a dotted e) After xslt I end up with a html document with a souce that looks something like ?xml version=1.0 encoding=UTF-8 standalone=yes? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd; html head titledotted e (ë) works/title /head body Etc. This is what I want But my browser displays dotted e () works Because I don't want yes or no: Please tell me what (maybe obvious thing) I'm doing wrong To use it as you have you need to specify ISO-8859-1 as encoding in the XML input document. -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML/HTML encoding?
Hello Vincent, On 9 Jan 2004 at 16:23, Vincent Jansen wrote: After xslt I end up with a html document with a souce that looks something like ?xml version=1.0 encoding=UTF-8 standalone=yes? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/REC-html40/loose.dtd; html head titledotted e (ë) works/title /head body Etc. This is what I want But my browser displays dotted e () works Because I don't want yes or no: Please tell me what (maybe obvious thing) I'm doing wrong I don't think you're doing anything wrong, except perhaps for using an outdated browser. The ë (e-umlaut, which you called a dotted e) displays just fine in both IE 6 and Netscape 7.1 on my computer. Make sure your browser is configured to use Western European (ISO-8859-1) encoding, because even latest-generation browsers have poor support for UTF-8. To change your browser's encoding settings, do: In IE 6: View Encoding In Netscape: View Character Coding Any other browser: figure it out yourself ;-) Take care, Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Strategdy
Try Krysalis (http://www.interakt.ro/products/Krysalis/) if you're trying something more complex. It's a PHP/XML platform. If you want simple stuff (just generate XML's), I recomend doing for yourself a custom class/function for it. Here is a code sample: psql:execute-query connection=krysalis psql:query select * from department_dep inner join employee_emp on iddep_emp = id_dep order by id_dep /psql:query psql:results psql:row-results department idpsql:get-string column=id_dep//id namepsql:get-string column=name_dep//name !-- get the employees for the same department-- psql:row-results field=id_dep employee idpsql:get-string column=id_emp//id namepsql:get-string column=name_emp//name /employee /psql:row-results /department /psql:row-results /psql:results /psql:execute-query Mark Roberts [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am about to embark on a project that requires me to access several mysql files (customer order entry), gather the information and output an XML formatted file that will be used as an input file to another accounting application. Question is this. As a seasoned developer, my natural instinct is to just write a script(s) to access all the information that I need and write the appropriate information out to the file. Is there a better way to do this? Is there some type of application that has been developed that will take a select statement as input and automatically generate XML output? Just courious...any suggestions, thoughts, comments? Thanks. Mark Roberts, Roberts Computing Systems Webmaster Services $29.50/mo mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Strategdy
Hello, On 12/11/2003 12:57 PM, Mark Roberts wrote: I am about to embark on a project that requires me to access several mysql files (customer order entry), gather the information and output an XML formatted file that will be used as an input file to another accounting application. Question is this. As a seasoned developer, my natural instinct is to just write a script(s) to access all the information that I need and write the appropriate information out to the file. Is there a better way to do this? Is there some type of application that has been developed that will take a select statement as input and automatically generate XML output? That depends on how you query your database. There are classes for what you want that use different database API. Here you can find several of them: http://www.phpclasses.org/browse.html/class/4.html For generating generic XML with whatever data you retrieve, you may want to try this class: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-03 kl. 11.18 skrev Victor Spng Arthursson: Temporarely solved the problem using substring to trim the crap-chars away, but I'ld prefer to solve it in a more beautiful way, but perhaps this behaviour is a bug and therefore not possible to solve in any other way But do we think it works when uploaded to the production server? No It runs php on Wintendo though, but shouldn't make any difference - should it? 2 days just to apply a xsl-stylesheet on a xml file!? :( If anyone successfully has succeeded doing this, please give me some hints. Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
Here is the error message, that the code produces: http://tosti.dk/xml/error.php And here is a copy of the code: http://tosti.dk/xml/error.txt I really cant figure what is wrong, especially not since it works on the dev-server and the outputted xml is valid, at least as far as IE concerns Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-02 kl. 12.23 skrev Manuel Lemos: You just need to use the proper input/output encodings. Doesn't work at all The code // Prepare the content of the xml-file to go to the xsl-parser $xml = str_replace(?, chr(63), $contents); $xml = str_replace(empty/, $kurt, $xml); $xml = trim($xml); $xml = utf8_encode($xml); echo $xml; makes the string ?xml version=1.0 encoding=utf-8? become ?xml version=1.0 encoding=utf-8? And the crap in fron of the string, which seems to come from nowhere, makes the parser complain about not well formed markup in the xml-source Regards, Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-02 kl. 22.08 skrev Manuel Lemos: The code // Prepare the content of the xml-file to go to the xsl-parser $xml = str_replace(empty/, $tempxml, $xml); $xml = trim($xml); $xml = utf8_encode($xml); echo $xml; makes the string ?xml version=1.0 encoding=utf-8? become ?xml version=1.0 encoding=utf-8? And the crap in fron of the string, which seems to come from nowhere, makes the parser complain about not well formed markup in the xml-source I think it does not make any sense to do what you are doing. You should only encode XML data or attribute values. You should not encode the whole XML document. Well, I have some xml in which I want to place som new xml-data, just for the specific output, which I does by replacing an empty dummy-tag. After this, I want to send the xml to the parser. Anyway, if you try this class, you can see that it generates correct XML code in UTF or even ISO-8859-1. Well, but I don't want to download and evaluate classes, especially since they tend to be big and I just want to be able to do this with the few lines of code that should be enought Should it really be this troublesome working with XML from PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-03 kl. 10.22 skrev Victor Spng Arthursson: makes the string ?xml version=1.0 encoding=utf-8? become ?xml version=1.0 encoding=utf-8? Temporarely solved the problem using substring to trim the crap-chars away, but I'ld prefer to solve it in a more beautiful way, but perhaps this behaviour is a bug and therefore not possible to solve in any other way Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML, strings and foreign (swedish/danish) characters
Hello, On 12/02/2003 09:05 AM, Victor spng arthursson wrote: I'm on the point of almost giving up trying to get XML and PHP to sing along, but I'll throw out a question here first. I'm having severe problems getting PHP and XML to work with XML-files that contains foreign characters. Doesnt matter if i type the foreign characters in by myself hardcoded in the PHP-script, or if I get them from external XML-files, or if I get them directly from the database. utf8_encode() helps a bit, in the way that it makes the script work at least, but instead of the string mngde PHP outputs mngde Is there any way to get XML to work together with PHP, or should I simply resign and try with ASP instead? You just need to use the proper input/output encodings. PHP function usually assume iso-8859-1 . I do not know if that is the encoding that your idiom uses. Anyway, you may want to try these XML parser and writer classes: http://www.phpclasses.org/xmlparser http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml parser und bestehende variablen - multilinguale app
If you want that all the users will be able to help you, please post in English. Lucian Merlin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hallo zusammen, ich möchte gerne meine bestehende app in mehreren Sprachen anbieten. Dazu habe ich mir ein xml parser package installiert welches in der Lage ist aus xml dateien inhalte einzufügen. Zum Bsp sieht das xml file so aus: enexample/en debeispiel/de Das funktioniert so weit. Das PROBLEM allerdings is, wenn ich eine varible innerhalb dieses textes habe und nicht alles zerstückeln möchte, parst php diese inhalte nicht. Beispiel: $no = 10; enexample '.$no.'/en debeispiel '.$no.'/de In diesem Fall bekommt man den Inhalt der Variable nicht angegeben, sondern einfahc den '.$no.' string. Was kann man da tun? Ich kann unmöglich alle texte aufsplitten. Das auslagern in eine xml datei ist ganz praktisch vor allem wenn es mehrere Sprachen werden. Hat hier jemand einen guten Tipp? vielen Dank im voraus, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML and PHP
http://www.zend.com/zend/art/parsing.php http://www.zend.com/zend/tut/tutbarlach.php in fact a google search for php,xml, expat, tutorial pete Victor spång arthursson wrote: Hi! I've been looking at the XML-parserfunctions in the manual, and they seems nice enough. But I'm currently in a project where there is need to read from, write to and edit in XML-files, in some smart way. Our ISP is supporting the following: xml XML Support active XML Namespace Support active EXPAT Version 1.95.6 I suppose the answer to my questions lies in the expath-part, but where do I start, where can I read more about the above expat and which is the best approach for me in this project? We're going to import som data from Navision, XML-formatted, to postgresql, and meanwhile documents are edited they are, until finished, going to be saved as xml-documents on the server. Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML and PHP
2003-11-06 kl. 13.42 skrev pete M: http://www.zend.com/zend/art/parsing.php http://www.zend.com/zend/tut/tutbarlach.php in fact a google search for php,xml, expat, tutorial Well, interesting articles but not really what I was searching for. I'm rather looking for something like the parser in Flash, which can open nodes like parent.nextsiebling.nextsibling Anyone have an idea? Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML and PHP
Victor Spng Arthursson wrote: 2003-11-06 kl. 13.42 skrev pete M: http://www.zend.com/zend/art/parsing.php http://www.zend.com/zend/tut/tutbarlach.php in fact a google search for php,xml, expat, tutorial Well, interesting articles but not really what I was searching for. I'm rather looking for something like the parser in Flash, which can open nodes like parent.nextsiebling.nextsibling Lest you forget, this is a PHP not Flash list. For your parent.sibling lookups, you will need domxml enabled on your php setup. Then you can search for domxml php tutorials on google (check the manual first). -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com --- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML/MySQL
Thanks to everyone who has responded. I have a lot of useful suggestions, and a warm feeling about this newsgroup ;-). I hope I can be of help to everyone in the future. cheers ian Ian Williams [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Apologies to anyone also subscribed to php.xml.dev, who will have read this earlier, but it doesn't seem as frequently read as this news group... so I am reposting... Hi I want to write a function that will take any SQL query as a parameter, and generate XML that represents the recordset. e.g. SELECT * FROM Customers returns: recordset record id=1 name=Mr Smith purchases=2/ record id=2 name=Mr Jones purchases=25/ record id=3 name=Mr Davis purchases=7/ /recordset There are two approaches I think. One is to use the XML DOM, the other is simply to join lots of strings together. What is the best approach? Thanks (and this is my first post to a newsgroup, and my first post to this one, so excuse me if I've missed something vital!) cheers ian ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML/MySQL
Hello, On 10/26/2003 06:08 PM, Ian Williams wrote: I want to write a function that will take any SQL query as a parameter, and generate XML that represents the recordset. e.g. SELECT * FROM Customers returns: recordset record id=1 name=Mr Smith purchases=2/ record id=2 name=Mr Jones purchases=25/ record id=3 name=Mr Davis purchases=7/ /recordset There are two approaches I think. One is to use the XML DOM, the other is simply to join lots of strings together. What is the best approach? Thank is a common problem with solutions from several people. You may find some here: http://www.phpclasses.org/search.html?words=xml+mysqlrestrict=Cgo_search=1 -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML / XLS application
On Fri, 10 Oct 2003 18:09:18 -0400, [EMAIL PROTECTED] wrote: Hello mailing list, I have a question about the use of XML / XLS application, I am introducing myself in this technology, What is useful XML / XLS for? XML - data storage XLS - language to display define how to display XML. HTML - XML with pre-defined XLST. Curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML handlers in classes
Hi, Use xml_set_object, and away you go. Perhaps you would benefit from using PEAR's XML_Parser or XML_Transformer, or even PEAR's HTTP_Request class. http://php.net/xml_set_object http://pear.php.net/xml_parser http://pear.php.net/xml_transformer http://pear.php.net/http_request Regards, Greg -- phpDocumentor http://www.phpdoc.org Robert Fitzpatrick wrote: I have a class that receives an XML response from a HTTP request and I am trying to parse the XML after receiving it. The problem I'm having is the error when trying to use xml set handlers, such as 'xml_set_element_handler'. It seems the class is having trouble seeing the handler functions. For instance, if I set this: xml_set_element_handler($xml_parser, 'startElement','endElement'); Then I receive the error 'Unable to call handler startElement()', I tried to put $this- in front of the names of the functions, but same thing. Can someone show me how to use these handlers in a class? -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: XML handlers in classes
Use xml_set_object, and away you go. Perhaps you would benefit from using PEAR's XML_Parser or XML_Transformer, or even PEAR's HTTP_Request class. http://php.net/xml_set_object http://pear.php.net/xml_parser http://pear.php.net/xml_transformer http://pear.php.net/http_request Thanks for the tip. Is there any reason why I can't find docs for xml_parser or http_request on the PEAR site? -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML handlers in classes
Hi Robert, Yes there is a very stupid reason: no one has written any. Go to http://phpdorks.net/docs/api/pear/HTTP/HTTP_Request.html http://phpdorks.net/docs/api/pear/PEAR/XML_Parser.html for documentation generated from the source by phpDocumentor Regards, Greg -- phpDocumentor http://www.phpdoc.org Robert Fitzpatrick wrote: Use xml_set_object, and away you go. Perhaps you would benefit from using PEAR's XML_Parser or XML_Transformer, or even PEAR's HTTP_Request class. http://php.net/xml_set_object http://pear.php.net/xml_parser http://pear.php.net/xml_transformer http://pear.php.net/http_request Thanks for the tip. Is there any reason why I can't find docs for xml_parser or http_request on the PEAR site? -- Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Array
Michael == Michael Smith [EMAIL PROTECTED] writes: Michael Hey, I'm looking for a function to take an XML file and Michael turn it into a PHP array with the same structure. here's something that I found on the internet a few months back. I've used it a number of times: C U TH E R E C U TH E R E C U TH E R E /* xmlize() is by Hans Anderson, [EMAIL PROTECTED] * * Ye Ole Feel Free To Use it However License [PHP, BSD, GPL]. * some code in xml_depth is based on code written by other PHPers * as well as one Perl script. Poor programming practice and organization * on my part is to blame for the credit these people aren't receiving. * None of the code was copyrighted, though. * * This is a stable release, 1.0. I don't foresee any changes, but you * might check http://www.hansanderson.com/php/xml/ to see * * usage: $xml = xmlize($array); * * See the function traverse_xmlize() for information about the * structure of the array, it's much easier to explain by showing you. * Be aware that the array is somewhat tricky. I use xmlize all the time, * but still need to use traverse_xmlize quite often to show me the structure! * */ function xmlize($data, $WHITE=1) { $data = trim($data); $vals = $index = $array = array(); $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE); xml_parse_into_struct($parser, $data, $vals, $index); xml_parser_free($parser); $i = 0; $tagname = $vals[$i]['tag']; if ( isset ($vals[$i]['attributes'] ) ) { $array[$tagname]['@'] = $vals[$i]['attributes']; } else { $array[$tagname]['@'] = array(); } $array[$tagname][#] = xml_depth($vals, $i); return $array; } /* * * You don't need to do anything with this function, it's called by * xmlize. It's a recursive function, calling itself as it goes deeper * into the xml levels. If you make any improvements, please let me know. * * */ function xml_depth($vals, $i) { $children = array(); if ( isset($vals[$i]['value']) ) { array_push($children, $vals[$i]['value']); } while (++$i count($vals)) { switch ($vals[$i]['type']) { case 'open': if ( isset ( $vals[$i]['tag'] ) ) { $tagname = $vals[$i]['tag']; } else { $tagname = ''; } if ( isset ( $children[$tagname] ) ) { $size = sizeof($children[$tagname]); } else { $size = 0; } if ( isset ( $vals[$i]['attributes'] ) ) { $children[$tagname][$size]['@'] = $vals[$i][attributes]; } $children[$tagname][$size]['#'] = xml_depth($vals, $i); break; case 'cdata': array_push($children, $vals[$i]['value']); break; case 'complete': $tagname = $vals[$i]['tag']; if( isset ($children[$tagname]) ) { $size = sizeof($children[$tagname]); } else { $size = 0; } if( isset ( $vals[$i]['value'] ) ) { $children[$tagname][$size][#] = $vals[$i]['value']; } else { $children[$tagname][$size][#] = ''; } if ( isset ($vals[$i]['attributes']) ) { $children[$tagname][$size]['@'] = $vals[$i]['attributes']; } break; case 'close': return $children; break; } } return $children; } /* function by [EMAIL PROTECTED], a HUGE help! * * this helps you understand the structure of the array xmlize() outputs * * usage: * traverse_xmlize($xml, 'xml_'); * print 'pre' . implode(, $traverse_array . '/pre'; * * */ function traverse_xmlize($array, $arrName = array, $level = 0) { foreach($array as $key=$val) { if ( is_array($val) ) { traverse_xmlize($val, $arrName . [ . $key . ], $level + 1); } else { $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = ' . $val . \\n; } } return 1; } -- Flowers of morning glory. +-+ The sky above this street |donate to causes I care about: | Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25 | --Sugita+-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Array
Lee == Lee Doolan [EMAIL PROTECTED] writes: Michael == Michael Smith [EMAIL PROTECTED] writes: Michael Hey, I'm looking for a function to take an XML file and Michael turn it into a PHP array with the same structure. Lee here's something that I found on the internet a few months Lee back. here I am following up my own post yet again.. I forgot to include an example of use. here's a little snippet that uses xmlize(): ## probably actually should use join here. I guess I was too concerned ## about the whitespace $xData=; while (list($k, $v)= each($xml)) { $xData .= trim($v); } ## turn the XML into an array $ary= xmlize($xData); ## split into several different arrays depending on donation amount $hofTable= $ary['patronHofTable']['#']['tableData']['0']['#']['hofTableEntry']; $platinumAry= $goldAry= $silverAry= $insiderAry= array(); if (!isset($hofTable['0']['#']['text'])) { foreach($hofTable as $hofkey = $hofVal) { $entry= $hofVal['#']['Data']['0']['#']; if ($entry 999) { $platinumAry[]= $hofVal; } else if ($entry 499) { $goldAry[]= $hofVal; } else if ($entry 99) { $silverAry[]= $hofVal; } else { $insiderAry[]= $hofVal; } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ?xml version=1.0 encoding=UTF-8
I believe this is because the PHP engine thinks that the ?xml is a PHP opening tag. 1. Turn off short PHP tags (short_open_tag in php.ini) -OR- 2. Use this instead: ?php echo '?xml version=1.0 encoding=UTF-8?'; ? Joseph Doug Essinger-Hileman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] When I include ?xml version=1.0 encoding=UTF-8? in my html code, I get a parse error. The version is 4.1.2; phpinfo() reports that XML support is turned on. Can anyone help with this? Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: xml parse error?
I might be mistaken but what you are getting is the normalized whitespaces inbetween your nodes, which is considered to be their content. Example: ... test test2/ /test Will return the following dom: test | --- / | \ #text test2 #text Stefan Langer
Re: [PHP] Re: XML+XSLT or Smarty again??
This xml+html+xslt paradigm provides great separation, especially when viewed in light of the traditional xslt=html+code method. I've used it with good success. http://www.xml.com/pub/a/2000/07/26/xslt/xsltstyle.html HTH. Pete. -- Pusher http://www.shaman.ca/pusher A news aggregator with email notification. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML+XSLT or Smarty again??
Pete James [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This xml+html+xslt paradigm provides great separation, especially when viewed in light of the traditional xslt=html+code method. I've used it with good success. This does relieve the problem of dirty templates, but with some costs in inreased complexity. With TT you would have less things to do to achieve similar, but I assume that in the end it is largely a matter of taste and/or preferences. Sincerely, rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML+XSLT or Smarty again??
Pete James [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This xml+html+xslt paradigm provides great separation, especially when viewed in light of the traditional xslt=html+code method. I've used it with good success. This does relieve the problem of dirty templates, but with some costs in inreased complexity. With TT you would have less things to do to achieve similar, but I assume that in the end it is largely a matter of taste and/or preferences. Sincerely, rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML+XSLT or Smarty again??
Hi, From my point of view, XML+XSLT increases complexity with very less number of advantages. Fundamental of using XML+XSLT with PHP is to seperate HTML code from the PHP and database code. But in the following article, it shows XSL stylesheet comes with full of logic. Do we really need this approach?? At this time i think smarty is separating the presentation from logic in the best manner. Please correct me if i am wrong. THanks Hardik --- rush [EMAIL PROTECTED] wrote: Pete James [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This xml+html+xslt paradigm provides great separation, especially when viewed in light of the traditional xslt=html+code method. I've used it with good success. __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML+XSLT or Smarty again??
IMO, Smarty is just an abstraction of PHP. Smarty templates are HTML templates, but they still contain their own application logic for looping, etc, and so are still not a real separation (or are *dirty*, as 'rush' calls it). XML+HTML+XSLT (or Template Tamer from what I can gather) take it the extra step. The application logic in PHP generates an XML data stream, which contains no dependencies on output. It is simply data. The XSLT parser parses the HTML template (which contains _only_ HTML and placeholders), and when it encounters a placeholder it executes the relevant XSLT code. This way, the design department can design the HTML fully, without having to learn PHP, Smarty, or any other syntax. They just put in placeholder tags wherever information from the XML file is needed. There are drawbacks to every abstraction, and templating is no different. Smarty templates are fast, and are enjoyed by a large user base for their relative simplicity. XML, XSLT, etc are complex and verbose, but provide for maximum abstraction. Template Tamer sounds like it combines the best from both (from what I've heard here). It is a matter of taste, I suppose. I think that people may sometimes waste more time trying to maximize the division between presentation and logic than it's worth. Well written PHP scripts can be almost as good a template as any (by separating the HTML and just using embedded variables). HTH, Pete. -- Pusher http://www.shaman.ca/pusher A news aggregator with email notification. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: XML+XSLT or Smarty again??
wow thanks ! i've been looking for some example like this for a very long time , does it mean that the templates becomes similar to the template block ? -Original Message- From: Pete James [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 2:08 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: XML+XSLT or Smarty again?? This xml+html+xslt paradigm provides great separation, especially when viewed in light of the traditional xslt=html+code method. I've used it with good success. http://www.xml.com/pub/a/2000/07/26/xslt/xsltstyle.html HTH. Pete. -- Pusher http://www.shaman.ca/pusher A news aggregator with email notification. -- 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
Re: [PHP] Re: XML+XSLT or Smarty again??
Hello Ok can't refrain from giving my opinion to this one. First of all I think separating presentation from business logic can be achived fairly simple with SMARTY and if your template code acutally contains business logic than you have not understood the concept of the template engine. The only logic that should be included in the template is the presentation logic. This is clearly stated in the docs and on the website. Removing logic from presentation is not possible in my opinion. Basically you always have to have someway of specifiing if something is to be shown or not. SO you basically just remove a complex programming structure and replace it with a somewhat less complex custom template declaration such as if else constructs etc... Also Smarty allows you to build custom tags to include logic into template without programming making it fairly easy to include businesslogic without introducing code. About XSLT as a templating mechanism. I just think it's more complicated and until every browser supports XSLT on the client side I don't see how it improves performance over a custom performance optimized templateengine such as SMARTY. Not to forget that the logic in an XsLT Stylesheet seems as complicated if not more complicated than building customized php code. But then again this is just my opinion. About Templatetamer, didn't have too much time to look at it but I don't like the fact, at least that is the impression I got from your website, that I have to use your tool to create templates. I have my own set of tools and I'd like to stick with them. So editing templates should be as easy as opening your favourite editor. So there is no real pro or con. Every situation has their advantage but IMHO if you are using XSLT just for separation purposes it is an overkill and makes things to complicated. If you need to transfer constructs into other languages such as perl etc... then thats a whole different situation... Regards Stefan
[PHP] Re: XML+XSLT or Smarty again??
Hardik Doshi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] During reading of XML+XSLT and Smarty, i have following two questions. Actually i dont know much about Advantages of XML+XSLT in web based application. What i know is Smarty's advantages. So if you have any idea then please let me know. I am more and more concern for perfect selection of template engine. Hello, From my point of view, both XML+XSLT and smarty have dirty templates, in sense, that their templates contain both html, and controling code. While some people consider this nice, I prefer templates that do not contain logic and controling code, so this is the way TemplateTamer works. With TT templates contain only markers fot templates and variables, and programmer is responsible for returning and array containing information about templates to be displayed and values of variables, and TT framework does the rest. This does have some resemblance to XML+XSLT approach but with following differences: a) there are no contol structures (or code) inside of templates b) data tree is easier and much less costly to asssemble since it is implemented with simple arrays c) all other glueing is done by TT framework. In addition to that, TemplateTamer offers: * IDE, that can keep track of the project, * tool to visualize template structures (which commes handy in more comlicated and nested structures) * example code generator. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML PHP question
Hello, On 01/30/2003 01:17 PM, Hardik Doshi wrote: Can you please tell me what is the best way of working with XML technology using PHP? I am not clear about integration of these two technologies. Suggest some books or links or good tutorials. Either of these books reviewed here are very good and recommended: http://en.static.phpclasses.org/products.html/id/1861007213.html http://en.static.phpclasses.org/products.html/id/0735712271.html -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML + XSL
xsl:script language=javascript ![CDATA[ pos = 0; function getpos(spos){ epos = spos + 4; pos = pos + 1; if(pos = spos pos = epos){ return true; }else{ return false; } } ]] /xsl:script -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml
Karl James [EMAIL PROTECTED] disgorged: : What the hell is XML anyway? eXtensible Markup Language http://www.w3.org/XML/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML and XLS Sablotron
You'll need the SAX or DOM functions if you will be /generating/ your XML. I suppose, you mean, generating XML from another XML document, am I right? The Sablotron extension (and other XSLT processors) take XML and XSLT and output whatever your XSLT tells it to. The XSLT processor depends on getting well-formed XML and XSLT and that's where the DOM functions come in. Technically, you could use the DOM functions to build an XML document, use them to build an XSLT stylesheet and then send those two generated items through the XSLT processor to build HTML. So, if I well understood, in case you simply want to manually write XML documents and XSLT stylesheets, and then have the PHP (Sablotron in the specific) to make the produce your HTML from it, you don't need SAX or DOM. Is this correct, or am I missing something? Does this mean that you only need SAX or DOM if you want to convert an XML format to another XML format? Really thanks Daniele -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML to MS Word
Hello, On 10/31/2002 12:01 AM, Maxim Maletsky wrote: Guys, The other day, one of my clients asked me this very tricky question: Can we also use that XML data for making MS Word (.doc) files? Our system is designed to produce XML output independently to then later transform it into HTML with PHP/XSLT and PDF with FOP. Now, the client also wants MS Word. I doubted he could, but my intuition suggested me to research on it. Without any luck so far. Does anyone know if there is any possibility doing it? I looked on web but did not really find anything. If your server is running under Windows, you can use COM objects for generating MS Word documents. Anyway, if you can generate RTF documents from your XML, just serve them with MS Word content type and .doc file name extension and MS Word will open them seeminglessly. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML to MS Word
If your server is running under Windows, you can use COM objects for generating MS Word documents. No way it's windows :) There is VMWare though, i might consider that. It is actually used for something similar. yet, I still have to research on direct MSWord generation. Anyway, if you can generate RTF documents from your XML, just serve them with MS Word content type and .doc file name extension and MS Word will open them seeminglessly. How limited is this method? Can it be pretty well formatted with enough stylish features etc? Or it is going to be just what format is called: Rich but still - Text ? -- Maxim Maletsky [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: XML to MS Word
Anyway, if you can generate RTF documents from your XML, just serve them with MS Word content type and .doc file name extension and MS Word will open them seeminglessly. Or just send HTML with Word headers and Word will open it right up. Your users won't even know it's HTML. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML to MS Word
Hello, On 10/31/2002 12:22 AM, Maxim Maletsky wrote: Anyway, if you can generate RTF documents from your XML, just serve them with MS Word content type and .doc file name extension and MS Word will open them seeminglessly. How limited is this method? Can it be pretty well formatted with enough stylish features etc? Or it is going to be just what format is called: Rich but still - Text ? You can define absolutely any type of document part in RTF because Microsoft developed RTF to export any Word document version. BTW, RTF is a markup language too. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML dom encode
On 10/04/2002 09:14 AM, 翽 wrote: But I need to modify this script so that I can set the encoding of the xml document to ISO-8859-1 so it would look like this: ?xml version=1.0 encoding=”iso-8859-1” ? - cds - cd id=1 titlesdfsdfsdf/title artistssdfsdf/artist /cd - cd id=2 titleasdf/title artistasdf/artist /cd - cd id=3 titlesdfasdf/title artist涩/artist /cd /cds Any Ideas how to do this? I’ve been searching the net for solutions without any results. This question was asked sometime ago but I could not understand if anybody actually solved it. Anyway, I use this XML writer class instead of DOM API as it allows me not only to generate nicely formatted XML documents with the character set encoding but also the stylesheet and DTD if I need it. Take a look: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: XML dom encode
-Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: 4. október 2002 12:23 To: [EMAIL PROTECTED] Subject: [PHP] Re: XML dom encode On 10/04/2002 09:14 AM, 翽 wrote: But I need to modify this script so that I can set the encoding of the xml document to ISO-8859-1 so it would look like this: ?xml version=1.0 encoding=”iso-8859-1” ? - cds - cd id=1 titlesdfsdfsdf/title artistssdfsdf/artist /cd - cd id=2 titleasdf/title artistasdf/artist /cd - cd id=3 titlesdfasdf/title artist涩/artist /cd /cds Any Ideas how to do this? I’ve been searching the net for solutions without any results. This question was asked sometime ago but I could not understand if anybody actually solved it. Anyway, I use this XML writer class instead of DOM API as it allows me not only to generate nicely formatted XML documents with the character set encoding but also the stylesheet and DTD if I need it. Take a look: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos Thanks for the reply but I just have to go with this xmlwriter class if no one can help me with this php xmlDom thing, but I can't imagin that nobody has found a way to solve this, there are that many people using iso-8859-1 encoding. But thanks again and if anybody has a solution for this I would be greatful. Regards, David -- 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] Re: XML Parser
Hello, On 10/02/2002 01:15 AM, Khalid El-Kary wrote: hi, i have developped an XML parser that's easy to use and very fast, and i have run two websites using it. http://creaturesx.ma.cx http://creaturesx.ma.cx/osman/jokes/index.php (not complete website) the question comes now what's best way to contribute this parser to the PHP community without losing my ownership rights? If your parse is based on an object oriented PHP class, you may want to contribute it to the PHPClasses site: http://www.phpclasses.org/ You can upload it and maintain it later when you make any improvements of bug fixes. Nobody will be able to mess with your code, the copyright remains your and the software license is up to you to decide. When your class is approved for publication, the subscribers of the site receive a message letting them know about it. If they find it interesting, they will go on the site and download it. If they see any problems or want to make any improvement suggestions, eventually you will receive plenty of feedback. If your class becomes popular, the class and your name will feature in the top charts. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml encodeing with new_xmldoc(1.0);
Hello, On 09/30/2002 09:54 AM, Föíö Öxîêójînyóon wrote: I need to apply iso-8859-1 encodeing to the ?xml version=1.0? that this function creates: new_xmldoc(1.0). I tried to replace the line but ofcourse the new_xmldoc function creates object-tree of the document and I dont know I can reffrer to the first line, or ?xml version=1.0? or just create the document with the encodeing That is odd there is no way to set the output encoding. Anyway, if you are looking for a way to generate nicely formatted XML documents that let you set the encoding character set, you may want to take a look at this class. Just specify the outputencoding that you want: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML vs Everything Else
Spend some time learning about xml and you won't regret it Could you (or anyone else on the list) recommend some good resources (Books / Websites) for learning XML and XSLT? Thanks, Javier _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML vs Everything Else
Javier Montserat wrote: Spend some time learning about xml and you won't regret it Could you (or anyone else on the list) recommend some good resources (Books / Websites) for learning XML and XSLT? Thanks, Javier http://www.devshed.com/Server_Side/XML http://www.xml.com (look for the essentials articles on the left) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML vs Everything Else
http://www.w3schools.com/xml/default.asp has some tutorials.. It helped me understand the basics of XML and what it can be used for.. They also have some XSL(T) information and tutorials (http://www.w3schools.com/xsl/default.asp) as well.. Take care.. peace.. eriol Javier Montserat [EMAIL PROTECTED] disgorged: : Could you (or anyone else on the list) recommend some good resources (Books : / Websites) for learning XML and XSLT? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML vs Everything Else
Hi, XML, eXtensible Markup Language. Meta-language. XML allows you to create your own variables and meta names. You should read some doc about it. Btw your question has nothing to do with PHP but really with XML you should take a look to the XML's mailing list they will help you better than we can. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Taylor York [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Ok, Help me out on this one. As far as i can tell, xml documents store data..pretty much just a dababase. Now please, correct me on anything I say incorrectly...But i just cannot seem to grasp the point of using XML over MySQL. Can anyone direct me to a page with xml in use? Something that can help me grasp what its all about. Thank you, Taylor York DreamStar Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml and a big script
this line is only for debugging: print $val located within these tags in startElement case NAME: $da_relicname=$val;print $val;break; case TYPE: $da_relictype=$val;break; Pafo [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i was almost done with everything :) and ofcourse i find a problem with the xml parser... the parser is not collection some vital information, and i dont know why... the xmlsite is: http://www.camelotherald.com/xml/servers.xml the problem is market with a -- : server name=Guinevere type=Roleplay lastguildupdate=2002-08-18 12:28:53 lastcharupdate=2002-08-16 18:09:06 population1707/population statusUp/status - relic name=Scabbard of Excalibur type=Melee realm=Albion --, the parser dosent retrive this line,, it gets every line except this. ownerMidgard/owner /relic - relic name=Merlin's Staff type=Magic realm=Albion ownerHibernia/owner /relic - relic name=Thor's Hammer type=Melee realm=Midgard ownerMidgard/owner /relic - relic name=Horn of Valhalla type=Magic realm=Midgard ownerHibernia/owner /relic - relic name=Lug's Spear of Lightning type=Melee realm=Hibernia ownerMidgard/owner /relic - relic name=Cauldron of Dagda type=Magic realm=Hibernia ownerHibernia/owner /relic ... if u run this script, it prints out everything except that. ?php // ** Settings $ServerToPrint = Guinevere; // *** // // START OF THE CODE $printedserver = false; $printedrelic = false; $printedkeep = false; $depth = array(); $insideitem = false; $insidekeep = false; $tag = ; $server = false; $crelic = new RelicInfo; $cserver = new ServerInfo; $ckeep = new KeepInfo; class KeepInfo { var $KeepName = Array(); var $KeepOwner = Array(); var $KeepRealm = Array(); var $KeepClaimant = Array(); function PrintInfo() { for ($i = 0; $i count($this-KeepName); $i++) { print TRTDb{$this-KeepName[$i]}/b; print TD{$this-KeepRealm[$i]}/TD; print TD{$this-KeepOwner[$i]}/TD; print TD{$this-KeepClaimant[$i]}/TD/TR\n; } } function SetName($name) { $this-KeepName[] = $name; } function SetOwner($owner) { $this-KeepOwner[] = $owner; } function SetRealm($realm) { $this-KeepRealm[] = $realm; } function SetClaimant($claim) { $this-KeepClaimant[] = $claim; } } class RelicInfo { var $RelicName = Array(); var $RelicType = Array(); var $RelicRealm = Array(); var $RelicOwner = Array(); function PrintInfo() { for ($i = 0; $i count($this-RelicName); $i++) { print TRTDb{$this-RelicName[$i]}/b; print TD{$this-RelicType[$i]}/TD; print TD{$this-RelicRealm[$i]}/TD; print TD{$this-RelicOwner[$i]}/TD/TR\n; } } function SetName($name) { $this-RelicName[] = $name; } function SetType($type) { $this-RelicType[] = $type; } function SetRealm($realm) { $this-RelicRealm[] = $realm; } function SetRelicOwner($owner) { $this-RelicOwner[] = $owner; } } class ServerInfo { var $ServerName = Array(); var $ServerPopulation = Array(); var $ServerType = Array(); var $ServerStatus = Array(); var $Totalpop = 0; function PrintInfo() { for ($i = 0; $i count($this-ServerName); $i++) { print TRTDb{$this-ServerName[$i]}/b; if ($this-ServerType[$i]) { print (i{$this-ServerType[$i]}/i); } print /TD; print TD{$this-ServerStatus[$i]}/TD; print TD{$this-ServerPopulation[$i]}/TD/TR\n; } } function PrintTotal() { print $this-Totalpop; } function SetServer($server) { $this-ServerName[] = $server; } function SetType($type) { $this-ServerType[] = $type; } function SetStatus($status) { $this-ServerStatus[] = $status; } function SetPopulation($pop) { $this-ServerPopulation[] = $pop; $this-Totalpop += $pop; } } function startElement($parser, $tagName, $attrs) { global $ServerToPrint, $server, $depth, $insideitem, $insidekeep, $tag, $da_server, $da_type, $da_relicname, $da_relictype, $da_relicrealm, $da_keepname, $da_keeprealm; if ($insideitem) { $tag = $tagName; } elseif ($tagName == RELIC) { $insideitem = true; while (list ($key, $val) = each ($attrs)) { switch($key) { case NAME: $da_relicname=$val;print $val;break; case TYPE: $da_relictype=$val;break; case REALM: $da_relicrealm=$val;break; } // end case } // end while } elseif($tagName == SERVER) { $depth[$parser]++; $insideitem = true; while (list ($key, $val) = each ($attrs)) { if ($key == NAME) { $da_server=$val; if($val == $ServerToPrint) { $server = true; } else { $server = false; } } if ($key == TYPE) { $da_type=$val; } } // end while } elseif($tagName
[PHP] Re: xml and php
Hello, On 08/15/2002 10:30 AM, Pafo wrote: iwill rephrase my question, where can i find good xml-php links? how would you extract all information about the Guinevere server in this xmlpage, http://www.camelotherald.com/xml/servers.xml its aprox in the middle of the list, and i want all information there so i could display it on a page. They have PHP support for that already: http://www.camelotherald.com/xml.php#unix -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml and php
this is a simple scipt witch i worked out,, but it Dosent work due to: i cant get information from a deeper node... like this: server servers name=ajs blaa blaa blaa pop100/pop relic name=george type=melee ownernisse/owner /relic /servers /server i want to get: relic name=george type=melee and the dataelement after it,, but the thing i wrote dosent do that :/ any ideas? the program code is below as it is now the program dosent output any information,, hmm? regards patrick ?php $insideitem = false; $insidekeep = false; $insiderelic = false; $printed = false; $printedkeep = false; $tag = ; $server = false; $da_server = ; $da_lastguildupdate = ; $da_lastcharupdate = ; $da_population = ; $da_type = ; $da_status = ; $da_relicorig = ; $da_relicname = ; $da_relictype = ; $da_relicowner = ; $da_keeporig = ; $da_keepname = ; $da_keepowner = ; $da_keepclaimant = ; function startElement($parser, $tagName, $attrs) { global $insideitem, $insidekeep, $insiderelic, $tag, $da_server, $da_type, $da_lastguildupdate, $da_lastcharupdate, $server, $da_relictype, $da_relicname, $da_relicorig, $da_keepname, $da_keeporig; if ($insideitem || $insiderelic || $insidekeep) { $tag = $tagName; } elseif ($tagName == SERVER) { $insideitem = true; //while (list ($key, $val) = each ($attrs)) { //if ($key == NAME $val == Guinevere) { $server = true; $da_server = $val; print Sant, $key - $val; } //else { $server = false; } //} // end WHILE $server=true; if ($server) { while (list ($key, $val) = each ($attrs)) { switch($key) { case TYPE : $da_type = $val; break; case LASTGUILDUPDATE : $da_lastguildupdate = $val; break; case LASTCHARUPDATE : $da_lastcharupdate = $val; break; } } // end WHILE } } // MAJOR PROBLEM, CAUSE I CANT RETRIVE THIS INFORMATION elseif ($tagName == RELIC $server) { $insiderelic = true; while (list ($key, $val) = each ($attrs)) { if ($key == TYPE) { $da_relictype = $val; } if ($key == NAME) { $da_relicname = $val; } if ($key == REALM) { $da_relicorig = $val; } } // End While } // NOR THE KEEP INFORMATION elseif ($tagName == KEEP $server) { $insidekeep = true; while (list ($key, $val) = each ($attrs)) { if ($key == NAME) { $da_keepname = $val; } if ($key == REALM) { $da_keeporig = $val; } } // End While } } function characterData($parser, $data) { global $insideitem, $insidekeep, $insiderelic, $tag, $da_population, $da_status, $da_relicowner, $da_keepowner, $da_keepclaimant; if ($insideitem) { switch ($tag) { case POPULATION: $da_population .= $data; break; case STATUS: $da_status .= $data; break; } } if ($insiderelic) { $da_relicowner .= $data; } if ($insidekeep) { switch ($tag) { case OWNER : $da_keepowner .= $data; break; case CLAIMANT : $da_keepclaimant .= $data; break; } } } function endElement($parser, $tagName) { global $insideitem, $insidekeep, $insiderelic, $tag, $da_server, $da_population, $da_type, $da_status, $da_lastguildupdate, $da_lastcharupdate, $da_relicname, $da_relicowner, $da_relicorig, $da_relictype, $printed, $printedkeep, $da_keeporig, $da_keepname, $da_keepowner, $da_keepclaimant; if ($tagName == SERVER $server == true) { print TRTDbServer/b/TDTDbStatus/b/TDTDbPopulation/b/TD /TR\n; print TRTD$da_server; if ($da_type) { print (i$da_type/i); } print /TD; print TD$da_status/TD; print TD$da_population/TD/TR\n; print TRTD/TD/TR\n; print TRTDbLastguildupdate/b/TDTDbLastcharupdate/b/TDTD/TD /TR\n; print TRTD$da_lastguildupdate/TDTD$da_lastcharupdate/TD/TR\n; } elseif ($tagName == RELIC $server == true) { if (!$printed) { print TRTD/TD/TR\n; print TRTDbRelic Name/b/TDTDbRelic Owner/b/TDTDbRelic Type/b/TD/TR\n; $printed = true; } print TRTD; if ($da_relicorig == Albion) { print font color=\#ff$da_relicname/font; } elseif ($da_relicorig == Midgard) { print font color=\#ff$da_relicname/font; } else { print font color=\#00ff00$da_relicname/font; } print /TDTD; if ($da_relicowner == Albion) { print font color=\#ff$da_relicowner/font; } elseif ($da_relicowner == Midgard) { print font color=\#ff$da_relicowner/font; } else { print font color=\#00ff00$da_relicowner/font; } print /TDTD$da_relictype/TD/TR\n; } elseif ($tagName == KEEP $server == true) { if (!$printedkeep) { print TRTD/TD/TR\n; print TRTDbKeep Name/b/TDTDbKeep Owner/b/TDTDbClaimant/b/TD/TR\n; $printedkeep = true; } print TRTD; if ($da_keeporig == Albion) { print font color=\#ff$da_keepname/font; } elseif ($da_keeporig == Midgard) { print font color=\#ff$da_keepname/font; } else { print font color=\#00ff00$da_keepname/font; } print /TDTD; if ($da_keepowner == Albion) { print font color=\#ff$da_keepowner/font; } elseif ($da_keepowner == Midgard) { print font color=\#ff$da_keepowner/font; } else { print font color=\#00ff00$da_keepowner/font; } print
Re: [PHP] Re: xml and php
On Thu, Aug 15, 2002 at 11:28:51PM +0200, Pafo wrote: i cant get information from a deeper node... server servers name=ajs blaa blaa blaa pop100/pop relic name=george type=melee ownernisse/owner /relic /servers /server Carefully examine the code at http://www.analysisandsolutions.com/code/phpxml.htm It provides you the basic concepts needed to parse any XML document. BUT, you'll need to use your head in modifying the case statements -- and what they do when triggered -- in the StartHandler() and EndHandler() to meet your needs. I only have a few, cursory comments on your code. I haven't read the whole thing because it's long and poorly formatted. But, in short, it seems overly complex for the task at hand. For example, don't set all those variables individually. Store the information in one array. This will cut down on initialization statements up front and global statements in each function. --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] Re: XML vs. PHP manual???
I alway knew there is an easier way to do that. Problem is just don't know it. I like your example and it is an wonderful example. I can use it. One quick question. The function, posttofunction(), is that a make-believe function? I check PHP.net and it doesn't have this function, so I assume you just put it there to make a point about the whole script. Thanks, FletchSOD Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... I read the useful document about XML in PHP on http://www.analysisandsolutions.com/code/phpxml.html. I still haven't made much progress on XML. I'm still confuse about XML. I had to write XML stuffs on the client-side with the build-in XML request and it doesn't make sense that the client brower should be communicating to credit bureau network without going to my company's PHP webserver to that credit bureau. So, it meant I have to use the post request that would send the data to my company's PHP webserver and somehow convert it into xml and send it to that credit bureau by cURL. Is there a way to do that?? As I recall, only the DOM model can easily add/alter nodes to an XML document. SAX would be not useful... (Or was it the other way around...?) Anyway, you may be trying too hard :-) Unless your credit bureau is incredibly different from all the rest, it will *PROBABLY* be easiest to just do something not unlike: ?php # import expected $_POST variables if register_globals is off. $xml = ENDOFXML XML NAME$name/NAME ADDRESS$address/ADDRESS . . . /XML ENDOFXML; $result = posttohost('http://yourcreditbureau.com', $xml); ? I mean, really, do you want to make life all complicated by trying to create some giant XML data structure when all you really need is one stupid little never-changing string with the data in it? If you're building a complex application to *TRADE* tons of info with your credit bureau, you'd want to scale up and generalize your XML-creation with complex data structures so you can easily alter it when they change the DTD out from under you or whatever. But if you are just sending the one kind of XML request off to the credit bureau, don't make your life complicated for no real reason. Just my opinion. -- Like Music? http://l-i-e.com/artists.htm I'm looking for a PRO QUALITY two-input sound card supported by Linux (any major distro). Need to record live events (mixed already) to stereo CD-quality. Soundcard Recommendations? Software to handle the recording? Don't need fancy mixer stuff. Zero (0) post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo audio-to-disk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML vs. PHP manual???
I read the useful document about XML in PHP on http://www.analysisandsolutions.com/code/phpxml.html. I still haven't made much progress on XML. I'm still confuse about XML. I had to write XML stuffs on the client-side with the build-in XML request and it doesn't make sense that the client brower should be communicating to credit bureau network without going to my company's PHP webserver to that credit bureau. So, it meant I have to use the post request that would send the data to my company's PHP webserver and somehow convert it into xml and send it to that credit bureau by cURL. Is there a way to do that?? As I recall, only the DOM model can easily add/alter nodes to an XML document. SAX would be not useful... (Or was it the other way around...?) Anyway, you may be trying too hard :-) Unless your credit bureau is incredibly different from all the rest, it will *PROBABLY* be easiest to just do something not unlike: ?php # import expected $_POST variables if register_globals is off. $xml = ENDOFXML XML NAME$name/NAME ADDRESS$address/ADDRESS . . . /XML ENDOFXML; $result = posttohost('http://yourcreditbureau.com', $xml); ? I mean, really, do you want to make life all complicated by trying to create some giant XML data structure when all you really need is one stupid little never-changing string with the data in it? If you're building a complex application to *TRADE* tons of info with your credit bureau, you'd want to scale up and generalize your XML-creation with complex data structures so you can easily alter it when they change the DTD out from under you or whatever. But if you are just sending the one kind of XML request off to the credit bureau, don't make your life complicated for no real reason. Just my opinion. -- Like Music? http://l-i-e.com/artists.htm I'm looking for a PRO QUALITY two-input sound card supported by Linux (any major distro). Need to record live events (mixed already) to stereo CD-quality. Soundcard Recommendations? Software to handle the recording? Don't need fancy mixer stuff. Zero (0) post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo audio-to-disk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml and max size of xml doc
Hi y'all Has anyone found any problems with the xml parsing functions when the xml document gets quite large. eg, a doc with about 5000 lines (about 200KB) The problem that's occurring is that some of the elements are being broken in two parts If you require more details, please ask, as it's one of my colleagues that is having this problem and I'll need her to pass on an example if needed. I've heard that the DOM is a memory hog... Are you using DOM or the other one, or ??? It's also quite possible that somewhere deep into the XML somebody line-wrapped an element, which is prefectly valid, but that isn't anticipated by your algorithm for reading/parsing the file... That's the most likely source of the problem as described. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML-parser
http://sourceforge.net/projects/phpxpath/ [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I´m working on a little web shop solution for a school project, therefore I´m looking for a PHP XML-Parser or some source code I can get from somewhere. Has anybody a good link to a tut or something else.. -- Thanks in advance for your help, kind regards Marcos GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML creation / edit class?
Hello, David McInnis wrote: I am looking for an extension / class that allow me to create and modify XML documents within PHP. I looked at the xml extensions packaged with PHP and it looks like these are used only for parsing XML. In addition to parsing the XML, I need to be able to add / edit and insert nodes. Best example I can give is an order. I would need to create an order and then insert / edit and delete line items of that order. Can someone point me in the write direction? I have written a XML parser and a XML writer classes. The XML parser class builds the XML document structure in a single array. You can take that structure and store in the a XML writer class object The XML writer does not yes have functions to insert or delete XML nodes, but you can use it to directly alter or append new XML nodes, if that is enough for you purposes. You may find those classes here: http://www.phpclasses.org/browse.html/package/250.html http://www.phpclasses.org/browse.html/package/4.html Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML closing elements called for tag /
In 000a01c1af5a$dbf70140$73fd883e@laptop, Hammy wrote: Is there any way to suppress or detect when the closing element event fires from tags in the form tag / rather than tag/tag? no, i don't think so. It means exactly the same in the XML-sense, so why should there be a difference in reporting it... chregu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: XML closing elements called for tag /
if you set up the xml_set_character_data_handler(), maybe this isn't called for tag /, but it will be called for tag/tag (??) you might want to check that 'cause I haven't :) Martin -Original Message- From: Christian Stocker [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 10:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: XML closing elements called for tag / In 000a01c1af5a$dbf70140$73fd883e@laptop, Hammy wrote: Is there any way to suppress or detect when the closing element event fires from tags in the form tag / rather than tag/tag? no, i don't think so. It means exactly the same in the XML-sense, so why should there be a difference in reporting it... chregu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML / XSLT parsing using PHP
Lasse Laursen [EMAIL PROTECTED] wrote in message 02c301c1a4c4$42e03620$[EMAIL PROTECTED]">news:02c301c1a4c4$42e03620$[EMAIL PROTECTED]... Hi, We are about to develop a CMS that uses XML and XSLT. The XML files contains some static information (header, footers and common non-dynamic information). We would like to have a XML file that would contain a field like: MENU ... ... ... MENU/ Before the XML file is loaded into the PHP script that uses the xslt_process routine to convert the XML/XSLT files into plain HTML we would like to replace the MENU field with come dynamic content (eg. some other variables, etc.) What's the easiest way to do that? SAX or? Load the XML into a variable, do whatever changes to it, then process the variable with xslt_process. Furthermore the 'xslt_process' function requires the following parameters: xslt_process (resource xh, string xml, string xsl [, string result [, array arguments [, array parameters]]]) where the XML and XSLT variables are references to files. - The XML file is in our example a variable (eg. $current_xml_file = x;) and therefor we cannot use the xslt_process function? Of cause we can store the XML var. in a temporary location and then read the file, but that's an extreamly ugly approach! :) Any ideas? Have a look at: http://www.php.net/manual/en/function.xslt-process.php Example 3 Using the xslt_process() to transform a variable containing XML data and a variable containing XSL data into a variable containing the resulting XML data I'm looking forward to your replies :) Yours -- Lasse Laursen [EMAIL PROTECTED] - Systems Developer NetGroup A/S, St. Kongensgade 40H, DK-1264 København K, Denmark Phone: +45 3370 1526 - Fax: +45 3313 0066 - Web: www.netgroup.dk Peter Clarke -- 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] Re: XML Parsing Problem
Hi Ben, Had the same problem. The solution I came up with was to populate the value repeatedly by concantenation. $thisxmlval .= (whatever is sent from the parser). Note the . in front of the = As long as the parser is still sending values from this tag, your program should concantenate them, thereby producing one value which was the original content of the tag. kind regards, bill Ben Gollmer wrote: Hi all - I'm experimenting with PHP's XML parser for an application that maps XML tags to MySQL database fields. As a test for my parsing program, I've been grabbing XML from the Slashdot news feed (http://www.slashdot.org/slashdot.xml) and inserting it into a database. This is very simple data - titleblah/title gets inserted into the 'title' field, etc. However, when there are some strange characters in the title field, the XML parser seems to choke. Here is an example. The title of a recent article from Slashdot looks like this in the XML file: titleFollow-up To Critique of BeOS amp;amp; Mac OS X/title Don't ask my why they have a double ampersand in there... Anyway, the XML parser returns this as three sets of data, instead of one. The array that I get looks like this: $myArray[0] = Follow-up To Critique of BeOS $myArray[1] = $myArray[2] = amp; Mac OS X This is the data I get back from the parser, BEFORE putting it into the database. I'm echoing each array field to the screen, just to make sure. So I know it has nothing to do with MySQL. The double ampersand shouldn't make a difference - the XML parser should not be interpreting HTML...right? Also, I don't get an error code or error string from xml_parse(). Anyone have any ideas? This is a subtle bug - in fact I had been satisfied with my XML parsing code, and was well into the rest of my application when I happened to notice this. Ben -- 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] Re: Xml Parse Extended Chars
The only predefine entities in XML are lt; gt; amp; all others need to be defined in the dtd. Best thing to do is leave the charatef as is in the xml and only run htmlentites on the contents when sending the contents to an html web browser. The xml will happily hold the character as it is. If you're using the XML Parser functions, you can choose the target character encoding: ISO-8859-1 (default) US-ASCII UTF-8 Chris Noble [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Ive ran into a stumbling block trying to parse an xml document. I control the parsing and the creation of the xml document so I can do any changes from either side of it. Problem I have run into is my xml document has a é in it. Ive ran htmlentities on it and it converts it to eacute; but everytime I try and run xml parse on that I get the error code of undefined entity at line 108. Has anyone ran into this problem before or know a solution to handle these issues? Chris Noble -- 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] Re: XML and PHP
You can almost for sure alter the XML doc and write it out again... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Augusto cesar castoldi [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Thursday, September 27, 2001 6:54 AM Subject: XML and PHP Can I use the PHP XML functions to add and remove data from a XML file? It's possible? Or the PHP XML Functions are only for read a XML file? regards, Augusto ___ Yahoo! GeoCities Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. É fácil e grátis! http://br.geocities.yahoo.com/ -- 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] Re: XML Processing Instruction ( was ? PHP vs. ? )
Teodor Cimpoesu wrote: my follow-up was from an suggest of using % though :) it exists in C, ASP and JSP. We have it in PHP, why not use it? Because it is not compatible with XML syntax. Following is incorrect in XML, because '' has very restricted usage: tag % echo Date("d.m.Y") % /tag If you use ?php instead, it is perfect XML and you can use any XML editor or other tool to work with document: tag ?php echo Date("d.m.Y") ? /tag - Jirka Kosek e-mail: [EMAIL PROTECTED] http://www.kosek.cz -- 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]