Search the Community
Showing results for tags 'xml'.
-
Basically, I am writing a script in PHP, which can take YouTube videos from playlists, items from RSS feeds and podcasts, and individual YouTube videos and files, and places them into an XML document, so they can browsed and kept in one place. I also have a script which removes these items, if the user wants. The problem I'm facing is with characters. Because I can't control what the user will name their videos/files, or how they're named in the feed, the titles could have quotes, brackets, ampersands, hashes etc, which causes problems when they're being removed and Because I'm using Xpath (which can be temperamental at the best of times) in the remove script, any items with titles with these characters won't get removed. Here's my remove code: <?php $q = $_GET["q"]; $q = stripslashes($q); $q = explode('|^', $q); $counts = count($q); unset($q[$counts-1]); $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->Load("../$userid.xml"); $xpath = new DOMXPath($dom); foreach ($q as $r) { $r = preg_replace("|&|", '&', $r); $r = preg_replace('|"|', '"', $r); $query1 = 'channel/item[title='.$r.']/title'; $query2 = 'channel/item[title='.$r.']/media:content'; $query3 = 'channel/item[title='.$r.']'; $entries = $xpath->query($query1); $entries2 = $xpath->query($query2); $entries3 = $xpath->query($query3); foreach ($entries as $entry) { foreach ($entries2 as $entry2) { foreach ($entries3 as $entry3) { $oldchapter = $entry->parentNode->removeChild($entry); $oldchapter2 = $entry2->parentNode->removeChild($entry2); $oldchapter3 = $entry3->parentNode->removeChild($entry3); $dom->preserveWhiteSpace = false; } } } } $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->save("../$userid.xml") ?> How it works is when the user selects the items they want to remove, using a select box, the selections are put into the URL. My code extracts the titles from the URL, separated by "|^" (For example title1|^title2|^title3|^). Because the "|^" is appended to the end of each title, I have to remove the empty value from the array. Then I load a new DOMdocument, and find the titles from the URL in my existing XML document. Then I want the code to remove the whole items (titles, urls and the item itself) which have the same titles as the ones in the URL, and then save the document, but because some of the titles could have &, ", * or #, they don't get removed. Is there a way that I can maybe screen, and change the characters to get it to work (I tried this with "preg_replace", but it didn't work), or even change them before they're saved to the XML in the first place? Any advice?
-
I have several xml files in a folder on my webserver. I want to 1. look in the folder 2. get xml file names 3. put file names into array 4. loop those names into a mysql query 5. have contents of all xml files inserted into db $files = glob('*.xml'); foreach($files as $file){ mysql_query("LOAD DATA INFILE '".$file."' INTO TABLE tablename ROWS IDENTIFIED BY ''"); } I've spent a couple of days looking for an example or tutorial but can't find anything online. Above is the best I can come up with. Any help appreciated
-
Hello fellow programmers, I'm having problem with passing soap request this xml schema is the SOAP request I must pass to the server : http://pastebin.com/1PjXzVLm I use this code http://pastebin.com/tgspY7rg but I don't seem to succeed, any help is appreciated
-
Recently i have started Flight portal website. In that for displaying the details of flight like availability, cancellation , fare , etc.. i am sending a SOAP XML request in php the code is as below <?php $xml_data="<arzHotelAvailReq><clientInfo> <username>UdooInXML</username> <userType>ArzooHWS1.1</userType> <userID>77743543</userID> <password>*CB8</password> <partnerID>1002</partnerID> </clientInfo> <requestSegment> <currency>INR</currency> <searchType>search</searchType> <residentOfIndia>true</residentOfIndia> <stayDateRange> <start>22/03/2013</start> <end>23/03/2013</end> </stayDateRange> <roomStayCandidate> <guestDetails> <adults>1</adults> <child> <age>3</age> <age>5</age> </child> </guestDetails> <guestDetails> <adults>2</adults> <child> <age>2</age> </child> </guestDetails> </roomStayCandidate> <hotelSearchCriteria> <hotelCityName>BANGALORE</hotelCityName> <hotelName></hotelName> <area></area> <attraction></attraction> <rating></rating> <sortingPreference>1 </sortingPreference> <hotelPackage>Y</hotelPackage></hotelSearchCriteria></requestSegment></arzHotelAvailReq> "; Here the soap client request code comes. and i am getting the response. Everything is fine upto here. But i am getting the response in a irregular text format like as below. 100200 INR search 22/03/2013 23/03/2013 1 3 5 2 2 BANGALORE 1 Y true 00005380 Veekay Tourist Home Overlooking the beautiful park, this homely abode is close to the ISKON Temple. Across three floors are 80 AC and non-AC rooms, which are maintained with room service. Guests can experience the essence of the city with a tour, which is organized by the home on demand. There is free parking facility provided to the guests to park their vehicles. 1 2 400 033 arzooB 91/1, Railway Parallel Road Yeshwantpur NA Overlooking the beautiful park, this homely abode is close to the ISKON Temple. Across three floors are 80 AC and non-AC rooms, which are maintained with room service. Guests can experience the essence of the city with a tour, which is organized by the home on demand. There is free parking facility provided to the guests to park their vehicles. NA NA NA NA 00:00 12:00 All NA NA Air_Conditioning,Restaurant,Conference_Hall,Health_Club,Travel_Desk,Transfers,Forex,Shopping,Swimming,Banquet,Business_Center NA cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/ryj/lbn/HO_TN.jpg N N Non AC Room No Amenities 0000019527 0000068265 11111111 +yWrLQerwfpRqCOBdo4d4Q+fTZgh1nupLJ4p4u6ke0DnoKrM1YnV+CyeKeLupHtAek/xho0eiejEOsNqkniCrj61Dp4lgPVpxhyWcxAZvAY6eaST9cxEwO77vKeHzGt7xDrDapJ4gq4OONbvuHIwesuQNW1tG3pMLXm9B6RXzcuVQyNiR9Nkmc5UwHnlMe/3R4pOa9nZpzWvpc4Pgi4QldI0kqzTn0R2SrrkswfU4tEe+FrLnNX0ikMr6KYsRwZ5weOUbgjswoE6Gc2xDYzFhoJPdnFEgTGV53WGRs0ArO3XjoptM/3++Ebal1NQKw41+CLkev7bTS2uy9dZCeYpxW/ouG38h9xmYh+h8WdKEfuf5HK8TIYqr3cMt7sdhfmbFluz6IhIkl5gGOFLUgob5fJgMkJc5m29X6/0s/8xt7Kj8slKZijCITtF+SlZboPr 84 751 0 0.0 0 N N AC Double No Amenities 0000019528 0000068266 11111111 MqJjfxbuxrY6eaST9cxEwDETzbfNeAOGmk9s1Uz6PbYSZIViwgQiY5pPbNVM+j22FHM8WEydgwBkOaDlTL6ZjC9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6k+Ld9K5fVWUdDznXXQXDz4XzARG+d1YhoTBLNxtfNxqmAcSIgU/v1x3EOsNqkniCrr6b1Ug4ytFJZ/0FayiZJBkPeiwpn9EJwEbIPnPEbTR4lWhM0grn0WLZ56unmN2SYl3cbsmEPmwq2OuHVC1F8Hu84Nfh1MF/h4/ba1HimMaE+uDhm6Ks2qonJVGPUcpVXdQrEjcaz9CVv8aChDAx1MrEOsNqkniCrtPU6ffG6Zo+VJRf6bY5MD9Jpvu9wmltGrCdLm1c957TFF2epIoxL54OaXRTmdyfd1yCAU1C72cA 0 1684 60 0.0 0 00005020 U.G.DELUXE Located near to the Srinivasa Nursing Home, this brand new smoke-free property on the block is maintained with 42 deluxe rooms, which includes A/C and non-A/C accommodations. There are three dining outlets, namely Malabar Vegetarian Restaurant, Krishna Bhavan, and Sukh Sagar, which are all open for service from 6a.m to 10p.m. The property is designed with a garden area, where guests can lounge. They can also avail the assistance of the travel desk and take a tour of the beautiful city. 0 2 550 061 arzooB #9/1, 2nd Cross,Thulasithotam Balepet Near Srinivasa Nursing Home NA Located near to the Srinivasa Nursing Home, this brand new smoke-free property on the block is maintained with 42 deluxe rooms, which includes A/C and non-A/C accommodations. There are three dining outlets, namely Malabar Vegetarian Restaurant, Krishna Bhavan, and Sukh Sagar, which are all open for service from 6a.m to 10p.m. The property is designed with a garden area, where guests can lounge. They can also avail the assistance of the travel desk and take a tour of the beautiful city. NA NA NA NA 00:00 12:00 All NA NA Air_Conditioning,Restaurant,Conference_Hall,Health_Club,Travel_Desk,Transfers,Forex,Shopping,Swimming,Banquet,Business_Center NA cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/rym/fbn/HO_TN.jpg N N Double Deluxe Non AC No Amenities 0000018167 0000058501 11111111 6rHbdJ5eYI7GHJZzEBm8BvOaNWWi+RUhLJ4p4u6ke0DPzHJ7gHRp3iyeKeLupHtAhduj3Vq+cinEOsNqkniCrj61Dp4lgPVpxhyWcxAZvAY6eaST9cxEwO77vKeHzGt7xDrDapJ4gq4OONbvuHIwepH1wYi4aVVmDxAoeeQIBeo7G/tKB6tJOYDfWwbV0F7ASAS/psz+s/vtFOZDhaz6EtGf96t/LsuWxw1Qqnbhmf3XYWyQ7VUjC8Q6w2qSeIKuoKFs0O+FVtNhRIfAcxLjf86bGU9wLBRNvD/Qlqcc//JzmIzIGoODhM1oJoq2rZMN1gD5nlU38lH0iT7gaoTgQlkLlahFGUKDXPHozEiWFpzUKxI3Gs/Qlb/GgoQwMdTKxDrDapJ4gq7T1On3xumaPlSUX+m2OTA/Sab7vcJpbRqwnS5tXPee0xRdnqSKMS+eDml0U5ncn3eFGMF7Jssn/w== 0 966 44 0.0 0 N N Double Deluxe AC No Amenities 0000018168 0000058502 11111111 sSCoszzZkH86eaST9cxEwDETzbfNeAOGmk9s1Uz6PbZGv/SG567OsZpPbNVM+j22DfbGKTDMXKFkOaDlTL6ZjC9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6kznLtLUAmNXdxBAFTfOqI33OVMB55THv90eKTmvZ2ac1r6XOD4IuEJXSNJKs059Edkq65LMH1OLRxhyWcxAZvAZDK+imLEcGecHjlG4I7MKBOhnNsQ2MxYZ+oLyPTZ3RMaAnkAotaRPKKfHYXniQp/S8zzpKPZaLArk7+CKaeLo9hOB8fqTxssT128imfeXuC/OgEXYIgsG2UHFvTjsO+sCf5HK8TIYqr+4vK3ryvrJwFluz6IhIkl4/hAHmlwnis6hroDhh/C42mx8+gs3lzQiWJgzCcdsB9fCEqLc7/4v1LJ4p4u6ke0CUdoTzsl6ZtBfc5EobFJGF 0 1318 60 0.0 0 00004788 U.G.ROYAL Strategically located near to the railway station by 2kms, this smoke-free property is designed with 3floors with an elevator, and maintained with 24 rooms to reside in. The property is also maintained with a garden space and a travel counter for all travel assistance. A vegetarian fare can be savoured in the nearby Sukh Sagar Restaurant and non-vegetarian fare can be relished in any of the neighboring dining outlets, namely New Grand and Hyderabad. 0 2 650 062 arzooB # 42, Cottonpet Main Road NA Strategically located near to the railway station by 2kms, this smoke-free property is designed with 3floors with an elevator, and maintained with 24 rooms to reside in. The property is also maintained with a garden space and a travel counter for all travel assistance. A vegetarian fare can be savoured in the nearby Sukh Sagar Restaurant and non-vegetarian fare can be relished in any of the neighboring dining outlets, namely New Grand and Hyderabad. NA NA NA NA 00:00 12:00 All NA NA Air_Conditioning,Restaurant,Conference_Hall,Health_Club,Travel_Desk,Transfers,Forex,Shopping,Swimming,Banquet,Business_Center NA cdn.travelpartnerweb.com/DesiyaImages/Image/1/nxd/maw/syf/lbv/HO_TN.jpg N N Double Deluxe Non AC No Amenities 0000017219 0000054610 11111111 oHS5Xd5Exyg6eaST9cxEwGZSjnNN3mhmmk9s1Uz6PbaNc1sEsAf/6JpPbNVM+j22if6NKX9Uk13Dy1lDA4noii9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6kznLtLUAmNXdU8J0wP+0TP07G/tKB6tJOYDfWwbV0F7ASAS/psz+s/vtFOZDhaz6EtGf96t/LsuWxw1Qqnbhmf3XYWyQ7VUjC8Q6w2qSeIKuoKFs0O+FVtN4j8rH+f6mNO5qfq4xpPlORexVeZq9N0yqKIuRorLprNQrEjcaz9CVv8aChDAx1MrEOsNqkniCrtPU6ffG6Zo+VJRf6bY5MD9Jpvu9wmltGrCdLm1c957TFF2epIoxL54OaXRTmdyfd0BBbtk2xLpA 0 1142 52 0.0 0 N N Deluxe Double AC No Amenities 0000017221 0000054612 11111111 TxbgXP3Nk6o6eaST9cxEwO0QCFlSnc8Cmk9s1Uz6PbaNc1sEsAf/6JpPbNVM+j22fMzm237c+vR3p+iuYvo+Ai9zLGtHv0ypOnmkk/XMRMAPn02YIdZ7qUC2Sm/k4OAAweOUbgjswoF0RTNIMdh6kznLtLUAmNXdU8J0wP+0TP07G/tKB6tJOYDfWwbV0F7ASAS/psz+s/vtFOZDhaz6EtGf96t/LsuWxw1Qqnbhmf3XYWyQ7VUjC8Q6w2qSeIKuoKFs0O+FVtN4j8rH+f6mNO5qfq4xpPlORexVeZq9N0yqKIuRorLprNQrEjcaz9CVv8aChDAx1MrEOsNqkniCrtPU6ffG6Zo+VJRf6bY5MD9Jpvu9wmltGrCdLm1c957TFF2epIoxL54OaXRTmdyfd4cJw1cUhwyo 0 1580 72 0.0 0 00004786 U.G.GRAND A large photo frame of Lord Venkatesh at the lobby welcomes guests to a comfortable stay in this four floors hotel located in the NP Lane. There are 16 rooms facilitated with 24hours room service. A vegetarian fare can be relished at the Krishna Sagar Delhi Restaurant, which is open for service from 6a.m. to 10a.m., and non-vegetarian fare can be savoured in the Hyderabad Biryani Restaurant, which can be visited between 10a.m. to 11p.m. There is free valet parking facility also available in this hotel. 0 2 650 108 arzooB NO.10,N.P. LANE,COTTON PET BEHIND SHANTALA SILKS So here i want to arrange that response in a designed format. How can i do that. Please give me your valuable suggestions. Thanks in advance, Sree ram
-
I have a feed that contains over 10000 vehicles and is about 300 mb and trying to grab and display the name and the price of each vehicle.The problem is it displays all the data in the feed. Below is the feed that i used <vehicle> <type>Double Cab </type> <price>19.5k</price> <model>GTX</model> <descrip>sdsadasdasdsa</descrip> </vehicle> <vehicle> <type>Cruise </type> <price>78k</price> <model>Ultra</model> <descrip>sdsadasdasdsa</descrip> </vehicle> <vehicle> <type>Jeep/ Wagon </type> <price>2k</price> <model>Body Kit</model> <descrip>sdsadasdasdsa</descrip> </vehicle> I’m using the below code. $url = 'vcfeed.php'; $xname ="test"; $xPassword ="testuser"; $post_data = array("username" => $xname, "password" => $xPassword"); $ch = curl_init($url); $c[CURLOPT_POST] = true; $c[CURLOPT_POSTFIELDS] = $post_data; foreach($c as $k=>$v){$c[$k] = $v;} curl_setopt_array($ch,$c); $xml = curl_exec($ch); curl_close($ch); $z = new XMLReader; $z->open($xml); $doc = new DOMDocument; while ($z->read() && $z->name !== 'vehicle'); while ($z->name === 'vehicle') { $node = simplexml_import_dom($doc->importNode($z->expand(), true)); echo $node->model; echo $node->price; $z->next('vehicle'); } Although i have used echo $node->model; echo $node->price; It doesn’t show those 2 values for each result. Can someone tell me what am i doing wrong here?
-
Hi Gang, New forum user here... I'm using a wordpress build which has broken and I'm getting an error log of "String could not be parsed as XML" on the twitter.php doc that comes with the theme. Here is the error log: And here is the code section in question: The "$xml = new SimpleXMLElement($data);" line is line 86 referenced in the error log. I don't care about having twitter embedded on my site, so disabling anything is fine, but I need help! Thanks! Greg
-
Can anyone give me an idea on how I will count the table column and table row and get the id, attribute and the content of a each cell (the cell is contenteditable). What tools i have to use. e.g. <table id='sheet'> <tbody> <tr> <td id='1A' rowspan=2>Rowspan 2</td> <td id='1B'>22222</td> <td id='1C'>33333</td> </tr> <tr> <td id='2B' colspan='2'> Colspan2</td> </tr> <tr> <td id='3A' style='color:red'>Whaterver</td> <td id='3B' style='font-weight:bold'>Askyourmother</td> <td id='3C'>sigh</td> </tr> </tbody> </table> I'm using PHP and Jquery(Javascript). Thanks. .
- 5 replies
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
Hi I have this document <?xml version="1.0" encoding="UTF-8"?> <users> <user><name>Skuilnaam</name><score>8</score></user><user><name>Skuilnaam1</name><score>10</score></user><user><name>cobus</name><score>5</score></user></users> I need help to make a php script that will delete the records inside this page for me can anyone help me to construct such a page please?
-
I have a table that has a row and column with different style and colspan etc. Does anyone know how to convert it HTML to XML file with the designated style Using PHP. Cause I going to convert it the xml to xls also. <table> <tbody> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> </tr> <tr> <td>1</td> <td>2</td> <td colspan='2'>34</td> <td>5</td> </tr> <tr> <td stye='font-weight:bold'>BOLD</td> <td stye='font-style:underline'>underline</td> <td stye='font-stye:arial'>Italic</td> <td stye='font-familty:aria'>Arial</td> <td stye='background-color:Blue'>Arial</td> </tr> </tbody> </table>
-
This is an example of my code: $status = $entry->title; echo substr(strstr($status," "), 1) . substr($status, 0, -18); Below is the outcome: I'm feeling cold in this room. #emotionalclothingPants: I'm feeling cold in this room. I want the oucome to look like this: I'm feeling cold in this room. Thus removing the "#emotionalclothing" part of the string How can this be achieved? Thanks Stuart
-
I am trying to include the latest post from a tumblr blog in my website, which works fine. I can't figure out how to choose a specific size of photo from the API, such as the 500px photo. <?php $numPosts = 3; $feedURL = "http://jeffhui.tumblr.com/api/read/?num=$numPosts"; $xml = simplexml_load_file($feedURL); foreach($xml->posts->post as $post){ $title = (string) $post->{'regular-title'}; $posts = (string) $post->{'regular-body'}; $photo = (string) $post->{'photo-url'}; $caption = (string) $post->{'photo-caption'}; echo"<h2>".$title."</h2> <p>".$posts."</p> <p><img src=".$photo."></p> <p>".$caption."</p>"; } ?> Some one posted this online and say it has to loop through them like this, but I dont know how to apply the bellow script into my. <?php $xmlResult = file_get_contents($tumblr_url_aktuell); $xml = simplexml_load_file($tumblr_url_aktuell); foreach($xml->posts->post->{'photo-url'} as $photoURL){ if((string)$photoURL['max-width'] == '500'){ $image = $photoURL; } } ?>
-
Hello! I was wondering if anyone can help me with attempting to load information on the following XML feed: http://www.tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml Into PHP. I only need information displayed for station ids 51,123 and 344. Any advice or help would be much appreciated. I've attached the code I've used to load up RSS feeds. I'm using iwebkit to develop an iPhone friendly website. Many thanks rss.php
-
I am having issue on my PHP photo gallery. The album name is generate by the folder name as below: '. $_GET['album' So what I am trying to do is to show some external xml date in the gallery base on different albums name, I now tested with 3 different albums with the folder name Adriana, Alicia and Eva. Once again the album name is generate by the folder name. $folder_name = $_GET['album']; echo $folder_name; The above code is working to get the title on specific folder name of that album. Next I have a external xml file with different info for each album. Which I would like to show different info for each album. my xml file as below: <?xml version="1.0" encoding="UTF-8"?> <library> <models> <Adriana>This is the model info of Adriana</Adriana> <Alicia>This is the model info of Alicia</Alicia> <Eva>This is the model info of Eva</Eva> </models> </library> I first tested with this code to make sure it can read the "info": <?php $url = 'albums/Adriana/info.xml'; $xml = simplexml_load_file($url); $info=$xml->models->Adriana; echo $info; ?> Above code works fine, but what I really need to do is something like this, and this is the part that I got an error. $info=$xml->models->$folder_name; Please let me know what am i missing on the above line.
-
First, thanks in advance for any help. Here's my issue. I've read through tons of similar problems here but I don't think I'm understanding this enough to make this work. I have an XML file such as: <unitlist> <unit> <iterator>0</iterator> <route>2</route> <rt_name>'Riverfront Streetcar'</rt_name> <name>457</name> <lat>2956.21014</lat> <lng>-9004.62839</lng> <bearing>2.14501</bearing> <car_type>'RTA Street Cars'</car_type> <speed>16.57122</speed> <GMT>043432</GMT>[/indent] </unit> <unit> <iterator>1</iterator> <route>10</route> <rt_name>'Tchoupitoulas'</rt_name> <name>250</name> <lat>2958.0927</lat> <lng>-9005.28724</lng> <bearing>1.532399</bearing> <car_type>'RTA Buses'</car_type> <speed>0.6904677</speed> <GMT>104620</GMT>[/indent] </unit> </unitlist> What I want to do is, for each <unit>, import all attributes of that unit (iterator,route,rt_name, etc, etc, etc) into my mySQL database. My problem is that, all it's doing is importing the same attributes of the first <unit> the number of times that <unit> exists. In this example, it's importing the same information from the first <unit> twice, as two records/rows. If I had 90 <unit>s, it would import 90 identical records. Here's my code: foreach($unitlist->unit as $unit) { //insert into database mysql_query("INSERT INTO businfo (iterator,route,rt_name,name,lat,lng,bearing,car_type,speed,GMT)VALUES (\"$iterator\",\"$route\", \"$rt_name\", \"$name\", \"$lat\", \"$lng\", \"$bearing\", \"$car_type\", \"$speed\", \"$GMT\")") or die(mysql_error()); } Can anyone explain what I'm doing wrong? Thanks again for the help! - dan -
-
Hi PHP expert, I am trying to read the post date from my tumblr api with the following code. $date = $xml->posts->post ['date']; echo '<p>'.$date.'</p>'; This is what I get from the above code "Wed, 21 Nov 2012 13:32:00" My question is, are there anyways I can get the date with out the hour, min and seconds? for example "Wed,21 Nov 2012"?
-
Hi Chaps, I have been given an invalid XML file, which when run through 3rd party software, gives me the line & column numbers of the error. Instead of opening the file and manually searching for the line/column numbers (which can take a whie, as the file is vast!), is there a way to parse the XML file and locate the error, using the line/column numbers? And maybe display/highlight the error in a browser? e.g.: 1: open bad-file.xml 2: read bad-file.xml 3. go-to line 50 4. go-to column 3620 5. open in browser 6. highlight error Cheers S
-
Hi, Firstly as a disclaimer, I am not requesting any code to be supplied, this is to be used in a University project and I am aware of the relevant regulations and would like to create the code myself, I am only trying to get help pointing me in the right direction. I am using PHP to display the contents of a MySQL database, as part of the product I would like to display the database in a format similar to a directory browser. I am reading in from an XML file of the database which is created using MySQL dump, I would then like to be able to iterate through this and display the Databases and tables in a list almost, but one that is dynamic and possibly interactive to the point of being able to select tables and fields to be able to view in more detail in another part of the program. Is this possible to achieve using PHP or any other languages that can be incorporated into this program. As an example, below is how I would like to display the contents to the user, with the + and - representing the default standard or showing more or less sub content. +ROOT -MySQL -Schema -Table 1 -File 1 +Table 2 +User Table 1 Thanks in advance for any help. Regards, Tom
-
Hey All, I am using a web service and am getting the response formatted like: http://pastebin.com/raw.php?i=AjDXXf66 e.g. [[["test","test","",""]],[["noun",["test","essai","épreuve","examen","contrôle","analyse","interrogation","épreuve pratique","épreuve de force"],[["test",["test"],,0.23752081],["essai",["test","trial","testing","essay","assay","try"],,0.12913783],["épreuve",["test","proof","trial","examination","print","crucible"],,0.028814545],["examen",["review","examination","test","investigation","inspection","testing"],,0.010767208] ... ... ... To my knowledge it is some kind of expression of a multidimentional array however I've never seen a response like this. Is there a way I can convert this format to clean XML?
-
3. Given a function specialSum(x,y,z) that: a. Returns the sum of (x, the absolute value of y, z) e.g. x+|y|+z b. All parameters are optional c. Always returns an integer. What values of x, y, z, and return value are necessary to verify that this function performs as specified in PHP? To start you out specialSum(2+2+2)=>6 and specialSum()=>0 are two of the tests I’m looking for. Are there any differences in Javascript? 5. Identify potential problems and inefficiencies with the following Javascript, explain each problem and how you would fix it. Not all problems are syntactic. <script type="text/javascript"> function newObject(objectName) { ex = "ret = new " + objectName + "();"; eval(ex); return ret; } startUp = newObject('PSUtil'); if ( startUp.message != undefined ) { document.getElementById('startMessage').value = startup.message; } startUp.engine = newObject(startUp.workingClass); startUp.specialElements = givenSelectionFunction(); function wireFunction(elements ) { for ( i=0; i < elements.length ; i ++ ) { el = document.getElementById(elements); for ( i=0; i < startUp.specialElements.elements.ids.length ; i++ ) { if ( elements == startUp.specialElements.elements.ids ) { el.onchange = startUp.specialElements.specialFunction; } } for ( f in funcs ) { el.attachEvent(f,funcs[f]); } } }; wireFunctions ( startUp.engine.veryLargeArrayOfElementIDs); function givenSelectionFunction() { var elementArray = new Array(); working = document.getElementsByTagName('special'); for ( i=0; i<working.length; i++ ) { var myTestFunction = function(el) { if ( /* some complex test of el that must be in a function */) { return true; } else { return false; } }; if (myTestFunction([working) ) { elementArray.push(working); } } return
-
I'm having a problem putting together a XML file with the right format required by the webservice I want to use. I'm using the nusoap class to do it. The error I'm getting: Array ( [Reservation_Data] => Array ( [Reservation_Value] => 0 [status] => ERROR_Create_Internacional_Reservation: Object reference not set to an instance of an object. - 0 ) ) My request is: POST /Rentway_Internacional_Reservations_WS/Create_Reservation.asmx HTTP/1.0 Host: www.xxxxxxx.pt User-Agent: NuSOAP/0.9.5 (1.123) Content-Type: text/xml; charset=UTF-8 SOAPAction: http://www.xxxxxxx.pt/Rentway_Internacional_Reservations_WS/Create_Internacional_Reservation/Create_Internacional_Reservation Content-Length: 714 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns3785="http://tempuri.org"> <SOAP-ENV:Body><Create_Internacional_Reservation xmlns="http://www.xxxxxxxxx.pt/Rentway_Internacional_Reservations_WS/Create_Internacional_Reservation"> <Reservation_Request> <MessageType>N</MessageType> <Group>01</Group> ........................... </Reservation_Request> </Create_Internacional_Reservation> </SOAP-ENV:Body> </SOAP-ENV:Envelope> My code is: require_once('nu-soap/nusoap.php'); require_once('config.php'); $client = new nusoap_client('http://www.xxxxxxxxxx.pt/Rentway_Internacional_Reservations_WS/Create_Reservation.asmx?wsdl', true); $param = array('Username'=>'xxx','Password'=>'xxx','MessageType'=>'N','Group'=>'01'); $result = $client->call('Create_Internacional_Reservation', array('Reservation_Request' => $param)); When getting information about the request on the webservice's manual which I was advised to use, the only difference I can find is: Where's: Code (XML): <Reservation_Request> <MessageType>N</MessageType> <Group>01</Group> ........................... </Reservation_Request> Should be: <Reservation_Request xmlns="http://www.xxxxxx.pt/Rentway_Internacional_Reservations_WS/Reservation_Request.xsd" > <MessageType>N</MessageType> <Group>01</Group> ........................... </Reservation_Request> How can I send (xmlns="http://www.xxxxxx.pt/Rentway_Internacional_Reservations_WS/Reservation_Request.xsd" ) inside Reservation_Request ?
-
In searching how to wright cdata tags into my xml document using simpleXML i came across this example and when i try and use it Dreamweaver shows that lines 4-7 are wrong i try and run the code anyway and i get this error syntax error, unexpected T_VARIABLE on line 4 <?php class SimpleXMLExtended extends SimpleXMLElement{ public function addCData($cdata_text){ $node= dom_import_simplexml($this); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($cdata_text)); } } $xml_doc = new SimpleXMLExtended('save.xml',NULL,TRUE); $email = $xml_doc->addChild('email'); $email->addAttribute('id',$id); $email->from = NULL; $email->from->addCData($from); $xml_doc->asXML('save.xml'); ?>
-
Hi! I have a webservice in asp.net that return Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/20...chema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/20...soap-envelope"> <soap12:Body> <CalculadoraResponse xmlns="http://tempuri.org/"> <CalculadoraResult> <xsd:schema>schema</xsd:schema>xml</CalculadoraResult> </CalculadoraResponse> </soap12:Body> </soap12:Envelope> I call the webservice: <?php $client = new SoapClient("webserviceaddress"); $result = $client->Calculadora(array('Param1'=>'1')); $simpleresult = $result->CalculadoraResult; ?> How can i read the result? I have another function in that webservice that return a string and everything its ok, but with this function i dont know how to read the result
- 3 replies
-
- xml
- webservice
-
(and 1 more)
Tagged with:
-
Hi guys, I'm trying to write a php page that will function as an xml sitemap. I'm getting the following error, however: This page contains the following errors: error on line 1 at column 94: Extra content at the end of the document My code is below. Any ideas? <?php header("Content-Type: text/xml;charset=iso-8859-1"); echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'; include 'includes/db_connect.php'; $sitemap = generateSitemap(); foreach ($sitemap as $key => $value) { ?> <url> <loc>http://failauthority.com/<?php echo $value['id']; ?></loc> <lastmod><?php echo date("Y-m-d"); ?></lastmod> <changefreq>weekly</changefreq> <priority>.5</priority> </url> <?php } ?> </urlset>