Simplexml And Attributes With A Namespace In Front. How Do You Getthe Attribute?
Here's a bit of xml code that works.
<?php
$string = "<?xml version="1.0" standalone="yes"?> <world> <people xmlns:ss="http://crap"> <person id="5">John Doe</person> <person id="2">Susie Q. Public</person> </people> </world>";
$xml = simplexml_load_string($string); print "<pre>"; print_r($xml); print "</pre>";
foreach($xml->people->person as $p) foreach($p->attributes() as $a =$b) { print "$a =$b<br />"; }
// prints out // id =5 // id =2 ?>
Now what if I change the first person to this <person ss:id="5">John Doe</person>
Anyone know how to get the id?
This is a question that is pertinent to an excel .xml file as you'll get lines like this <Cell ss:Index="3">stuff</Cell>
btw: there is a guide on ibm that tells you how to do this with php and dom. I'm just wondering if there's a way to do it with simplexml.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Simplexml + Namespace +attributes
I have an XML file with some elements like those below <core:District Id="AB01"> <core:Name>NORTH EAST</core:Name> <core:Association Type="type1">VALUE 1a</core:Association> <core:Association Type="type2">VALUE 1b</core:Association> <core:Association Type="type3">VALUE 1c</core:Association> </core:District> <core:District Id="AB02"> <core:Name>NORTH WEST</core:Name> <core:Association Type="type1">VALUE 2a</core:Association> <core:Association Type="type2">VALUE 2b</core:Association> <core:Association Type="type3">VALUE 2c</core:Association> </core:District> I'm trying to parse it using simplexml I have: $districts = $xmlfile->children($core); foreach ($districts as $key => $value) { echo "Name = " . $value->Name . " "; echo "Region1 = " . $value->Association[0] . " "; echo "Region2 = " . $value->Association[1] . " "; echo "Region3 = " . $value->Association[2] . " "; } This works fine, but I am unable to access the Id attribute in the opening District element, i.e. AB01 or AB02. Would anyone be able to suggest how I might get that value with simplexml?
SimpleXML Parsing By Attribute Value
I have an existing XML data set and would like to parse it with PHP5 based on the value of an attribute (any attribute!). I don't want to convert all my data from an attribute-heavy structure to a more proper element-based structure if I don't have to because of the javascript I am using on the client side. Listed below is the XML structure and PHP code I have been testing. My existing data structure looks like this: <gallery> <photos> <photo path = "sunflower01.jpg" width = "500" height = "375" thumbpath = "sunflower01.jpg" thumbwidth = "125" thumbheight = "94"> </photo> </photos> </gallery> The script is here: <?php $xml = simplexml_load_file("pictures.xml"); $image = $xml->xpath("/gallery/photos/photo[@path='sunflower01.jpg']"); echo $image[0]->photo@thumbpath; ?>
Namespace Prefixes
Could anybody help me with using DOMXML to grab a DOM Element from an XML doc thats is written in the <PREFIX:Nodename xmlns"http://a.url.com"> style - You can't simply do a $dom->get_elements_by_tagname("PREFIX"); so - how can you do it?? (I need to grab the "Nodename" bit by finding the tag that begins with the "PREFIX:" bit.)
Include() In Separate Namespace?
I would like to make use of two separate PHP applications which happen to share some class names; trying to include both from one script results in the expected error, "cannot redefine class foo." or somesuch. Using a fully qualified URL instead of the local file path in the include() would work, except that the applications then do not have access to the users cookies -- the requests are coming from the server itself, not the user. The virtual() function seems to be in flux -- there seems to be disagreement as to whether it is supposed to work with .php files; besides it doesn't work on the two servers I have. So, is there a way to include a .php file such that it is evaluated outside of the context of the php script from which it is included, in its own namespace, but so that the request for the file still comes from the user's browser itself?
PHP Global Namespace Clogged Up
PHP puts most of its functions into a big flat global namespace. That leads to short function names - but creates a namespace minefield for programmers. Lots of the functions are legacies from the days before PHP got object-oriented features. For instance we currently have: strstr(haystack, needle) ....instead of something like: haystack -> find(needle); To clean up the existing mess, many new functions need to be created as member function of the appropriate objects - and most of the old functions in the global namespace need deprecating. Does anyone think the existing mess will ever get cleaned up? Or is PHP's function namespace too shafted at this stage to ever be repaired?
Namespace Handler Isn't Called
I'm using the XML functions in PHP 5. The callback function I set for namespace declarations doesn't get called. Can anyone help me out? The code is: $xml = '<addressbook xmlns:ab="http://www.somewhere.com/addressbook/">' . '</addressbook>' $parser = xml_parser_create_ns(); xml_set_element_handler( $parser, 'StartHandler', 'EndHandler' ); /* The handler doesn't get called for some reason */ xml_set_start_namespace_decl_handler( $parser, 'NSHandler' ); xml_parse( $parser, $xml, true); xml_parser_free( $parser ); function StartHandler( $parser, $name, $attrs ) { print( 'StartHandler Called<br/>' ); } function EndHandler( $parser, $name ) { print( 'EndHandler Called<br/>' ); } function NSHandler( $parser, $prefix, $uri ) { print( 'NSHandler Called<br/>' ); } And the output is: StartHandler Called EndHandler Called I want the output to be StartHandler Called EndHandler Called NSHandler Called
Include_once/__autoload/namespace Emulation ...
The primary problem I've had with php is the lack of namespaces, which makes OOP very difficult to organize, since you end up with large number of classes cluttering up the same namespace - which leads to a secondary problem involving php's __autoload feature. Since you cannot specify a namespace when calling a class that may not have been included, you are forced to store all of your classes in the same folder in your file system. This can get quite unwieldy. I've also read that __autoload has a performance hit over using a standard include (I'm not sure if this is still true). Finally, I've read that require_once can be very buggy in the php documentation comments. (Is that true?) After thinking about the namespace problem, I've concluded that php's conditional include nature keeps the runtime environment pretty clean (if I have two classes with the same name, I don't usually have to worry about it, since I will usually only include one at a time) and its runtime footprint small. While it's not perfect, it does provide enough of something like runtime namespace protection, at least enough to keep me from creating a bulky framework to emulate more robust namespaces. This left me with the problem of organizing all of my class files on the file system. I do not want to keep 100s of classes in the same one folder - especially since there are many classes in there that will probably not be used, but I'd like to keep around for just in cases. Since __autoload seems to have performance issues, I decided not to use that either. (Is this still an issue?) Since I've decided that for my needs php's include functions are a good enough substitute for real namespace imports I just needed a way to load class files that are organized in a namespaces like folder structure. I would have just used require_once, but it has those bugs I mentioned. So I came up with a single function that I named "using" (borrowed from ..NET and Prado - which actually has a pretty spiffy solution to the namespace problem that uses __autoload). Here is the function (it is horribly unoptimized and probably buggy): $namespaces = array(); $classPath = 'C:/Inetpub/wwwroot/_domains/adcecart/_includes/' /** * Includes class files, which are stored in Namespace like folders * @paramstringcolon delimited namespace string. */ function using($namespace) { global $namespaces, $classPath; // quick return if repeat import if(isset($namespaces[$namespace])) return; // convert $namespace to path $path = $classPath . str_replace(':','/',$namespace); if (is_dir($path)) { // add namespace to hash (to avoid double import) $namespaces[$namespace] = $namespace; // add all files in the directory $dir = dir($path); while (false !== ($entry = $dir->read()) ) { if (preg_match('/.php$/i', $entry)) { $newNamespace = str_replace('/', ':', substr($namespace.'/'.$entry, 0, -4)); if (!isset($namespaces[$newNamespace])) { $namespaces[$newNamespace] = $newNamespace; require_once($path.'/'.$entry); } } } $dir->close(); } else if (is_file($path.'.php')) { $namespaces[$namespace]=$namespace; require_once($path.'.php'); } else exit('Error importing namespace.'); } // used like this using('unFocus:Feature:ClassName');
Creating XML With Specific Namespace(newbie)
I've got a simple question. How can I create my own XML(using PHP) with a specific namespace? My goal is to create a SOAP message - I will have to use few namespaces within one XML document. I'm using PHP 4.3.x
XML - Sorting By Attribute
I'm not sure whether this is a question about php or xml or what to be honest - a poke in the right direction would be much appreciated... I'm storing news articles in XML format. newsitems.php which contains the XML looks like this; ....
Domxml_new_doc - Can I Add Encoding Attribute?
I've got a question about adding encoding attribute to my DOM XML Document? I'm from Poland and we use extended latin alphabet - I'd like to use iso-8859-2 Polish charset e.g.: <?xml version="1.0" encoding="iso-8859-2"?> is there such posibility in DOM XML?
LDAP And TelephoneNumber Attribute
Anyone have a problem with PHP returning the telephoneNumber attribute empty while all the other attributes return just fine. Someone had the same exact problem on phpbuilder but it was never solved. Apparently it holds true for facsimileTelephoneNumber also. Any ideas?
A '<' Character Cannot Be Used In Attribute 'href', Except Through <[xml]
The following embedded snip it of PHP code won't validate using xhtml 1.0 strict. When validating I get the following error: A '<' character cannot be used in attribute 'href', except through <[xml] Code: href="/_Director/forms.php? <?PHP create_request_query('AskQuestions', 'AskQuestions'); ?>" Any idea what's wrong?
Populating An Auto_increament Attribute
I have just designed a BD. there are companies with auto increament which are integer. When I try to populate it after i tool value from another form and try to insert it into a table i recieve an error! I don't ask the companyID value from user as it is auto increament. Don't tell me to put NULL for that entry as it didn't work as well! Code:
Counting Items In An Array Having X Attribute
I want to randomly select 5 cards from a standard playing card deck and count how many of each suit are returned: [connect] $sql = "SELECT * FROM cards ORDER BY RAND()LIMIT 5"; $result = mysql_query($sql); while($cards = mysql_fetch_array($result)) { $value = $cards["card_value"]; $suit = $cards["card_suit"]; $image = $cards["card_image"]; -------- Using count() within the loop returns a count of 1 since each card can only be of one suit. I tried using something like this: $spades = 0; if($suit='spades') { $spades = $spades+1; } and I tried a foreach statement to count within the loop which always returns a count of 1. Would someone be so kind as to point me in the right direction?
Sort A Group Of Nodes By Attribute? How?
I have the following XML file: <?xml version="1.0" encoding="iso-8859-1"?> <items> <item line="2">all that glitters is gold,</item> <item line="1">Theres a lady thats sure,</item> <item line="3">and she's buying a stairway to heaven</item> </items> To output this code Im using the following PHP: $xmldoc = domxml_open_file('stairway.xml', DOMXML_LOAD_DONT_KEEP_BLANKS); $node = $xmldoc->document_element(); if ($xmldoc->has_child_nodes()) { $node = $node->first_child(); $endwhile = false; while ($endwhile != true) { echo $node->get_content() . "<br />"; if ($node->next_sibling()) { $node = $node->next_sibling(); }else{ $endwhile = true; } } } This does what it supposed to do except I want to ensure that it outputs nodes ordered by 'line' attribute. The obvious answer would be to put them in order in the XML file and the above example is very simple so that you get the point, the real life example however will be much larger and encase anyone put something in the wrong order it would muck up my presentation. How could I adapt my code above to allow my nodes to be sorted? I dont mind the nodes being out of order in the physical file (stairway.xml) but when they are output using my script, I want them to be ordered.
Accept Form Attribute Not Working
I cannot get my accept attribute working properly inside either my form, or my input tag. W3schools says that accept is supposed to go inside the input tag, but msdn says it goes in the form tag. I need it for an upload form I'm making, I want to only allow application/octet-stream type files, so I put this as my opening form tag: <form enctype="multipart/form-data" accept="application/octet-stream" action="{$_SERVER['PHP_SELF']}" method="POST"> But I can still upload music, text files, and movies. What gives?
Front End For Php
which software can help me to build system using php... i means user friendly. it can help me to design the system easily.
After I Load An XML File, Can I Sort It By Node Attribute
After loading an xml file, is it possible to sort it by attribute? For example, I have the following xml file: <xml... <diary> <entry date="2005-01-01">I went to the park</entry> <entry date="2005-01-03">Sold the car today</entry> <entry date="2005-01-02">Went for a stroll</entry> </diary> When I go to load this using PHP, I would use some this similar to this: $xmldoc = domxml_open_file('diary.xml', DOMXML_LOAD_DONT_KEEP_BLANKS); $node = $xmldoc->document_element(); Before I go storming through the xml tree outputing along the way, can I sort it by (in this case) date?
Php-4.4.0 And Test.wsf = Error: The Value For The Attribute Is Not Valid: Language
We need to use version php-4.4.0-Win32 because one of the portal software doesn't support version php-5.0.5-Win32. We cannot get the PHP setup part working. Here is the error message: Windows Script Host Script: C:kits est.wsf Line: 3 Char: 11 Error: The value for the attribute is not valid: language Code: 80040049 Source: Windows Script Host Here is the code from the install.txt To test if ActiveScript is working, create a new file, named test.wsf (the extension is very important) and type: <job id="test"> <script language="PHPScript"> $WScript->Echo("Hello World!"); </script> </job> Save and double-click on the file. If you receive a little window saying "Hello World!" you're done. Everything works fine using php-5.0.5-Win32.
@ In Front Of Variable
What is the @ for when put in front of a variable? I am looking at some older code and have never used it myself.
Front For Mysql
Are there any good PHP scripts or pre written programs that deal with a complex database? Let me explain: I'm in truck dispatch, and we've moved all tables to mysql and access them on a network via ms access. We will open another office in another city, and will want a "web" database. Now here's what I'm after: Currently one form has various dropdown boxes to pick customer, shipper, consignee, and carrier information. YES, I even have the combos ask (ENTER SEARCH STRING), so all 17000 records do not show up in the dropdown combo boxes. You might enter da for example to get all occurrences of carries that start with da, i.e., Davis Transportation Inc. Currently only about 5 da's. Of course the information in combos are pulled from the customer database via a query. This all being done in ms access with the mysql tables linked. This is a very complex system, and all works perfect on a five computer network. By the way, choosing a shipper in a combobox fills in "ALL" necessary fields for pickup, i.e., Address, contact person, phone number for directions, etc. Can a web database even do something like this? When I migrate to a "Web" database, I am looking for a good PHP script / code / example that can handle this situation of dealing with multiple lookups on one form, and filling in all required information without having to type it in each time. Ok PHP folks can this be done and where are the examples to learn off of? To put it in a nutshell, I know how to populate a table, search, and edit records in php. What I need are example of: Say you are entering a new record, I need a "LOOKUP POPUP TABLE" with a search (enter search string) like above, and a way to select a row, then the "LOOKUP POPUP TABLE" closes and the original record I was entering has certain fields filled in. Liken this to the "Northwind" example that comes with MS Access. In an order example, they have some customer info auto filled in. If all I needed was table / forn / search / edit, I could use DADABIK. And one final question, Do I need a web database, or is it possible to still use MS Access as a front end from another city / state in a client server setup? I know how to network all this but not client / server from a long distance.
@ Sign In Front Of An Command
Anybody can tell me what the @ sign means in this context? $host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);
GNUPG Email Front End
I've been trying to figure out if there is a real GNUPG front end for popular Windows email programs and so far I haven't found any. Yes, they say it's built in Becky but what if I'm using Netscape Mail or Outlook Express. Ok, I downloaded free PGP and it installes a whole bunch of utilities that I don't really need apart from the plain plug-ins. Yes, it does have a plug-in for Outlook Express and Eudora but not for Netscape Mail. I had to modify the gnupg options so pgp could decrypt it too. Well, my major concern is Netscape Mail actually but in general, I would like a plug-in for plain, "clean" gpg. How do you solve the problem with the front end decryption?
Using AJAX With A PHP Front Controller
I have a framework that uses the front controller design pattern for a single point of entry to the application and the autoload function for includes. I am trying to incorporate AJAX into the framework, but the javascript calls to php ignore my front controller code when instantiating classes.
MySQL FRONT Is Evil
I was trying to work out a text field that was not able to input data into the database. After trying every possible thing and posting problem on the forum as well, today I thought of doing something different. At that time my database was created using MYSQL FRONT, So today I created one in phpMyAdmin and guess what? It worked just fine with the exactly same code. Mysql Front is evil!! took so much of my time. If anyone of you is having issues that does not make sense and are using Mysql Front, then it might be worth trying phpMyAdmin.
HTML, PHP, Front Page
I use Front Page 2000 to devolp my web content (don't hate me I just happen to like WYSIWYG better than physically writing out the code for HTML (a pain in the butt language :-) ) Anyways does anyone know if I can have it save files as .php instead of .html and use them in the web setup. Also another question how do I get a server to load index.php instead of index.htm?
FRONT PAGE + PHP (simple)?
I'm working on litle host site. It will give free hosts to users and accept donations (if any). I have problem with combining site who is build with front page (just html) with who is script. I can not insert code of php in my page without errors.
HTML In Front Of XML While Using SOAP. Please Help.
I am writing some dotNET code to "consume" a web service written in PHP. So far I have been getting some error messages and PHP seems to place HTML text in front of the XML message. dotNET doesn't expect the XML and then it chokes. This is what I get. The <br> tag from namespace is not expected. Line 1, position 2. I was able to capture the data going through the network and I've got the outgoing and incoming messages. I put those at the end of the post because they are too long. Looking at them you can perfectly see the HTML I mentioned. In this case the HTML part says I am missing arguments. That should be an error message coded in SOAP. But there is more. There is an actual SOAP error message, it looks like even when the call was bad it executed the code; it must have put something on the missing parameters. My biggest issue is that the HTML prevents me from doing proper error handling on my side of the app. Is this fixable?
Ebay Listings Using Front Page
Anyone know the best way to get page created in front page 2002 in an ebay listing. I've created a page but a lot of the format and graphics are missing when viewed in ebay
Add A Little Peice Of Code In Front Of Every Link?
I have a site that I recently added in SEO urls. Everything works great, but none of my links go to the seo. So I need a script that would add in a $variable before every link, automaticly. Since I am not too skilled in php is would be really hard or me.If you are a PHP guru out there could you whip this up or me?
WordPress Front Page Display Problem......What Should I Do?
I use wordpress's latest version. I found one problem. I set up that from Reading section only 5 post should be visible on my site and also summary size. After click on update button and refresh my browser and see that, my all post are showing on my site's front page and every post also full form. I don't know what's the problem. I am not expert in php.So, I can' fix it.
PHP Script Putting Slashes In Front Of Apostrophes
I just put up a script where people can make their own quizzes, but when a user inputs a word with an apostrophe, it displays on the page with a slash in front of it. For example: Eric/'s Quiz Is there anyway to fix that? The script is called phpQuest 0.15 from a site that's no longer around, and I couldn't find any help about this issue on the Archived version of the website.
** ONLINE DATA INSERT --> MYSQL Front & PHP Script **
Im using MySql front and PHP 5 for some web shop. I didn't try it so far but i guess that the online data insertation ( accept costs and time ) should be the same process like for local connection. Problem: I have to create online ( on remote server ) some 6 tables and some 20 fields with MySql front. Ok. This shouldn't be great problem ( i hope :-)). The bigger problem is that i need to insert cca. 450 products ( into differnt tables (products, pro_groups ... ) ) and i dont know how to make this online. For now ( 20 products ) i made all this thru localhost but now i have to insert much more data and all this online... The data is sorted thru groups ( 8 major groups ) so every product is part of some group. How can i insert data, online and how to pass so much products from localhost to remote server ( maybe by reading some .txt file ? ).....
SimpleXML
What, besides the new php 5.0 zip package, do I need to get SimpleXML to work on my testing server? The docs say to copy libxml2.dll to the system32 directory but I can't find this dll anywhere in the binary package (or anywhere else for that matter). I'm running IIS 6.0 fwiw.
Using SimpleXML
I have started using SimpleXML and can do most things, but there are a couple of things that I can't seem to figure out. Currently, I can: 1. Open & load an XML file 2. Manually parse the XML file 3. Search the XML file using XPath 4. Make changes to existing nodes (values) However, I can't seem to be able to: 1. Add a new node / element. 2. Save my changes back to the XML file Am I missing something, or are these things that currently cannot be done with SimpleXML?
Valid XML For SimpleXML
I'm trying to use SimpleXML but I've run into a conundrum. Every day an XML file is generated that this script grabs and manipulates. How can I check that the XML has no problems before creating my SimpleXMLelement object. Here's what I mean: // this is the code in question: $file_topstory = /some/xml/file.xml $top_story_xml = new SimpleXMLElement($file_topstory, NULL, TRUE); If the XML doc contains (for example) a URL with an '&' in it then the script fails. I'd like to do something like this: if(is_valid_xml($file_topstory)){ $top_story_xml = new SimpleXMLElement($file_topstory, NULL, TRUE); }else{ // ERROR }
How To Authenticate When Using SimpleXML
I've got an RSS feed I'd like to consume from our Sharepoint server. When I try: $xml = simplexml_load_file($url); I get failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized This is understandable as I need to specify a username and password to access the RSS. How can I do this with SimpleXML, or, should I first call the URL with cURL and work with the stream locally? I thought there may be some global params I could set for the stream handling library of PHP.
PHP5 Simplexml
I'm trying to output from an XML string and am having no luck. I'm using PHP5 here. If I print_r the array I get all the results plus extra text, but am unable to extract the individual response. Any pointers appreciated. Here's the code that shows the results... $get_all_value = $xmlrpc_resp->value(); $albums_array = php_xmlrpc_decode($get_all_value); print $albums_array['string']; Here's the result string that I want to break up ... xmlrpcval Object ( [me] => Array ( [string] => <photos page="1" pages="1" perpage="500" total="155"> <photo id="114766115" owner="xxxxxx" secret="xxxxxx" server="50" title="Water Pump, Bushy Park" ispublic="1" isfriend="0" isfamily="0" /> <photo id="114765757" owner="xxxxxx" secret="xxxxxx" server="36" title="Deer, Bushy Park" ispublic="1" isfriend="0" isfamily="0" /></photos> ) [mytype] => 1 [_php_class] => )Many thanks
SimpleXML Question
I'm running in to a little issue with SimpleXML, and wondered if anyone knew if it was normal implementation for SimpleXML, or I'm not using a correct flag, or even it's a an issue that should be resolved. I'm actually only just starting to use SimpleXML with any vigor, so I may well be mistaken about what I think it should do... Basically, if you take this simple chunk of XML:
Merging XML In PHP Using SimpleXML And DOM
I'm having trouble trying to merge two SimpleXML objects (user preference settings) in PHP. It should be simple enough - the objects have the same root element, and I simply want to merge at the top child level. However, the code I'm providing here, while it executes, does not work. At the end of the merge() function, the merged preferences are empty. Code:
Writing To XML Using Either DOM Or SimpleXML
I've been having quite some trouble figuring out specific XML coding in PHP5. I'm trying to edit and remove specific tags in a specific way using DOM (I'd rather use SimpleXML but it seems rather limited on this area). Code:
Parse Xml-rpc Using SimpleXML
I am trying to parse through a XML document...a XML-rpc response to be exact...the good thing is the code is doing as its told. Code:
SimpleXML Catching 404
I'm building a script with the last.fm datafeeds. When a incorrect username is given to the script, the last fm site throws a 404, and results in this PHP error: Warning: simplexml_load_file(http://ws.audioscrobbler.com/1.0/user/RichardJohn/tasteometer.xml?with=) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home/richardm/public_html/lastfmcompatibility.php on line 12 Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://ws.audioscrobbler.com/1.0/user/RichardJohn/tasteometer.xml?with=" in /home/richardm/public_html/lastfmcompatibility.php on line 12 There was a problem loading the data feed. Is there a way to catch this error and just present a friendly error?
SimpleXML & Google Images
I'm writing a script that would (hopefully) search google images for whatever, and then return a list of URLs for the image. Right now I have: $dom = new DomDocument(); $url = "http://images.google.com/images?q=hello"; $dom->loadHTMLFile($url); $sxe = simplexml_import_dom($dom); foreach($sxe->xpath('//img') as $node) { echo $node->src; } What this is supposed to do (line by line): Make a new DomDocument Define $url load the HTML file from $url make a simpleXML object from the loaded DOM go through all the image tags (using a DomNodeList w/ xpath) and print out the src attribute of the node.
How To Search Xml W/simplexml Using Xpath()
I've been lookin over some simplexml notes/docs and i havent really found a way to search and return results example: <?xml ...?> <products> <cat1> <item> <name>product 1</name> <color>blue</color> </item> </cat1> <cat2> <item> <name>product 2</name> <color>blue</color> </item> </cat2> </products> if the user searches "blue", then i should be able to step through and process the valid <item> structures... same for if they search for "product 1", then just process the one valid structure (including its category)...
Weird Chars When Parsing With SimpleXML
I'm using php-5.0.5-pl3; I've created a collector class which populates itself with DOM's nodes from every object which needs to output data. So, at the end of the process, the collector has every piece of the result in a XML document. After this, I need to process the XML document according to the user document request (HTML, XML, Excel, etc.); to accomplish this, I'm using a SimpleXML to parse every node and reinterpret it. I've successfully accomplish HTML transformation, but I've trouble with Excel because some numeric entities aren't translated properly. For example: Importación (Importación) is translated to Importación Acuática (Acuática) is translated to Acuática España (España) is translated to España .... and so on. Is there any function to translate properly the accuted vocals ?
|