Jump to content

Search the Community

Showing results for tags 'xml'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hello dear php-experts - good day. note; i run linux opensuse 13.1 the final goal is to get stored some xml-files in a mysql-database. thats what i am looking for. - the xml-files are derived from a osm-request - at a OpenSteetpmap-api. and thats why i am here. Guess that you are good php and mysql-experts see the data <node id="2064639440" lat="49.4873181" lon="8.4710548"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="turkish"/> <tag k="email" v="info@lynso.de"/> <tag k="name" v="Kilim - Café und Bar Restaurant"/> <tag k="opening_hours" v="Su-Th 17:00-1:00; Fr, Sa 17:00-3:00"/> <tag k="operator" v="Cengiz Kaya"/> <tag k="phone" v="06 21 - 43 755 371"/> <tag k="website" v="http://www.kilim-mannheim.de/"/> </node> <node id="2126473801" lat="49.4851170" lon="8.4756295"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="italian"/> <tag k="email" v="mannheim1@vapiano.de"/> <tag k="fax" v="+49 621 1259 779"/> <tag k="name" v="Vapiano"/> <tag k="opening_hours" v="Su-Th 10:00-24:00; Fr-Sa 10:00-01:00"/> <tag k="operator" v="Vapiano"/> <tag k="phone" v="+49 621 1259 777"/> <tag k="website" v="http://www.vapiano.de/newsroom/?store=29"/> <tag k="wheelchair" v="yes"/> </node> <node id="667927886" lat="49.4909673" lon="8.4764904"> <tag k="addr:city" v="Mannheim"/> <tag k="addr:country" v="DE"/> <tag k="addr:housenumber" v="5"/> <tag k="addr:postcode" v="68161"/> <tag k="addr:street" v="Collinistraße"/> <tag k="amenity" v="restaurant"/> <tag k="name" v="Churrascaria Brasil Tropical"/> <tag k="phone" v="+496211225596"/> <tag k="wheelchair" v="limited"/> </node> <node id="689928440" lat="49.4798794" lon="8.4853418"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="greek"/> <tag k="email" v="epirus70@hotmail.de"/> <tag k="fax" v="0621/4407 762"/> <tag k="name" v="Epirus"/> <tag k="opening_hours" v="Mo-Sa 12:00-15:00,18:00-24:00"/> <tag k="phone" v="0621/4407 761"/> <tag k="smoking" v="separated"/> <tag k="website" v="http://epirus-ma.blogspot.com/"/> <tag k="wheelchair" v="no"/> </node> <node id="689928445" lat="49.4799409" lon="8.4851357"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="italian"/> <tag k="email" v="gianlucascurti@ristorante-augusta.de"/> <tag k="name" v="Ristorante Augusta"/> <tag k="opening_hours" v="Mo-Fr 12:00-14:00,18:00-23:00;Su 12:00-14:00,18:00-23:00"/> <tag k="phone" v="0621 449872"/> <tag k="website" v="ristorante-augusta.com/"/> <tag k="wheelchair" v="no"/> </node> with the following fields in the db: CREATE DATABASE `db123` DEFAULT CHARACTER SET latin1 COLLATE latin1_german2_ci; USE hans; CREATE TABLE `pois` ( `id` BIGINT(20) UNSIGNED NOT NULL, `lat` FLOAT(10,7) NOT NULL, `lon` FLOAT(10,7) NOT NULL, `name` VARCHAR(255) COLLATE utf8_bin NOT NULL, `amenity` VARCHAR(255) COLLATE utf8_bin NOT NULL, `operator` VARCHAR(255) COLLATE utf8_bin NOT NULL, `vending` VARCHAR(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; EDITED BY MODERATOR - DB CREDENTIALS REMOVED see the dataset; - which is stored in the file mysql.txt the dataset - it is gathered from the request on the overpass-api which resides here http://www.overpass-turbo.eu cf. http://overpass-turbo.eu/?q=PCEtLQpUaGlzIHF1ZXJ5IGxvb2vEiGZvciBub2Rlcywgd2F5xIhhbmQgcmVsYXRpb27EiAp3aXRoIMS0ZSBnaXZlbiBrZXkvdmFsxIsgY29tYmluxKvErW4uCkNoxJFzxLh5b3XEl8SoxLrEriDEpMSmxIZ0xLZoxLhSdcS-YnV0dMWfYWJvxLwhCsSCPgp7e8WAeT1hbcS9xLN5fX3FuHvFhMWGZT3EqHN0YcWbxKR0xoMKPG9zbS1zY3JpcMWkxZp0cMWsPSJ4bWwixbcgIDzFqcWQxqnGqsarxIrEjMSOdHlwxokixJnEm8aoCsawxrA8aGFzLWt2xL_Go8W5xbvGgyIgdseIxobFhcSLx4svxq_GvjxixbF4LcayxI0gxbnHmG94xoPHlMa9xr8vx5x5x5XGscSLx53Gtca3xqPEoHnGvMa-xqrHgMeCx4THhmvHj8eKfceMx44ixbnGh8eSx73HpMe0xqvHoMeax6jHnnvIiMejx6o8x6fHrMepx6XHtciKx67GuMSoxKrErMSux7PHtMe2x4PHhceHyIDFusWBx4vHjcePyIJlx5PHqse1yIjHm8iSyIvIjX3Ihcemx6jGr8iQxq3Ersi3cMabbsWkbcSaxrjFsWTHssi0PMSoY8WbxZfEtsa2xrhkb3duIsmGyLzFjci_yYHGo3PFgGxlxa7JksekyJDGlcaXxpnGm8adPg&c=BNJBWRBb1P you see a request on the left part of the screen note: to get the output - just press the button in the top-menu called "Ausführen" after this you press the button called "DATEN" on the top-right - just below the green button called "flatter this": after pressing this "DATEN"-button you see the data in the right window of the screen. note - it has got various ids - that means that the osm-file does not give back constantly all the tags... the last question; does this make any problems to our project - does this has any influence on our db-connection...!?!? see the output here: <node id="2064639440" lat="49.4873181" lon="8.4710548"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="turkish"/> <tag k="email" v="info@lynso.de"/> <tag k="name" v="Kilim - Café und Bar Restaurant"/> <tag k="opening_hours" v="Su-Th 17:00-1:00; Fr, Sa 17:00-3:00"/> <tag k="operator" v="Cengiz Kaya"/> <tag k="phone" v="06 21 - 43 755 371"/> <tag k="website" v="http://www.kilim-mannheim.de/"/> </node> <node id="2126473801" lat="49.4851170" lon="8.4756295"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="italian"/> <tag k="email" v="mannheim1@vapiano.de"/> <tag k="fax" v="+49 621 1259 779"/> <tag k="name" v="Vapiano"/> <tag k="opening_hours" v="Su-Th 10:00-24:00; Fr-Sa 10:00-01:00"/> <tag k="operator" v="Vapiano"/> <tag k="phone" v="+49 621 1259 777"/> <tag k="website" v="http://www.vapiano.de/newsroom/?store=29"/> <tag k="wheelchair" v="yes"/> </node> <node id="667927886" lat="49.4909673" lon="8.4764904"> <tag k="addr:city" v="Mannheim"/> <tag k="addr:country" v="DE"/> <tag k="addr:housenumber" v="5"/> <tag k="addr:postcode" v="68161"/> <tag k="addr:street" v="Collinistraße"/> <tag k="amenity" v="restaurant"/> <tag k="name" v="Churrascaria Brasil Tropical"/> <tag k="phone" v="+496211225596"/> <tag k="wheelchair" v="limited"/> </node> <node id="689928440" lat="49.4798794" lon="8.4853418"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="greek"/> <tag k="email" v="epirus70@hotmail.de"/> <tag k="fax" v="0621/4407 762"/> <tag k="name" v="Epirus"/> <tag k="opening_hours" v="Mo-Sa 12:00-15:00,18:00-24:00"/> <tag k="phone" v="0621/4407 761"/> <tag k="smoking" v="separated"/> <tag k="website" v="http://epirus-ma.blogspot.com/"/> <tag k="wheelchair" v="no"/> </node> <node id="689928445" lat="49.4799409" lon="8.4851357"> <tag k="amenity" v="restaurant"/> <tag k="cuisine" v="italian"/> <tag k="email" v="gianlucascurti@ristorante-augusta.de"/> <tag k="name" v="Ristorante Augusta"/> <tag k="opening_hours" v="Mo-Fr 12:00-14:00,18:00-23:00;Su 12:00-14:00,18:00-23:00"/> <tag k="phone" v="0621 449872"/> <tag k="website" v="ristorante-augusta.com/"/> <tag k="wheelchair" v="no"/> </node> well you see that i have some questions the second one is regarding the variations in the mysql.txt - file - i.e. the different number of tags.; How to make the script robust so that it is able to work with this - and does not stopt to work....!? I look forward to hear from you many many greetings
  2. Hello, i need some help/info about searching words in files (txt or xml) and saving them to db or another file. For example ive got an xml file like below: <families> <family> <name>brown</name> <city>denver</city> <members>12</members> </family> <family> <name>jackson</name> <city>new york</city> <members>6</members> </family> </families> i want to search for: <family> then save the lines till it comes to the word </family> and then goes to the next group. did some reading about array, preg_match, strpos functions but dont know where to start. what is the best way to do this? can you guys give me some advise... or links to good tutorials? thanks in advance!
  3. I want to edit an xml using PHP and POST from iOS app. The XML Looks like: <?xml version="1.0" encoding="UTF-8"?> <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> <channel> <atom:link rel="self" type="application/rss+xml" href="http://www.316apps.site90.net/Test.xml"/> <lastBuildDate>Mon, 3 Feb 2014 09:26:14 -0500</lastBuildDate> <title>Prayer Warrior</title> <description><![CDATA[Prayer Warrior]]></description> <link>http://www.316apps.site90.net</link> <language>en</language> <copyright>2014 Prayer Warrior</copyright> <item> <first_name>John</first_name> <last_name>Doe</last_name> <title>I need money</title> <date>Mon, 3 Feb 2014 09:26:14 -0500</date> <anonymous>No</anonymous> <prayer_warriors>1</prayer_warriors> <location>USA</location> </item> <item> <first_name>Jane</first_name> <last_name>Doe</last_name> <title>I need money</title> <date>Tue, 4 Feb 2014 09:26:14 -0500</date> <anonymous>No</anonymous> <prayer_warriors>1</prayer_warriors> <location>USA</location> </item> </channel> </rss> Over time, the XML will grow. In my iOS app I have a UITableView that parses the XML into different rows. When they view a row, I want it to increase the count on the prayer. PHP I am using now is: <?php $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $title = $_POST['title']; $xml = simplexml_load_file("http://www.316apps.site90.net/Test.xml") or die("Not loaded!\n"); $responses = $xml->xpath("//channel/item[title = $title and first_name = $first_name and last_name = $last_name]/prayer_warriors"); $responses[0][0] = $responses[0] + 1; print_r($responses); $xml->asXML("Test.xml"); ?> The iOS app uses this code for POST to it: RSSEntry *entry = [_allEntries objectAtIndex:indexPath.row]; NSString *myRequestString = [NSString stringWithFormat:@"first_name=%@&last_name=%@&title=%@", entry.firstName, entry.lastName, entry.prayerRequest]; // Create Data from request NSData *myRequestData = [NSData dataWithBytes: [myRequestString UTF8String] length: [myRequestString length]]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: @"http://www.316apps.site90.net/Increase.php"]]; // set Request Type [request setHTTPMethod: @"POST"]; // Set content-type [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"]; // Set Request Body [request setHTTPBody: myRequestData]; // Now send a request and get Response NSData *returnData = [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil]; // Log Response NSString *response = [[NSString alloc] initWithBytes:[returnData bytes] length:[returnData length] encoding:NSUTF8StringEncoding]; NSLog(@"Response%@",response); However, nothing changes, and I get an invalid predicate message on the response on my iPhone for the line: $responses = $xml->xpath("//channel/item[title = $title and first_name = $first_name and last_name = $last_name]/prayer_warriors"); Thoughts?
  4. need to create a webapp using a control to display each event, have difficulty with path to get the position and column attribute. any help and how do i bind a control to this data to make it an app where a use can browse through each event with there corresponding characteristics? below is the sample xml..... thanks <?php $keywords = simplexml_load_file('http://wx.toronto.ca/festevents.nsf/tpaview?readviewentries'); echo ' '; foreach ($keywords->xpath('viewentry[@position]') as $kw) { echo ' ' .$kw->entrydata->text . ' '; } //echo ' '; //foreach ($keywords->viewentry->entrydata as $kw) { //echo ' '.$kw->text.''; //echo ' '.$kw->textlist->text.''; //} ?> <?xml version="1.0" encoding="UTF-8"?> <viewentries timestamp="20140420T142611,65Z" toplevelentries="1209"> <viewentry position="1" unid="9FBAD6EEF554FC2185257CBB0063FDD0" noteid="4E072" siblings="1209"> <entrydata columnnumber="0" name="EventName"> <text> ‘Antiques Roadshow’-inspired Open Call for Canadian Art </text> </entrydata> <entrydata columnnumber="1" name="Area"> <text>Downtown</text> </entrydata> <entrydata columnnumber="2" name="CategoryList"> <textlist> <text>Arts/Exhibits</text> <text>Seminars/Workshops</text> </textlist> </entrydata> <entrydata columnnumber="3" name="PresentedByOrgName"> <text>Consignor Canadian Fine Art</text> </entrydata> <entrydata columnnumber="4" name="Image"> <text> http://wx.toronto.ca/festevents.nsf/all/9FBAD6EEF554FC2185257CBB0063FDD0/$File/logo_banner.png </text> </entrydata> <entrydata columnnumber="5" name="DateBeginShow"> <text>May 9, 2014</text> </entrydata> <entrydata columnnumber="6" name="TimeBegin"> <text>9:00 AM</text> </entrydata> <entrydata columnnumber="7" name="DateEndShow"> <text>May 9, 2014</text> </entrydata> <entrydata columnnumber="8" name="TimeEnd"> <text>5:00 PM</text> </entrydata> <entrydata columnnumber="9" name="Admission"> <text>Free</text> </entrydata> <entrydata columnnumber="10" name="LongDesc"> <textlist> <text> Have you ever wondered how much that inherited painting tucked away in the attic is worth? Consignor Canadian Fine Art’s (consignor.ca) certified art specialists are looking for hidden treasures for their upcoming auctions. Anyone interested in selling a Canadian painting, print or sculpture on consignment, receiving a preliminary auction valuation and/or curious to learn more about a piece of artwork they own, is invited to attend an art appraisal open house on Friday, May 9th. </text> <text> Consignor’s art specialists will be on-hand for mini-consultations and verbal auction valuations of works by Canadian artists, as well as preview works of art available for sale through its upcoming Spring Auction of Important Canadian Art (May 21-29). </text> </textlist> </entrydata> <entrydata columnnumber="11" name="OrgContactPhone"> <text>416-628-5609</text> </entrydata> <entrydata columnnumber="12" name="OrgContactExt"> <text/> </entrydata> <entrydata columnnumber="13" name="Location"> <text>Consignor Canadian Fine Art</text> </entrydata> <entrydata columnnumber="14" name="Intersection"> <text>Dundas St. W and McCaul St.</text> </entrydata> <entrydata columnnumber="15" name="MapAddress"> <text> [<a href=http://map.toronto.ca/imapit/iMapIt.jsp?app=TOMaps&geoid=796553 target=_new>Map to this event</a>] </text> </entrydata> <entrydata columnnumber="16" name="TTC"> <text/> </entrydata> <entrydata columnnumber="17" name="EventURL"> <text>www.consignor.ca</text> </entrydata> <entrydata columnnumber="18" name="ImageAltText"> <text/> </entrydata> <entrydata columnnumber="19" name="OrgContactEMail"> <text>amcloughlin@holmespr.com</text> </entrydata> <entrydata columnnumber="20" name="AccessibleFully"> <text/> </entrydata> <entrydata columnnumber="21" name="ParkingFree"> <text/> </entrydata> <entrydata columnnumber="22" name="PublicWashrooms"> <text>Public washrooms</text> </entrydata> <entrydata columnnumber="23" name="AccessiblePartially"> <text/> </entrydata> <entrydata columnnumber="24" name="ParkingPaid"> <text>Parking (paid)</text> </entrydata> <entrydata columnnumber="25" name="FoodBeverage"> <text/> </entrydata> <entrydata columnnumber="26" name="Shopping"> <text/> </entrydata> <entrydata columnnumber="27" name="Exhibit"> <text/> </entrydata> <entrydata columnnumber="28" name="Performance"> <text/> </entrydata> <entrydata columnnumber="29" name="KidFriendly"> <text>Kid-friendly</text> </entrydata> <entrydata columnnumber="30" name="History"> <text/> </entrydata> <entrydata columnnumber="31" name="Green"> <text/> </entrydata> <entrydata columnnumber="32" name="NewThisYear"> <text/> </entrydata> <entrydata columnnumber="33" name="Reservations"> <text/> </entrydata> <entrydata columnnumber="34" name="OfficialGreenSite"> <text/> </entrydata> <entrydata columnnumber="35" name="BikeRacks"> <text/> </entrydata> <entrydata columnnumber="36" name="RoadClose"> <text/> </entrydata> <entrydata columnnumber="37" name="OrganicFood"> <text/> </entrydata> </viewentry> <viewentry position="2" unid="05618376115EB38B85257CB00063C61E" noteid="4D5AE" siblings="1209"> <entrydata columnnumber="0" name="EventName"> <text>Tour the PS Trillium Side Wheeler Paddle Steamer</text> </entrydata> <entrydata columnnumber="1" name="Area"> <text>Downtown</text> </entrydata> <entrydata columnnumber="2" name="CategoryList"> <text>History</text> </entrydata> <entrydata columnnumber="3" name="PresentedByOrgName"> <text>The Waterfont BIA</text> </entrydata> <entrydata columnnumber="4" name="Image"> <text> http://wx.toronto.ca/festevents.nsf/all/05618376115EB38B85257CB00063C61E/$File/Trillium Ferry.JPG </text> </entrydata> <entrydata columnnumber="5" name="DateBeginShow"> <text>May 24, 2014</text> </entrydata> <entrydata columnnumber="6" name="TimeBegin"> <text>10:00 AM</text> </entrydata> <entrydata columnnumber="7" name="DateEndShow"> <text>May 25, 2014</text> </entrydata> <entrydata columnnumber="8" name="TimeEnd"> <text>3:00 PM</text> </entrydata> <entrydata columnnumber="9" name="Admission"> <text>Free</text> </entrydata> <entrydata columnnumber="10" name="LongDesc"> <textlist> <text> Take a tour of the PS Trillium Side Wheleer Paddle Steamer at Gangways Open on Toronto’s Waterfront presented by The Waterfront BIA, as part of the 15th annual Doors Open Toronto. </text> <text>Visit www.waterfrontbia.com for more information.</text> <text> The PS Trillium was constructed in 1910 at Polson Iron Works in Toronto, was re-constructed in Port Colborne in 1975 and continues to operate in the rebuilt condition today. The Trillium is the last remaining side wheeler paddle steamer operating in North America and is located at the foot of Harbour Square Park at the base of Bay Street. Author/Journalist Mike Filey will be on board to answer questions when he is not speaking in the Brigantine Room. </text> </textlist> </entrydata> <entrydata columnnumber="11" name="OrgContactPhone"> <text>416-603-6005</text> </entrydata> <entrydata columnnumber="12" name="OrgContactExt"> <text/> </entrydata> <entrydata columnnumber="13" name="Location"> <text>Harbour Square Park</text> </entrydata> <entrydata columnnumber="14" name="Intersection"> <text>Queens Quay West and Rees Street</text> </entrydata> <entrydata columnnumber="15" name="MapAddress"> <text> No matching map link is available for the current address input. </text> </entrydata> <entrydata columnnumber="16" name="TTC"> <text/> </entrydata> <entrydata columnnumber="17" name="EventURL"> <text>www.waterfrontbia.com</text> </entrydata> <entrydata columnnumber="18" name="ImageAltText"> <text/> </entrydata> <entrydata columnnumber="19" name="OrgContactEMail"> <text>peter@ashworthassociates.com</text> </entrydata> <entrydata columnnumber="20" name="AccessibleFully"> <text>Fully accessible</text> </entrydata> <entrydata columnnumber="21" name="ParkingFree"> <text/> </entrydata> <entrydata columnnumber="22" name="PublicWashrooms"> <text>Public washrooms</text> </entrydata> <entrydata columnnumber="23" name="AccessiblePartially"> <text/> </entrydata> <entrydata columnnumber="24" name="ParkingPaid"> <text>Parking (paid)</text> </entrydata> <entrydata columnnumber="25" name="FoodBeverage"> <text/> </entrydata> <entrydata columnnumber="26" name="Shopping"> <text/> </entrydata> <entrydata columnnumber="27" name="Exhibit"> <text/> </entrydata> <entrydata columnnumber="28" name="Performance"> <text/> </entrydata> <entrydata columnnumber="29" name="KidFriendly"> <text>Kid-friendly</text> </entrydata> <entrydata columnnumber="30" name="History"> <text/> </entrydata> <entrydata columnnumber="31" name="Green"> <text/> </entrydata> <entrydata columnnumber="32" name="NewThisYear"> <text>New this year</text> </entrydata> <entrydata columnnumber="33" name="Reservations"> <text/> </entrydata> <entrydata columnnumber="34" name="OfficialGreenSite"> <text/> </entrydata> <entrydata columnnumber="35" name="BikeRacks"> <text/> </entrydata> <entrydata columnnumber="36" name="RoadClose"> <text/> </entrydata> <entrydata columnnumber="37" name="OrganicFood"> <text/> </entrydata> </viewentry> <viewentry position="3" unid="58B01EF4B58CFE1D85257C97007303D5" noteid="4B76E" siblings="1209"> <entrydata columnnumber="0" name="EventName"> <text>10th Annual Toronto Tango Festival</text> </entrydata> <entrydata columnnumber="1" name="Area"> <text>Southwest</text><?xml version="1.0" encoding="UTF-8"?> <viewentries timestamp="20140420T142611,65Z" toplevelentries="1209"> <viewentry position="1" unid="9FBAD6EEF554FC2185257CBB0063FDD0" noteid="4E072" siblings="1209"> <entrydata columnnumber="0" name="EventName"> <text> ‘Antiques Roadshow’-inspired Open Call for Canadian Art </text> </entrydata> <entrydata columnnumber="1" name="Area"> <text>Downtown</text> </entrydata> <entrydata columnnumber="2" name="CategoryList"> <textlist> <text>Arts/Exhibits</text> <text>Seminars/Workshops</text> </textlist> </entrydata> <entrydata columnnumber="3" name="PresentedByOrgName"> <text>Consignor Canadian Fine Art</text> </entrydata> <entrydata columnnumber="4" name="Image"> <text> http://wx.toronto.ca/festevents.nsf/all/9FBAD6EEF554FC2185257CBB0063FDD0/$File/logo_banner.png </text> </entrydata> <entrydata columnnumber="5" name="DateBeginShow"> <text>May 9, 2014</text> </entrydata> <entrydata columnnumber="6" name="TimeBegin"> <text>9:00 AM</text> </entrydata> <entrydata columnnumber="7" name="DateEndShow"> <text>May 9, 2014</text> </entrydata> <entrydata columnnumber="8" name="TimeEnd"> <text>5:00 PM</text> </entrydata> <entrydata columnnumber="9" name="Admission"> <text>Free</text> </entrydata> <entrydata columnnumber="10" name="LongDesc"> <textlist> <text> Have you ever wondered how much that inherited painting tucked away in the attic is worth? Consignor Canadian Fine Art’s (consignor.ca) certified art specialists are looking for hidden treasures for their upcoming auctions. Anyone interested in selling a Canadian painting, print or sculpture on consignment, receiving a preliminary auction valuation and/or curious to learn more about a piece of artwork they own, is invited to attend an art appraisal open house on Friday, May 9th. </text> <text> Consignor’s art specialists will be on-hand for mini-consultations and verbal auction valuations of works by Canadian artists, as well as preview works of art available for sale through its upcoming Spring Auction of Important Canadian Art (May 21-29). </text> </textlist> </entrydata> <entrydata columnnumber="11" name="OrgContactPhone"> <text>416-628-5609</text> </entrydata> <entrydata columnnumber="12" name="OrgContactExt"> <text/> </entrydata> <entrydata columnnumber="13" name="Location"> <text>Consignor Canadian Fine Art</text> </entrydata> <entrydata columnnumber="14" name="Intersection"> <text>Dundas St. W and McCaul St.</text> </entrydata> <entrydata columnnumber="15" name="MapAddress"> <text> [<a href=http://map.toronto.ca/imapit/iMapIt.jsp?app=TOMaps&geoid=796553 target=_new>Map to this event</a>] </text> </entrydata> <entrydata columnnumber="16" name="TTC"> <text/> </entrydata> <entrydata columnnumber="17" name="EventURL"> <text>www.consignor.ca</text> </entrydata> <entrydata columnnumber="18" name="ImageAltText"> <text/> </entrydata> <entrydata columnnumber="19" name="OrgContactEMail"> <text>amcloughlin@holmespr.com</text> </entrydata> <entrydata columnnumber="20" name="AccessibleFully"> <text/> </entrydata> <entrydata columnnumber="21" name="ParkingFree"> <text/> </entrydata> <entrydata columnnumber="22" name="PublicWashrooms"> <text>Public washrooms</text> </entrydata> <entrydata columnnumber="23" name="AccessiblePartially"> <text/> </entrydata> <entrydata columnnumber="24" name="ParkingPaid"> <text>Parking (paid)</text> </entrydata> <entrydata columnnumber="25" name="FoodBeverage"> <text/> </entrydata> <entrydata columnnumber="26" name="Shopping"> <text/> </entrydata> <entrydata columnnumber="27" name="Exhibit"> <text/> </entrydata> <entrydata columnnumber="28" name="Performance"> <text/> </entrydata> <entrydata columnnumber="29" name="KidFriendly"> <text>Kid-friendly</text> </entrydata> <entrydata columnnumber="30" name="History"> <text/> </entrydata> <entrydata columnnumber="31" name="Green"> <text/> </entrydata> <entrydata columnnumber="32" name="NewThisYear"> <text/> </entrydata> <entrydata columnnumber="33" name="Reservations"> <text/> </entrydata> <entrydata columnnumber="34" name="OfficialGreenSite"> <text/> </entrydata> <entrydata columnnumber="35" name="BikeRacks"> <text/> </entrydata> <entrydata columnnumber="36" name="RoadClose"> <text/> </entrydata> <entrydata columnnumber="37" name="OrganicFood"> <text/> </entrydata> </viewentry> <viewentry position="2" unid="05618376115EB38B85257CB00063C61E" noteid="4D5AE" siblings="1209"> <entrydata columnnumber="0" name="EventName"> <text>Tour the PS Trillium Side Wheeler Paddle Steamer</text> </entrydata> <entrydata columnnumber="1" name="Area"> <text>Downtown</text> </entrydata> <entrydata columnnumber="2" name="CategoryList"> <text>History</text> </entrydata> <entrydata columnnumber="3" name="PresentedByOrgName"> <text>The Waterfont BIA</text> </entrydata> <entrydata columnnumber="4" name="Image"> <text> http://wx.toronto.ca/festevents.nsf/all/05618376115EB38B85257CB00063C61E/$File/Trillium Ferry.JPG </text> </entrydata> <entrydata columnnumber="5" name="DateBeginShow"> <text>May 24, 2014</text> </entrydata> <entrydata columnnumber="6" name="TimeBegin"> <text>10:00 AM</text> </entrydata> <entrydata columnnumber="7" name="DateEndShow"> <text>May 25, 2014</text> </entrydata> <entrydata columnnumber="8" name="TimeEnd"> <text>3:00 PM</text> </entrydata> <entrydata columnnumber="9" name="Admission"> <text>Free</text> </entrydata> <entrydata columnnumber="10" name="LongDesc"> <textlist> <text> Take a tour of the PS Trillium Side Wheleer Paddle Steamer at Gangways Open on Toronto’s Waterfront presented by The Waterfront BIA, as part of the 15th annual Doors Open Toronto. </text> <text>Visit www.waterfrontbia.com for more information.</text> <text> The PS Trillium was constructed in 1910 at Polson Iron Works in Toronto, was re-constructed in Port Colborne in 1975 and continues to operate in the rebuilt condition today. The Trillium is the last remaining side wheeler paddle steamer operating in North America and is located at the foot of Harbour Square Park at the base of Bay Street. Author/Journalist Mike Filey will be on board to answer questions when he is not speaking in the Brigantine Room. </text> </textlist> </entrydata> <entrydata columnnumber="11" name="OrgContactPhone"> <text>416-603-6005</text> </entrydata> <entrydata columnnumber="12" name="OrgContactExt"> <text/> </entrydata> <entrydata columnnumber="13" name="Location"> <text>Harbour Square Park</text> </entrydata> <entrydata columnnumber="14" name="Intersection"> <text>Queens Quay West and Rees Street</text> </entrydata> <entrydata columnnumber="15" name="MapAddress"> <text> No matching map link is available for the current address input. </text> </entrydata> <entrydata columnnumber="16" name="TTC"> <text/> </entrydata> <entrydata columnnumber="17" name="EventURL"> <text>www.waterfrontbia.com</text> </entrydata> <entrydata columnnumber="18" name="ImageAltText"> <text/> </entrydata> <entrydata columnnumber="19" name="OrgContactEMail"> <text>peter@ashworthassociates.com</text> </entrydata> <entrydata columnnumber="20" name="AccessibleFully"> <text>Fully accessible</text> </entrydata> <entrydata columnnumber="21" name="ParkingFree"> <text/> </entrydata> <entrydata columnnumber="22" name="PublicWashrooms"> <text>Public washrooms</text> </entrydata> <entrydata columnnumber="23" name="AccessiblePartially"> <text/> </entrydata> <entrydata columnnumber="24" name="ParkingPaid"> <text>Parking (paid)</text> </entrydata> <entrydata columnnumber="25" name="FoodBeverage"> <text/> </entrydata> <entrydata columnnumber="26" name="Shopping"> <text/> </entrydata> <entrydata columnnumber="27" name="Exhibit"> <text/> </entrydata> <entrydata columnnumber="28" name="Performance"> <text/> </entrydata> <entrydata columnnumber="29" name="KidFriendly"> <text>Kid-friendly</text> </entrydata> <entrydata columnnumber="30" name="History"> <text/> </entrydata> <entrydata columnnumber="31" name="Green"> <text/> </entrydata> <entrydata columnnumber="32" name="NewThisYear"> <text>New this year</text> </entrydata> <entrydata columnnumber="33" name="Reservations"> <text/> </entrydata> <entrydata columnnumber="34" name="OfficialGreenSite"> <text/> </entrydata> <entrydata columnnumber="35" name="BikeRacks"> <text/> </entrydata> <entrydata columnnumber="36" name="RoadClose"> <text/> </entrydata> <entrydata columnnumber="37" name="OrganicFood"> <text/> </entrydata> </viewentry> <viewentry position="3" unid="58B01EF4B58CFE1D85257C97007303D5" noteid="4B76E" siblings="1209"> <entrydata columnnumber="0" name="EventName"> <text>10th Annual Toronto Tango Festival</text> </entrydata> <entrydata columnnumber="1" name="Area"> <text>Southwest</text>
  5. I have the following xml file called -> test.xml <?xml version="1.0"?> <OrderCollection xmlns:xsd="http://www.org/2009/XMLSchema" xmlns:xsi="http://www.w3.org/2009/XMLSchema-instance"> <Orders> <Order Id="130" Model=" Optimized" CampaignName="Promo" OrderName="1074" CreationDate="2013-05-29T16:30:03.41" StartDate="2013-06-03T04:00:00" EndDate="2014-04-22T03:59:59.997" OrderStatus="Active"> <Client Id="5" ExternalId="5" Name="CNL" /> <Lines> <Line Id="699" Status="Canceled" EstimatedReach="0" Desired="1000" Actual="370" MaxViewings="0" Separation="0"> <Line Id="700" Status="Canceled" EstimatedReach="10830" Desired="1000" Actual="0" MaxViewings="0" Separation="0"> <Line Id="701" Status="Canceled" EstimatedReach="0" Desired="1000" Actual="0" MaxViewings="0" Separation="0"> <Line Id="714" Status="Canceled" EstimatedReach="10830" Desired="1000" Actual="1478410" MaxViewings="0" Separation="0"> <Line Id="908" Status="Active" EstimatedReach="0" Desired="1000" Actual="1520" MaxViewings="0" Separation="0"> <Line Id="916" Status="Canceled" EstimatedReach="0" Desired="1000" Actuals="5260" MaxViewings="0" Separation="0"> </Lines> </Order> </Orders> </OrderCollection> For each <Line> node with a entry that has a status attribute of (Status="Active") I need to list The corresponding ID number. So from the XML above I need to pull out only Line Id="908", since it is the only one with a Status equal to Active. I have so far wrote this PHP code to attempt to accomplish this task. <?php $url = 'test.xml'; $xml = simplexml_load_file($url); foreach ($xml->xpath("//Line/@Status") as $t) { echo $t . PHP_EOL; } ?> The above code will print out all the "Status" attribute values properly from each xml LINE node, but I do not know how to put in a check on the xpath command to see if the @Status is set to active and then echo out, only the corresponding Id attribute (i.e 908 in this case) Any help would be greatly appreciated. Thanks,
  6. <?php header("Content_Type: text/xml"); $xmlBody = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $dir = "SOUNDS/"; $xmlBody .= "<XML>"; $dirHandle = opendir($dir); $i = 0; while ($file = readdir($dirHandle)) { if(!is_dir($file) && strpos($file, '.mp3')){ $i++; $myId3 = new ID3($file); $xmlBody .= ' <Song> <songNum>' . $i . '</songNum> <songURL>' . $dir . '' . $file . '</songURL> <songArtist>' . $myId3->getArtist() . '</songArtist> <songTitle>' . $myId3->getTitle() . '</songTitle> </Song>'; } } closedir($dirHandle); $xmlBody .= "</XML>"; echo $xmlBody; ?> Hi there, I have designed a flash mp3 player that reads the id3 tags form the .mp3 file, but wanted to make a XML list generated by PHP & to add the mp3 tags to the XML file so that flash can view all the id3 tag information on the files, and show on the list. I know how to view the XML list in flash I just don't want to type out 500+ tags of XML lol here is something I tried ...
  7. The below is a sample of an xml file which I am working on : <?xml version="1.0" encoding="UTF-8" ?> <BroadcastData creationDate="20140326085217"> <ScheduleData> <ChannelPeriod beginTime="20140326090000" endTime="20140402044500"> <ChannelId>Rai Uno</ChannelId> <Event beginTime="20140326090000" duration="1800"> <EventId>260852180006</EventId> <EventType>P</EventType> <EpgProduction> <EpgText language="eng"> <Name>Unomattina storie vere</Name> </EpgText> </EpgProduction> </Event> <Event beginTime="20140326093000" duration="1500"> <EventId>260852180007</EventId> <EventType>P</EventType> <EpgProduction> <EpgText language="eng"> <Name>Unomattina Verde</Name> </EpgText> </EpgProduction> </Event> I am trying to parse this XML and post it into a database with the following PHP: <?php // Create connection $con=mysqli_connect("localhost","test","test","epg"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $completeurl ='test.xml'; $doc = simplexml_load_file($completeurl); foreach ($doc->ScheduleData->ChannelPeriod as $channelPeriod) { $channelId = (string)$channelPeriod->ChannelId; foreach ($channelPeriod->Event as $event) { $beginTime = $event['beginTime']; foreach ($channelPeriod->Event as $name) { $programName = $name->EpgProduction->EpgText->Name; /*printf('<p>Channel: %s<br />Begin Time: %s<br />Program Name: %s</p>', $channelId, $beginTime, $programName);*/ } } } $sql = "insert into `epg` (`ChannelId`, `BeginTime`, `ShortName`) values ('$channelId', '$beginTime', '$programName')"; $perform_insert = mysqli_query($con,$sql) or die("<b>Data could not be entered</b>.\n<br />Query: <br />\nError: (" . mysqli_errno($con) . ") " . mysqli_error($con)); if (mysqli_query($con,$perform_insert)) { echo "Database updated successfully"; } else { echo "Error creating database: " . mysqli_error($con); } ?> For some reason, this is not happening and I have no idea what am I doing wrong, can you kindly have a look please, many thanks for your help
  8. Hi all I am hoping you can help. I am looking to pull the feed and parse the follow. I am wanting to get both the attributes and the cildren of the market branch of xml. Can someone help me out please? <oxip version="7.1" created="2014-03-21 19:19:20" lastMsgId="" requestTime="0.1686"> <response request="getHierarchyByMarketType" code="001" message="success" debug=""> <williamhill> <class id="436" name="Football - Virtual" maxRepDate="2014-03-21" maxRepTime="00:56:39"> <type id="8398" name="Victoria Stadium" url="http://sports.williamhill.com/bet/betting/t/8398" lastUpdateDate="2014-03-10" lastUpdateTime="23:31:52"> <market id="152656333" name=" Czech Republic v Poland - Match Betting" url="http://sports.williamhill.com/bet/en-gb/betting/e/5778703/%2dCzech%2dRepublic%2dv%2dPoland"date="2014-03-21" time="19:20:00" betTillDate="2014-03-21" betTillTime="19:20:00" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59"> <participant name="Poland" id="534674127" odds="2/1" oddsDecimal="3.00" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59" handicap=""/> <participant name="Draw" id="534674126" odds="12/5" oddsDecimal="3.40" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59" handicap=""/> <participant name="Czech Republic" id="534674125" odds="5/4" oddsDecimal="2.25" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59" handicap=""/> </market>
  9. I want to export videos, thumbs, duration, etc from my website into a xml format. I got this error: Invalid argument supplied for foreach() $output .= ' <clips>'; if (!is_array( $vids )) { $vids = array( ); foreach ($imgs as $img) { $img = explode( '.', $img ); $vids[] = '0' . $img[0] . '.flv'; } } @sort( $vids ); @sort( $imgs ); $i = 38; foreach ($vids as $v) { $output .= ' <clip>'; $output .= ' <duration>' . $duration . '</duration>'; $output .= ' <width>' . $width . '</width>'; $output .= ' <height>' . $height . '</height>'; $output .= ' <flv>' . $v . '</flv>'; $output .= ' <screens> <screen>' . trim( $imgs[$i] ) . '</screen> </screens>'; $output .= ' </clip>'; ++$i; } $output .= ' </clips>'; Thank you!
  10. Hi I've searched the net high and low for an answer and found a script on this forum which I have used as shown below however the script seems to run fine and output to the screen with the correct data, however it doesn't update the database on the server. I've checked permissions and ran a simple query static query which works: (mysqli_query($con,"INSERT INTO feeforeviews (FEEDBACKID,COUNT,DATE) VALUES ('99999,10,3 Hour(s) ago')") and it updates the "feeforeviews" table fine. This is the script I would like working if possible which parses the file feefofeedtest.xml and should import the data in the database table "feeforeviews" I modified the script from here: http://forums.phpfreaks.com/topic/273301-simplexml-to-mysql/ http://forums.phpfreaks.com/user/3105-barand/ Any help greatly appreciated. <?php // Create connection $con=mysqli_connect("localhost","user","pass","database"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } ?> <?php $xml = simplexml_load_file('feefofeedtest.xml'); $data = $fields = array(); foreach ($xml->xpath('FEEDBACK') as $FEEDBACK) { $fields = array_keys((array)($FEEDBACK)); $data[] = '(' . join(', ', (array)$FEEDBACK) . ')'; } $sql = "INSERT INTO feeforeviews (" . join(', ', $fields) . ") VALUES\n" ; $sql .= join (",\n", $data); echo "<pre>$sql</pre>"; ?> This outputs the following onscreen which looks fine, however it doesn't update the server. INSERT INTO feeforeviews (FEEDBACKID, COUNT, DATE, HREVIEWDATE, DESCRIPTION, PRODUCTCODE, LINK, FACEBOOKSHARELINK, PRODUCTRATING, SERVICERATING, CUSTOMERCOMMENT, SHORTCUSTOMERCOMMENT, READMOREURL) VALUES (99998, 1, 3 Hour(s) ago, 2014-03-18T10:19:03, Personalised Swarovski Crystal Hiball Glass, DG10387, http://www.keepitpersonal.co.uk, http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.feefo.com%2FGB%2Fen%2Freviews%2FKeep-It-Personal%2F%3Fid%3D326784%26servicefeedbackid%3D83637, 5, ++, ++, jgsjhgdfhjgjsd, Service rating : jgsjhgdfhjgjsd, http://www.feefo.com/GB/en/reviews/Keep-It-Personal/?id=326784&servicefeedbackid=83637), (88888, 2, 5 Hour(s) ago, 2014-03-18T08:02:34, Personalised Swarovski Champagne Flute, DG10492, http://www.keepitpersonal.co.uk, http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.feefo.com%2FGB%2Fen%2Freviews%2FKeep-It-Personal%2F%3Fid%3D326784%26servicefeedbackid%3D86279, NA, ++, Excellent website, easy to understand and use, jgsjhgdfhjgjsd, http://www.feefo.com/GB/en/reviews/Keep-It-Personal/?id=326784&servicefeedbackid=86279) Example XML file: <?xml version="1.0" encoding="UTF-8"?><FEEDBACKLIST> <FEEDBACK> <FEEDBACKID>99998</FEEDBACKID> <COUNT>1</COUNT> <DATE> 3 Hour(s) ago</DATE> <HREVIEWDATE>2014-03-18T10:19:03</HREVIEWDATE> <DESCRIPTION>Personalised Swarovski Crystal Hiball Glass</DESCRIPTION> <PRODUCTCODE>DG10387</PRODUCTCODE> <LINK>http://www.keepitpersonal.co.uk</LINK> <FACEBOOKSHARELINK>http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.feefo.com%2FGB%2Fen%2Freviews%2FKeep-It-Personal%2F%3Fid%3D326784%26servicefeedbackid%3D83637</FACEBOOKSHARELINK> <HREVIEWRATING>5</HREVIEWRATING> <PRODUCTRATING>++</PRODUCTRATING> <SERVICERATING>++</SERVICERATING> <CUSTOMERCOMMENT>jgsjhgdfhjgjsd</CUSTOMERCOMMENT> <SHORTCUSTOMERCOMMENT>Service rating : jgsjhgdfhjgjsd</SHORTCUSTOMERCOMMENT> <READMOREURL>http://www.feefo.com/GB/en/reviews/Keep-It-Personal/?id=326784&servicefeedbackid=83637</READMOREURL> </FEEDBACK> <FEEDBACK> <FEEDBACKID>88888</FEEDBACKID> <COUNT>2</COUNT> <DATE> 5 Hour(s) ago</DATE> <HREVIEWDATE>2014-03-18T08:02:34</HREVIEWDATE> <DESCRIPTION>Personalised Swarovski Champagne Flute</DESCRIPTION> <PRODUCTCODE>DG10492</PRODUCTCODE> <LINK>http://www.keepitpersonal.co.uk</LINK> <FACEBOOKSHARELINK>http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.feefo.com%2FGB%2Fen%2Freviews%2FKeep-It-Personal%2F%3Fid%3D326784%26servicefeedbackid%3D86279</FACEBOOKSHARELINK> <PRODUCTRATING>NA</PRODUCTRATING> <SERVICERATING>++</SERVICERATING> <CUSTOMERCOMMENT>Excellent website, easy to understand and use</CUSTOMERCOMMENT> <SHORTCUSTOMERCOMMENT>jgsjhgdfhjgjsd</SHORTCUSTOMERCOMMENT> <READMOREURL>http://www.feefo.com/GB/en/reviews/Keep-It-Personal/?id=326784&servicefeedbackid=86279</READMOREURL> </FEEDBACK></FEEDBACKLIST>
  11. Im use to PHP and doing a query seems similar but i need help with syntax. I have an XML file that looks like this and i am trying to do a query where it will search for "ES2UA1" and i get the data "IP" and "Location" I know i am some where in the ball park with Dim doc = XDocument.Load(My.Application.Info.DirectoryPath & ".\xmlData.xml") Dim marker2 = From x In doc...<switchIP> _ Where x.SwitchName = "ES1UA1" _ Select x for each x as y msgbox(y.IP)
  12. I am trying to get the names of the children nodes in XML Here is the code: foreach ($pos->children() as $child) { echo "I never get here"; echo $child->getName() . "\n"; } //} echo "but the node has children---<br>"; print_r($pos); which I modeled on the code from http://www.php.net/manual/en/simplexmlelement.getname.php and here is a sample of the output: SimpleXMLElement Object ( [n] => SimpleXMLElement Object ( ) ) but the node has children--- SimpleXMLElement Object ( [int] => SimpleXMLElement Object ( ) ) but the node has children--- SimpleXMLElement Object ( [n] => SimpleXMLElement Object ( ) ) Why can't I go through the chldren with foreach?
  13. I have two php file createxmlfile.php and display.php I am trying to append the text which i insert through display.php file and create a new xmlfile call phpxml1.php everything works perfectly, except it also add duplicate date, I need a hint, how can i avoid inserting duplicate data <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Create Xml File In PHP</title> </head> <body> <p>Please fill following Data</p> <Form action="display.php" method="post"> ID :<input type="text" id="id" name="id" /> Name : <input type="text" id="name" name="name" /> <input type="submit" id="submit" value="Submit"> </Form> </body> </html> display.php <?PHP function c_element($e_name,$parent){ global $xml; $node=$xml->createElement($e_name); $parent->appendChild($node); return $node; } function c_value($value,$parent){ global $xml; $value = $xml->createTextNode($value); $parent->appendChild($value); return $value; } ?> <?PHP $s_id = $_POST['id']; $s_name = $_POST['name']; echo $s_id. '<br>' .$s_name; $xml =new DOMDocument("1.0"); $xml->load("xmlphp1.xml"); $root=$xml->getElementsByTagName("students")->item(0); $student=c_element("student",$root); $id=c_element("id", $student); c_value("$s_id",$id); $name = c_element("name", $student); c_value("$s_name",$name); //$xml= new DOMDocument("1.0","utf-8"); //$employee = $xml->createElement("employee"); //$employee = $xml->appendChild($employee); //$empname = $xml->createElement("empname",$name); //$empname = $employee->appendChild($empname); //$empemail = $xml->createElement("empemail",$email); //$price= $employee->appendChild($empemail); $xml->FormatOutput=true; //$string_value=$xml->saveXML(); $xml->save("xmlphp1.xml"); ?>
  14. I am trying to get a large (~60MB) XML file into a database and it is giving me fits. A sample record from the XML file looks like this: <entry> <ent_seq>1002090</ent_seq> <k_ele> <keb>お手盛り</keb> <ke_pri>news2</ke_pri> <ke_pri>nf33</ke_pri> </k_ele> <k_ele> <keb>御手盛り</keb> </k_ele> <r_ele> <reb>おてもり</reb> <re_pri>news2</re_pri> <re_pri>nf33</re_pri> </r_ele> <sense> <pos>&n;</pos> <gloss>making arbitrary decisions which benefit oneself</gloss> <gloss>self-approved plan</gloss> </sense> </entry> So, I can have 1 or more <k_ele> elements and within each I can have 1 or more <ke_pri> elements. I need to decide what to do with the record based on the the content of ke_pri elements. Same issue with <r_ele> elements. So, I read the XML with SimpleXML and then because I don't know if each r_ele and re_pri is an object over which I need to iterate or a variable I have ugly code that looks like this: if (is_object($r_ele)) { foreach ($r_ele as $reading_element) { $re_pri = $reading_element->re_pri; if (is_object($re_pri)) { foreach ($re_pri as $value) { switch ($value) { // decide what to do here } } } else { switch ($re_pri) { // decide what to do here } } } } else { $re_pri = $reading_element->re_pri; if (is_object($re_pri)) { foreach ($re_pri as $value) { switch ($value) { // decide what to do here } } } else { switch ($re_pri) { // decide what to do here } } } I know that there must be a more elegant way to do this and would love suggestions of how I can improve my code.
  15. I've got this PHP script for invalidating files in the Amazon CloudFront CDN, which I want to automate. I got it from GitHub. Part of it uses XML, where the file paths are added. $xml = <<<EOD <InvalidationBatch> <Path>/index.html</Path> <Path>/blog/index.html</Path> <CallerReference>{$distribution}{$epoch}</CallerReference> </InvalidationBatch> EOD; I have no idea how to go about this, but what I want to do is change this part so that file paths are added from the output of the bash find command: find /srv/domain.com/wp-content/uploads/ -user www-data This is to invalidate new image file uploads after they have been optimised using a cron script. To further complicate matters, the path needs to only include from the wp-content directory onwards, so the XML would end up something like this: $xml = <<<EOD <InvalidationBatch> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-364x400.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-165x213.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-165x220.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-371x495.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-471x609.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-687x412.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-300x180.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-150x150.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-687x477.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-110x142.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-500x432.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINE_PROMOTION_1-624x432.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-471x282.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-150x150.jpg</Path> <Path>/wp-content/uploads/2014/02/VALENTINES14-WEB_banner-794x4761-364x400.jpg</Path> <Path>/wp-content/uploads/2014/02/ED_Wedluxe-CuveeRose-110x146.jpg</Path> <CallerReference>{$distribution}{$epoch}</CallerReference> </InvalidationBatch> EOD; I'd really appreciate any help on how to go about this. Thanks.
  16. Hi, I have this file: http://www.cineworld.co.uk/syndication/film_times.xml I want to extract all the film information with anything that equals <row key="90"> I can't however seem to get find a way of targeting that row. <?php $getfile = file_get_contents('http://www.cineworld.co.uk/syndication/film_times.xml'); $arr = simplexml_load_string($getfile); foreach($arr->row as $a => $b) { echo "<br>".$a,'="',$b,"\"\n"; } ?> Could someone point me in the direction that I can find some help please?
  17. Okay I am new to this so bare with me. I have been trying to suck in a XML file and echo out it's attributes. Here is a example PHP code I am trying to use to do this. I need direction on how to make this work. PLEASE! <?php $xml=simplexml_load_file("Jim.xml"); echo $xml->MachineData->['timeStamp'] . "<br>"; echo $xml->MachineData[0]->['machineID'] . "<br>"; echo $xml->MachineData[0]->['lineID'] . "<br>"; echo $xml->stationName . "<br>"; echo $xml->partNumber . "<br>"; echo $xml->modelNumber . "<br>"; echo $xml->serialNumber . "<br>"; echo $xml->LotNumber . "<br>"; ?> Jim.xml
  18. how to raed an xml file in cakephp i tried this in controller http://bakery.cakephp.org/articles/fahad19/2008/08/26/parsing-xml-files-with-cakephp but i am getting error Fatal error: Class 'XML' not found in site.com/app/Controller/UsersController.php on line 79 at line 79 : $parsed_xml =& new XML($file); i am using cakephp 2.0. Any suggestions?
  19. Hello, I have one big XML file (600 MB - 850 MB) in format "cells_yyyymmdd_hhmi.xml" I would like to specify that everyday i will have new file with new date. So, there should be general way to rea For exmaple, i have file of 7th January. Its, cells_20140107_154016 Goal is to split into small parts by shell script and do operation.
  20. I have a csv file which contains this data: person1,person2,person3 first,john,steve,mike last,doe,whinney,speirs I want to create an xml file which looks like this: <root> <person1> <first> john </first> <last> doe </last> </person1> <person2> <first> steve </first> <last> whinney </last> </person2> <person3> <first> mike </first> <last> speirs </last> </person3> </root> Thanks
  21. I have the following code which works just fine sending the $xml. However when i try to add a file to be sent with the xml as well i get an error. I tried using a postData array but then got an array to string error. The way i have it now works but it only sends the xml not the file. Any ideas on how I can send the @file with the postfields? Any help is appreciated $header = array('Content-Type: multipart/form-data'); $xml['xml'] = '<UploadPhoto>'; $xml['xml'] .= '<ID>12345</ID>'; $xml['xml'] .= '<PhotoID>myphoto</PhotoID>'; $xml['xml'] .= '<Filename>myphoto.jpg</Filename>'; $xml['xml'] .= '<Instructions>Need cheeks less rosy</Instructions>'; $xml['xml'] .= '</UploadPhoto>'; $postData = array( 'file' => '@/myphoto.jpg', 'xml' => $xml ); } $connection = curl_init(); curl_setopt($connection, CURLOPT_URL, "http://www.myurl.com/api"); curl_setopt($connection, CURLOPT_HTTPHEADER, $header); curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($connection, CURLOPT_POST, 1); curl_setopt($connection, CURLOPT_POSTFIELDS, $xml); curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1); set_time_limit(108000); $output = curl_exec($connection); curl_close($connection); print_r($output);
  22. hi i wonder if someone can help i have some code to make a simple XML output <?php header('Content-type: text/xml'); header('Pragma: public'); header('Cache-control: private'); header('Expires: -1'); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?> <xml> <customers> <id>song_path</id> <name>David</name> <promos> D123OO M876TT B765DC LO122M </promos> </customers> </xml>"; ?> my problem is; when the XML is displayed in the browser, it forces the values in <promos> onto 1 line <promos>D123OO M876TT B765DC LO122M</promos> is it possible to keep the formatting, so it outputs <promos> D123OO M876TT B765DC LO122M </promos> i have tried lots of different things but nothing seems to work \r\n \n\r \n \r <br /> <p> the only option which came close was <br />, but the XML actually displays the <br /> tag can anyone help? thank you
  23. When using the following code: $yaxis=array(); $xaxis=array(); for ($i = 1; $i <= $number_of_entries; $i++) { $channel = $xml->xpath("//ns:BulkData[ns:Name='InternetGatewayDevice.LANDevice.1.WLANConfiguration.X_181BEB_ChannelDiagnostics.Result.{$i}.Channel']/ns:Value"); $channel = $channel[0]; $xaxis[]=$channel[0]; $apcount = $xml->xpath("//ns:BulkData[ns:Name='InternetGatewayDevice.LANDevice.1.WLANConfiguration.X_181BEB_ChannelDiagnostics.Result.{$i}.APcount']/ns:Value"); $apcount = $apcount[0]; $yaxis[]=$apcount[0]; } I get the following results for $xaxis and $yaxis arrays: print_r($xaxis); Array ( [0] => SimpleXMLElement Object ( [0] => 1 ) [1] => SimpleXMLElement Object ( [0] => 6 ) [2] => SimpleXMLElement Object ( [0] => 11 ) ) print_r($yaxis); Array ( [0] => SimpleXMLElement Object ( [0] => 3 ) [1] => SimpleXMLElement Object ( [0] => 8 ) [2] => SimpleXMLElement Object ( [0] => 6 ) ) What I am looking for is only the value of the nested array. Like this: print_r($xaxis); Array ( [0] => 1 [1] => 6 [2] => 11 ) print_r($yaxis); Array ( [0] => 3 [1] => 8 [2] => 6 ) How can I achieve this? Thanks for any help / suggestions!
  24. Hello, I have one tar.Z file. I have to run shell script daily as it is required to update the database. customer_yyyymmdd_hhmi.tar.Z sales_ yyyymmdd_hhmi.csv (5 MB - 20 MB) purchase_ yyyymmdd_hhmi.xml (650 MB - 950 MB) I have made small part of XML file. There are 4 parts. There is PHP Script which is working but i need to change each time file like PART1.xml, PART2.xml etc. Things to do: 1) Extract tar.Z file and Read CSV and XML file. 2) Read whole XML file automatically. I hope i am clear. Thanks in advanced for your time and input.
  25. I am looking at an xml that has the greater than sign inside the attribute value. <CATEGORY id='163' name='Toys > Other '></CATEGORY> My job is to create a similar xml where the > sign exists inside the node's attribute value ? is this possible ? how ? I tried this: $catName = htmlspecialchars_decode(str_replace('-', '>',$CategoryName )) ; but it just encoded the > into > . Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.