PHP - Parsing Xml File
I know how to parse and print out contents of an XML file with SimpleXML but when I do it with this one I just get an empty string.
XML file sample: Code: [Select] <?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Title>Periodens vara - maj</Title> <Company>Company1</Company> <Version>1.00</Version> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <AllowPNG/> </OfficeDocumentSettings> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>10005</WindowHeight> <WindowWidth>10005</WindowWidth> <WindowTopX>120</WindowTopX> <WindowTopY>135</WindowTopY> <ProtectStructure>False</ProtectStructure> <ProtectWindows>False</ProtectWindows> </ExcelWorkbook> <Styles> <Style ss:ID="Default" ss:Name="Normal"> <Alignment ss:Vertical="Bottom"/> <Font ss:FontName="Calibri" ss:Size="11" ss:Color="#000000"/> </Style> .... I get no error so the structure is correct. But doing print_r() returns an empty array. So does children(). How do I start, help me out Similar TutorialsIt will be a txt file and I need to parse it and insert it into a mysql, I know there are many parser examples out there, but half I don't understand...... this is how the file is... I'll also attach it... Code: [Select] [5/3/2011 12:37:14]: SuspectsKill: TeK_SiC Pwn^Guandi 9mm SMG I need to place the killer and the person who got killed, I don't really need the weapon if there not in the db I need to enter it..... and if they are I need it to add a kill on there name... this is just some of the log.. thanks for the help! Hi all, I have a text file with few IP ranges in the following format: 1.52.0.0 - 1.55.255.255 What I hope I can do is to loop through the file content and retrieve the start IP / end IP (each in a variable) so that I can work on each of them. So for example for the line above I wish to get (1.52.0.0) in a var and (1.55.255.255) in another var while looping the file content So I was wondering if I can get any help on how to do this using PHP? Please excuse me if this seem to be very easy question but I am quite new to php, so any code help will be highly appreciate Thanks for your time Mark having a problem importing a file having multiple hierarchy levels!! its a csv file the contents look something like this! just need a jump start! thanks the file looks likes this row 1 row2 row3 name1 subj1 abcd efgh subje2 test1 test2 the file has to first import name1 then subj1 then abcd,then efgh then move back to subj2 and so on! Thanks Hi, As I am new to PHP and JSON my Interest in the field pushes me to know further. I have successfully parsed a JSON file: { "birthdays": [ "319507200" :"Kyle", "1390435200" :"Noah", "307843200" :"Carla" ] } Using this PHP file: <?php $jsondata = file_get_contents("birthdays.json"); $json = json_decode($jsondata,true); echo $json["birthdays"][0]['1390435200']; ?> Now I would like to know how to display when Noah’s birthday is, in the form yyyy/MM/dd. Can an expert tell me how this would be done? Thank you :-) hi php freaks, Is there a way to parse an include file through the php engine and then place the contents into a variable? Code: [Select] $x = include ($myfile); Here's what I need to do: I have a page that reads file and simply echos it. $mystring = file_get_contents($file); echo "$mystring"; There is one piece of info I need to parse out and then use as part of my page title. The phrase I need to parse is an HTML comment field and looks like this: <!--PageTitle=<some text here> --> I'm sure this is simple but I'm clueless as you can tell. How can I do this? DryAquaman Hi to all!! I am still new to php.. I need help in reading my text file and inserting it to mysql database. My text file contains 5 fields and has several rows.. The format of my text file: 1 romeo 8877 2010-07-07 abc1 2 nick 7686 2010-07-07 abc2 3 mark 5456 2010-07-07 abc3 4 karm 3432 2010-07-07 abc4 The first field is an INTEGER, the second third fifth fields are VARCHAR and the fourth field is a DATE. I am having trouble with my php code.. My code is this: <?php mysql_connect("localhost","root",""); mysql_select_db("personss"); $textFileName = $_POST['textFileName']; $myFile = "$textFileName"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); $person = explode("\n", $theData); $count = 0; foreach($person as $i => $line) { $nameParts = explode(" ", $person[$count]); $q = "insert into logged (id, name, num, datess, letters) values ('" . implode("','",$nameParts) . "')"; $rw = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); } ?> This code can insert to the database but it only inserts the first row and it loops the insert according to how many rows there are in the text file..For example in my text file there are are 4 rows, it inserts the first row: 1 romeo 8877 2010-07-07 abc1 4times..If there are 6 rows, 6 times the first row will also be inserted.. What i need Sir's is that i need to be able to insert the rows line by line.. if there are 4 rows, i need to insert them all in the database.. Please help me to fix the code. Hello, I am a PHP newbie, and have been mostly playing around with PHP/MySQL in a CMS ares (i.e. building my own CMS). Now I am trying to expand my knowledge outside of the basic php commands, and a particular subject caught my attention. Getting page source code, parsing out bits from it, and displaying it. This is more of my personal goal to get it working, to learn more about some of PHP's abilities, and especially search parameter flag thingies D: http://nexrem.com/scripts/get_source/ That is my webpage i made real quick, as you can see it shows basic stuff. Code for it is: Code: [Select] <html> <head> <title>Content Site</title> </head> <body> <p>This is intro text</p> <a href="http://google.com" title="Search Engine">Google Link</a><br /> <a href="http://yahoo.com" title="">Yahoo Page</a></br > <a href="http://http://www.phpfreaks.com" title="Awesome Site">PHP Freaks Help</a><br /> Bottom of file </body> </html> Now, I have a php file called get_link.php >> http://nexrem.com/scripts/get_source/get_links.php Code: [Select] <?php $url = 'http://nexrem.com/scripts/get_source/'; $needle = 'google'; $contents = file_get_contents($url); if(strpos($contents, $needle)!== false) { echo 'found'; } else { echo 'not found'; } // The \\2 is an example of backreferencing. This tells pcre that // it must match the second set of parentheses in the regular expression // itself, which would be the ([\w]+) in this case. The extra backslash is // required because the string is in double quotes. $html = $contents; echo $contents; preg_match_all("/(<([\w]+)[^>]*>)(.*?)(<\/\\2>)/", $html, $matches, PREG_SET_ORDER); foreach ($matches as $val) { echo "matched: " . $val[0] . "\n"; echo "part 1: " . $val[1] . "\n"; echo "part 2: " . $val[2] . "\n"; echo "part 3: " . $val[3] . "\n"; echo "part 4: " . $val[4] . "\n\n"; } ?> From what I understand, file_get_contents gets what the user sees? Or it gets the source code, and I just can't output it as such, cause my browser renders it? Question 1: Is it possible to get the html code of the page, rather than what the html renders it to be? How? Question 2: I can just Right click > view source and paste that result into a text file. I think I know how to search for a specific string, but how would I do it recursively, along the lines of: Search for text between <a href=" and " so I get the raw link Then add the results to an array. And then use foreach to output all the links from the array? Any help, hints are appreciated! Thank You! P.S. I quite frankly, got no idea what "/(<([\w]+)[^>]*>)(.*?)(<\/\\2>)/ is... Can someone refer me to a page where I can learn about those expressions? Hello, I need help. I have a file test.txt, and this content in it: Code: [Select] [group 1] immediate=yes links=1,14,12,22 avaliable=no [group 2] immediate=no links=1,4,14,22 Now, I also have a WEB app with database, where I can change both groups, and the only this missing is, that when a change is made in on group, that I write it to the file test.txt. I know how to write to files, but here is the problem (2 examples): If I change on the WEB page below group 1 from immediate=yes to immediate=no -> how can I change this in the file (just for group 1). If I change on the WEB page below group 2 to avaliable=yes -> how can I add this line in the file below group 2 To summarize - I have problems detecting where the group 1 or group 2 starts and end - so I only change for each group. I'm trying to utilize a PHP script to parse a large XML file (around 450 MB) to MYSQL database into certain structure and definitions of included XML elements. The problem is that the original script uses file_get_contents and SimpleXMLElement to get it done, but the corn job executed by the server halts due to the volume of the XML file. I'm no PHP expert, so I bought this XMLSplit software and divided the XML into 17 separated XML files each at size of 30 MB, parsed them one by one using the same script. However, the output database was missing a lot of input, and I have serious doubts whether this would be the same output of the original file if left not divided automatically and parsed one by one.
So, I've decided to use XMLReader with this exact PHP script to parse this big XML file, but so far I couldn't manage to simply replace the parsing code and keep other functionality intact.
I'm including the script below, I'd really appreciate if someone helps me to do so.
<?php set_time_limit(0); ini_set('memory_limit', '1024M'); include_once('../db.php'); include_once(DOC_ROOT.'/include/func.php'); mysql_query("TRUNCATE screenshots_list"); mysql_query("TRUNCATE pages"); mysql_query("TRUNCATE page_screenshots"); // This is the part I need help with to change into XMLReader instead of utilized function, to enable parsing of the large XML file correctly (while keeping rest of the script code as is if possible): $xmlstr = file_get_contents('t_info.xml'); $xml = new SimpleXMLElement($xmlstr); foreach ($xml->template as $item) { //print_r($item); $sql = sprintf("REPLACE INTO templates SET id = %d, state = %d, price = %d, exc_price = %d, inserted_date = '%s', update_date = '%s', downloads = %d, type_id = %d, type_name = '%s', is_flash = %d, is_adult = %d, width = '%s', author_id = %d, author_nick = '%s', package_id = %d, is_full_site = %d, is_real_size = %d, keywords = '%s', sources = '%s', description = '%s', software_required = '%s'", $item->id, $item->state, $item->price, $item->exc_price, $item->inserted_date, $item->update_date, $item->downloads, $item->template_type->type_id, $item->template_type->type_name, $item->is_flash, $item->is_adult, $item->width, $item->author->author_id, $item->author->author_nick, $item->package->package_id, $item->is_full_site, $item->is_real_size, $item->keywords, $item->sources, $item->description, $item->software_required); //echo '<br>'.$sql; mysql_query($sql); //print_r($item->screenshots_list->screenshot); foreach ($item->screenshots_list->screenshot as $scr) { $main = (!empty($scr->main_preview)) ? 1 : 0; $small = (!empty($scr->small_preview)) ? 1 : 0; insert_data($item->id, 'screenshots_list', 0, $scr->uri, $scr->filemtime, $main, $small); } foreach ($item->styles->style as $st) { insert_data($item->id, 'styles', $st->style_id, $st->style_name); } foreach ($item->categories->category as $cat) { insert_data($item->id, 'categories', $cat->category_id, $cat->category_name); } foreach ($item->sources_available_list->source as $so) { insert_data($item->id, 'sources_available_list', $so->source_id, ''); } foreach ($item->software_required_list->software as $soft) { insert_data($item->id, 'software_required_list', $soft->software_id, ''); } //print_r($item->pages->page); if (!empty($item->pages->page)) { foreach ($item->pages->page as $p) { mysql_query(sprintf("REPLACE INTO pages SET tpl_id = %d, name = '%s', id = NULL ", $item->id, $p->name)); $page_id = mysql_insert_id(); if (!empty($p->screenshots->scr)) { foreach ($p->screenshots->scr as $psc) { $href = (!empty($psc->href)) ? (string)$psc->href : ''; mysql_query(sprintf("REPLACE INTO page_screenshots SET page_id = %d, description = '%s', uri = '%s', scr_type_id = %d, width = %d, height = %d, href = '%s'", $page_id, $psc->description, $psc->uri, $psc->scr_type_id, $psc->width, $psc->height, $href)); } } } }}?>I'd appreciate your help with that... Hi guys I am new to this forum and a complete newb to php. I was wandering if I can get some help with XML parsing using php. The XML snippet is as follows:-- <some-xml1> <some-xml2> </some-xml2> <ReportHost> <HostName>192.168.2.34</HostName> <startTime>Thu Dec 17 13:58:49 2007</startTime> <stopTime>Thu Dec 17 15:13:13 2007</stopTime> <netbios_name>(unknown)</netbios_name> <mac_addr>(unknown)</mac_addr> <dns_name>(unknown)</dns_name> <os_name>(unknown)</os_name> <num_ports>2</num_ports> <num_lo>0</num_lo> <num_med>0</num_med> <num_hi>0</num_hi> <ReportItem> <port>http (80/tcp)</port> <severity>0</severity> <pluginID>0</pluginID> <pluginName></pluginName> <data>PORT</data> </ReportItem> <ReportItem> <port>telnet (23/tcp)</port> <severity>0</severity> <pluginID>0</pluginID> <pluginName></pluginName> <data>PORT</data> </ReportItem> <ReportItem> <port>http (80/tcp)</port> <severity>0</severity> <pluginID>0</pluginID> <pluginName></pluginName> <data>PORT</data> </ReportItem> <ReportItem> <port>telnet (23/tcp)</port> <severity>0</severity> <pluginID>0</pluginID> <pluginName></pluginName> <data>PORT</data> </ReportItem> </ReportHost> <some-xml3> </some-xml3> </some-xml1> There are <reporthost> tags for one host and within that tag are <reportitem> tags for every item on that host. Now I need a way to extract hostnames from every <reporthost> and associate all the <pluginname> with that particular host. Any help will be appreciated. Thanks in advance Alright, I'm trying to get the numbers in divs with with the class of content I have been using this but its not working <?php error_reporting(E_ALL); ini_set('display_errors', 1); include(dirname(__FILE__) .'/include/simple_html_dom.php'); //playlist page $playlist_page = 'http://www.bungie.net/stats/reach/online.aspx'; //create dom $html = new simple_html_dom(); $html->load_file($playlist_page); //get all divs $get_divs = ''; $get_divs_el = $html->find('li.glowBox'); if (preg_match_all('|<div[^>]+>(.*)</div>|U', $get_divs_el[0]->innertext, $matches)) { $get_divs = $matches[0]; } print_r($get_divs_el); print_r($get_divs); ?> Code: [Select] <ul> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl00_nameLink" href="/stats/reach/playlists.aspx?p=29898">NOBLE MAP PACK</a> </h4> 1,192 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl01_nameLink" href="/stats/reach/playlists.aspx?p=30228">COMMUNITY SLAYER</a> </h4> Available 2.08.2011 </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl02_nameLink" href="/stats/reach/playlists.aspx?p=30353">GRIFBALL</a> </h4> Available 2.08.2011 </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl03_nameLink" href="/stats/reach/playlists.aspx?p=30446">FIREFIGHT LIMITED</a> </h4> Available 2.08.2011 </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl04_nameLink" href="/stats/reach/playlists.aspx?p=30291">FIREFIGHT ARCADE</a> </h4> Available 2.08.2011 </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl05_nameLink" href="/stats/reach/playlists.aspx?p=25886">RUMBLE PIT</a> </h4> 4,586 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl06_nameLink" href="/stats/reach/playlists.aspx?p=29220">LIVING DEAD</a> </h4> 4,684 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl07_nameLink" href="/stats/reach/playlists.aspx?p=25885">TEAM SLAYER</a> </h4> 14,501 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl08_nameLink" href="/stats/reach/playlists.aspx?p=29978">MLG</a> </h4> 1,457 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl09_nameLink" href="/stats/reach/playlists.aspx?p=28808">TEAM SWAT</a> </h4> 9,670 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl10_nameLink" href="/stats/reach/playlists.aspx?p=29219">TEAM SNIPERS</a> </h4> 3,051 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl11_nameLink" href="/stats/reach/playlists.aspx?p=28474">TEAM OBJECTIVE</a> </h4> 1,208 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl12_nameLink" href="/stats/reach/playlists.aspx?p=28475">MULTI TEAM</a> </h4> 2,306 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl13_nameLink" href="/stats/reach/playlists.aspx?p=28476">BIG TEAM BATTLE</a> </h4> 6,621 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl14_nameLink" href="/stats/reach/playlists.aspx?p=28477">INVASION</a> </h4> 2,475 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl15_nameLink" href="/stats/reach/playlists.aspx?p=28478">FIREFIGHT</a> </h4> 6,302 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl16_nameLink" href="/stats/reach/playlists.aspx?p=28479">SCORE ATTACK</a> </h4> 1,568 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl17_nameLink" href="/stats/reach/playlists.aspx?p=28779">CO-OP CAMPAIGN</a> </h4> 285 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl18_nameLink" href="/stats/reach/playlists.aspx?p=28481">TEAM ARENA</a> </h4> 1,228 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl19_nameLink" href="/stats/reach/playlists.aspx?p=28480">DOUBLES ARENA</a> </h4> 1,571 Players </div> </li> <li class="glowBox"> <div class="corner bottomLeft"></div> <div class="corner topRight"></div> <div class="content"> <h4><a id="ctl00_mainContent_playlistRepeater_ctl20_nameLink" href="/stats/reach/playlists.aspx?p=30227">FFA ARENA</a> </h4> 235 Players </div> </li> </ul> Hello requinix. I am taking advantage of this thread to expose my problem: It looks like the load function does NOT work properly and I CANNOT find the reason why: Code: [Select] $xml = new DOMDocument(); $xml->load("data/slides.xml"); In debugging, I can see the creation of a DOMDocument but the load function does not fill the $xml with the relative data even if it returns True: Code: [Select] <?xml version="1.0" encoding="UTF-8"?> <album> <slide url="data/327.jpg" rel_URL="show_craft.php?id=327" title="Art. 327"></slide> <slide url="data/330.jpg" rel_URL="show_craft.php?id=330" title="Art. 330"></slide> <slide url="data/311.jpg" rel_URL="show_craft.php?id=311" title="Art. 311"></slide> <slide url="data/239.jpg" rel_URL="show_craft.php?id=239" title="Art. 239"></slide> <slide url="data/275.jpg" rel_URL="show_craft.php?id=275" title="Art. 275"></slide> <slide url="data/IMG_2691.jpg" rel_URL=" " title="Art. IMG_2691"></slide> <slide url="data/IMG_2684.jpg" rel_URL=" " title="Art. IMG_2684"></slide> <slide url="data/crafts 023.jpg" rel_URL=" " title="Art. crafts 023"></slide> </album> I use XAMPP 1.7.7. In php.net, under DOMDocument::load page, there is a post that says "Function will not work if using XML DOM PECL module". In my phpinfo() there is only the "PECL Module version 2.0-dev $Id: sqlite.c 306939 2011-01-01 02:19:59Z felipe $ " under SQLite section enabled. I tried many things like changing xml path, replacing the xml file with a simpler one from, for example, w3schools but with no avail. I still get an empty document. I don't know where to bang my head since it looks like it's only me having this issue (search the web extensively). Any help is greatly appreciated. Thank you what is wrong with this code? I want to parse rss content and its giving error that, the input is not corret $xmlDoc = new DOMDocument(); $xml="http://www.pharmamanufacturing.com/index.html?mode=rss"; $xmlDoc->loadxml($xml); //$xmlDoc->load($xml); i have a garbled list of email details in html how can i parse all the emails between: To: xxx@ccc.com Subject: thanks Hi I have an XML file that I've been trying to parse with some success. Code: [Select] <?xml version='1.0' encoding='ISO-8859-1'?> <Notes> <Madrid> <trip> <ID>12518980</ID> <Duration>130</Duration> </trip> <trip> <ID>12518981</ID> <Duration>600</Duration> </trip> <trip> <ID>12518982</ID> <Duration>50</Duration> </trip> </Madrid> <London> <trip> <ID>12518983</ID> <Duration>Suzuki</Duration> </trip> </London> <Chicago> <trip> <ID>12518984</ID> <Duration>1600</Duration> </trip> <Chicago> </Notes> I am able to get all the nodes that I want, which is mainly ID and duration using: Code: [Select] $objDOM = new DOMDocument(); $objDOM->load("data.xml"); $note = $objDOM->getElementsByTagName("trip"); foreach( $note as $value ) { $ids = $value->getElementsByTagName("ID"); $id = $ids->item(0)->nodeValue; $durations = $value->getElementsByTagName("Duration"); $duration = $duration->item(0)->nodeValue; echo "ID is:".$id."<br />"; echo "Duration is:".$duration."<br />"; } What I'd really like to do, is to the get duration and ID for each of the parent nodes, i.e. Mardid, London and Chicago, without having 3 separate foreach loops, if that is possible? Basically I'm reading a local xml file, extracting data, and passing array over to a MySql function. Also, when each record is extracted I need to know the full parent-child category it was listed under. for example: <root> <node value="first"/> <node value="second"/> <header label="Numbers"> <header label="Roman numerals"> <node value="I"/> <node value="XV"/> </header> <node value="1"/> <node value="10"/> </header> </root> Hello everyone! I have been trying to figure out how I can go about this, and failing. I have a text file that lists records simply: ex: 99. I got in my friends "car", what a piece of crap... ex:100. It only goes 25mph. I need to parse it so that it uses the number to store in the table, or just remove everything and store the text to the end, using an auto increment for the line number(some span more than one line). The numbers cannot be used as a key either. The number of spaces after the number and period also varies, from 1-4. The text also contains other special characters such as quotes, numbers, commas, periods. Anyone have any ideas? I'm trying to go through a document and replace all the UBB tags with different values. I can preg match the tags, but I don't quit remember how to do the replacement. Tags are like: ect. Anyone have a basic example I can go from? I know I've done it before, just can't think tonight. |