easiest way would be tokenize the string and use the tokens. Somewhere you can have array of Months. Also a simple function to check whether to use st, nd, rd or th
diafol commented: My thoughts exactly +14
easiest way would be tokenize the string and use the tokens. Somewhere you can have array of Months. Also a simple function to check whether to use st, nd, rd or th
Feed the PHP code you want to analyze to yyparse(). That would build the tree (unfortunately, you'd be stuck with a global variable to build the tree from; that's a vary annoying shortcoming of bison).
Sorry if I misunderstood the question.
Thanks, just leave PHP thing, suppose you want to parse C++ (which will pretty be a like), how are you going to build AST from that global variable? That is my question where I hit a wall. I can tokenize the file into tokens using flex and I can feed those tokens to a parser but I don't know how to build the tree of those tokens!
Thanks for tutorial too, It was one of first things to read on the field and it did help me to understand some stuffs. I will check again!
thanks for reply nezachem.
I'm very newbee (actually just starting) with code analysis so take my words with grain of salt! that being said, let say I want to get a class from PHP file and all its Childrens (members as well as attributes) and thereby build a tree I can access. How do I go about?
I have read that tutorial and it is funny to learn how Lexical analyzer works but to be frank, Bison presented me with nightmares (have a lot of complex stuffs but I'm stll trying to grasp). Should I write a new grammar file or just use this one from zend?
NB: I want to write a source code browser
Hi friends,
I need to make a simple parser for parsing PHP files (classes, functions et al) and I have read both Flex and Bison manual. I have read somewhere that I must build Abstract Syntax Tree (AST) and utilize that. But I cannot find any tutorial on how to make AST with Bison
Please help me with a link or explanations.
Thanks!
<?php
session_start(); // starts the session
$_SESSION = $_SERVER; ?><?php
session_start();
$DEBUG=true;
$SELF=basename(__FILE__);
?>
You are just doing that....double starting session!
and if you mean a library where one can add nore functionality then check with inheritance!
hi,
i don´t think it´s bad design because
each week a new person ask about a new function or fields that don´t already exist :)
What kind of application is that? Definitely it is bad design. You cannot take toyota Mark II blue print and add new feature and say there was no design shortage. I don't want to enter into arguments but it is either bad design or it is entirely new app I have never heard of!
that is the work of HTML/CSS. PHP does not know anything about markup and is processed on server!
Wish you the same :) :)
Thanks niranga :)
Last one is the best plus, use parametric queries (Bind/execute)
Have been out of DW for a while,Hope is not too late!
Hi Buddies, here is my happy new year greetings to all PHP friends.
Love you and enjoy DW!
$greetings = "Have nice year full of projects and less stress <br /> Enjoy!";
if(!$is_dead && $is_visiting_dw){
echo $greetings;
}else{
die("Dead people do not browse internet!!");
}
hi,
the app is growing and everyday i must add new fields.
App growing or bad design? App growing should at worst add new table not alter a table.
I think it is time to check your design!
change line number 24 to
if($search > 0){
Why should OP do that?
first if this line of code fails there is no notice like you did to connect
mysql_select_db('database');
may I know why you are mixing ampersand abd AND
if(isset($_POST['username']) && !empty($_POST['username']) AND isset($_POST['password']) && !empty($_POST['password']))
Also print_r($_POST) to see if the form posts values and indices are correct[CODE=PHP]if(isset($_POST) && !empty($_POST) AND isset($_POST) && !empty($_POST))
Also print_r($_POST) to see if the form posts values and indices are correct
Don't underestimate the amount of work it will take to do this. I have written SQL databases from scratch in the past, as well as C++ libraries to "wrap" SQL databases, used in major application software systems that run manufacturing operations all over the world. The database wrapper library was designed so that only parts of one class needed to be re-implemented to support different dbms's, and then loaded as a shared library, allowing the same code base to support Oracle, Sybase, Ingres, and Informix rdbms products without change or even recompiling at the application layer. This was done to replace a commercial library with similar functionality (Rogue-Wave's DBTools) because of licensing and performance needs. I forget how long it took to implement, but it was probably 6 months to a first commercial release, and I had years of experience writing similar code in C already, and years writing complex C++ application support libraries, so I knew what problems were likely to occur before I started.
In any case, Narue's suggestion about design first, and redesign when necessary, is so true! I always start with a design first using UML to model the system. That lets me look at the entities (classes, structures, etc), their relationships, and their behaviors in a consistent and visual fashion. Good UML modeling tools will also let you simulate the system as you design it, and in many cases today support round-trip engineering where it will actually generate code from the model, and vice-versa. The …
There's not always going to be a tutorial. Design the interface to suit your needs, and if it doesn't work out, throw it away and start over.
Thanks for a comments. I will try it!
I want to write a wrapper around MySQL but I will in future extend it to support other databases. I will cover only nasic useful features (commons) but it should be extensible in future with minimal change. I want to write an interface but I cannot get good tutorial to glean wisdom from.
I will be glad to hear your comments and pointers. Don't worry about re inventing the wheel, much of the time is funny way of learning ;)
Why is it bad the JS, it is working perfectly...
What about a browser with JS turned off?
I would like to know whether how I can send the email to multiple recipients....
Also I am just a green horn in PHP ,I really don't what know kind of features are possible.
So I would appreciate your guidance on the same.And also the implementation part.Thanks life,universe and everything.
You can use AddAddress multiple times. Most other basic features can be found in this tutorial.
Also you can think of putting stuffs in loops
Use AJAX Calls from one domain to another. If they share database then just check isOnline field which you must set in that other domain!
to log out just unset variables you did set and destroy the session. I can see validation in JS, that is bad unless it there is of course another check in Server side.
explain more with what you have so far!
Coding yours is perfect solution. Otherwise you have to live with waht is available. If you want to code one, checking PHP framework will be of great help!
Thank you everyone, you all were a great help to me.
With this i think it's case closed.
Enjoy! :)
Thank you it works.
But I would like to ask: I have read somewhere (I can't remember where anymore), that when session starts, it may set a cookie named SSID on client-side.
Is that true, and if it is , can it be used for such a thing?
I would advice you to stay away with internals of PHP.
That being said, I will quote Vikram's explanation found here:
Sessions work by associating every session with a session ID (a unique
identifier for the session) that is automatically generated by PHP. This session ID is
stored in two places: on the client using a temporary cookie, and on the server in a
flat file or a database. By using the session ID to put a name to every request received,
a developer can identify which client initiated which request, and track and maintain
client-specific information in session variables (variable-value pairs which remain alive
for the duration of the session and which can store textual or numeric information).
Simple xml is not something I've come across before...
http://www.phpro.org/tutorials/Introduction-To-SimpleXML-With-PHP.html
Another dirty option will be scrapping all html page from link and display them as they are!
if(!isset$_SESSION['expiry']){
$_SESSION['expiry']=time()+$time_to_expire;
}else{
//if time have expired
if( time()>$_SESSION['expiry']){
//echo message and redirect to the page
//unset variable
}
}
*untested*
Thanks Tony!
Thanks PT,
I will mark this solved and finish up quirks myself
Thanks for your help!
Thanks PT,
I will mark this solved and finish up quirks myself
Thanks for your help!
I think my code fails to give out the last block (sorry but that was sub 5 minutes of coding, only one run of your sample) You should add
yield ''.join(block)
to end of the function.
can you tell what you understand, what not?
General concept of what you are doing.
It does not however work for these lines in sample.txt
1 $2$3$ And <a href=""strongs://430"">God </a><a href=""strongs://1288"">blessed </a><a href=""strongs://853""></a>the <a href=""strongs://7637"">seventh </a><a href=""strongs://3117"">day</a>, and <a href=""strongs://6942"">sanctified </a>it: <a href=""strongs://3588"">because </a>that in it he had <a href=""strongs://7673"">rested </a>from <a href=""strongs://4480|3605"">all </a>his <a href=""strongs://4399"">work </a><a href=""strongs://834"">which </a><a href=""strongs://430"">God </a><a href=""strongs://1254"">created </a>and <a href=""strongs://6213"">made</a>.
1 $2$4$
<a href=""strongs://428"">These </a>
<span style=""color:#808080;font-style:italic;""> are </span> the <a href=""strongs://8435"">generations </a>of the <a href=""strongs://8064"">heavens </a>and of the <a href=""strongs://776"">earth </a>when they were <a href=""strongs://1254"">created</a>, in the <a href=""strongs://3117"">day </a>that the <a href=""strongs://3068"">LORD </a><a href=""strongs://430"">God </a><a href=""strongs://6213"">made </a>the <a href=""strongs://776"">earth </a>and the <a href=""strongs://8064"">heavens</a>,
Seems to work also for your sample.txt
def get_blocks(source): block = [] for line in source: # simplified lazy check not very likely to mistake if len(line) > 12 and line.lstrip()[0].isdigit() and line[:12].count('$') == 3: if block: yield ''.join(block) block = [line] else: block.append(line) with open('sample.txt') as data: print('------------------\n'.join(get_blocks(data)))
EDIT: slightly stronger check for correct start of block
Seem to work ok (I have to do further check for data integrity) But could you explain the code?
Actually, why you can not use normal Python to group the lines (itertools.groupby or generator), but must use re?
data = """2 $5$233$ check big cat if it have not eaten all the meat 3 $5$233$ check big cat if it have not eaten all the meat <a href=""http://example.com"">An Example duh! </a> <a href=""http://example.com"">An Example duh! </a> 2 $5$233$ check big cat if it have not eaten all the meat check big cat if it have not eaten all the meat <a href=""http://example.com"">An Example duh! </a> 2 $5$233$ check big cat if it have not eaten all the meat""" def get_blocks(source): block = [] for line in source: # simplified lazy check not very likely to mistake if line.count('$') == 3: if block: yield ''.join(block) block = [line] else: block.append(line) print('\n'.join(get_blocks(data.splitlines())))
Cannot understand the code. can you explain a bit. I have been away python for so long ;)
Actually, why you can not use normal Python to group the lines (itertools.groupby or generator), but must use re?
PT,
I don't care what tool will get my job done. What I want to achieve. I want everything from number$number$number$text before next number$number$number$ to be on same line. But the text is random
So if itertools can do the job, that is fine with me :)
sample text is attached
1 $1$26$ And <a href=""strongs://430"">God </a><a href=""strongs://559"">said</a>, Let us <a href=""strongs://6213"">make </a><a href=""strongs://120"">man </a>in our <a href=""strongs://6754"">image</a>, after our <a href=""strongs://1823"">likeness</a>: and let them have <a href=""strongs://7287"">dominion </a>over the <a href=""strongs://1710"">fish </a>of the <a href=""strongs://3220"">sea</a>, and over the <a href=""strongs://5775"">fowl </a>of the <a href=""strongs://8064"">air</a>, and over the <a href=""strongs://929"">cattle</a>, and over <a href=""strongs://3605"">all </a>the <a href=""strongs://776"">earth</a>, and over <a href=""strongs://3605"">every </a>creeping <a href=""strongs://7431"">thing </a>that <a href=""strongs://7430"">creepeth </a><a href=""strongs://5921"">upon </a>the <a href=""strongs://776"">earth</a>.
1 $1$27$ So <a href=""strongs://430"">God </a><a href=""strongs://1254"">created </a><a href=""strongs://853""></a><a href=""strongs://120"">man </a>in his <span style=""color:#808080;font-style:italic;""> own </span><a href=""strongs://6754"">image</a>, in the <a href=""strongs://6754"">image </a>of <a href=""strongs://430"">God </a><a href=""strongs://1254"">created </a>he him; <a href=""strongs://2145"">male </a>and <a href=""strongs://5347"">female </a><a href=""strongs://1254"">created </a>he them.
1 $1$28$ And <a href=""strongs://430"">God </a><a href=""strongs://1288"">blessed </a>them, and <a href=""strongs://430"">God </a><a href=""strongs://559"">said </a>unto them, Be <a href=""strongs://6509"">fruitful</a>, and <a href=""strongs://7235"">multiply</a>, and <a href=""strongs://4390"">replenish </a><a href=""strongs://853""></a>the <a href=""strongs://776"">earth</a>, and <a href=""strongs://3533"">subdue </a>it: and have <a href=""strongs://7287"">dominion </a>over the <a href=""strongs://1710"">fish </a>of the <a href=""strongs://3220"">sea</a>, and over the <a href=""strongs://5775"">fowl </a>of the <a href=""strongs://8064"">air</a>, and over <a href=""strongs://3605"">every </a>living <a href=""strongs://2416"">thing </a>that <a href=""strongs://7430"">moveth </a><a href=""strongs://5921"">upon </a>the <a href=""strongs://776"">earth</a>.
1 $1$29$ And <a href=""strongs://430"">God </a><a href=""strongs://559"">said</a>, <a href=""strongs://2009"">Behold</a>, I have <a href=""strongs://5414"">given </a>you <a href=""strongs://853""></a><a href=""strongs://3605"">every </a><a href=""strongs://6212"">herb </a><a href=""strongs://2232"">bearing </a><a href=""strongs://2233"">seed</a>, <a href=""strongs://834"">which </a><span style=""color:#808080;font-style:italic;""> is </span><a href=""strongs://5921"">upon </a>the <a href=""strongs://6440"">face </a>of <a href=""strongs://3605"">all </a>the <a href=""strongs://776"">earth</a>, and <a href=""strongs://3605"">every </a><a href=""strongs://6086"">tree</a>, in the <a href=""strongs://834"">which </a><span style=""color:#808080;font-style:italic;""> is </span> the <a href=""strongs://6529"">fruit </a>of a <a href=""strongs://6086"">tree </a><a href=""strongs://2232"">yielding </a><a href=""strongs://2233"">seed</a>; to you it shall <a href=""strongs://1961"">be </a>for <a href=""strongs://402"">meat</a>.
1 $1$30$ And to <a href=""strongs://3605"">every </a><a href=""strongs://2416"">beast </a>of the <a href=""strongs://776"">earth</a>, and to <a href=""strongs://3605"">every </a><a href=""strongs://5775"">fowl </a>of the <a href=""strongs://8064"">air</a>, and to every <a href=""strongs://3605"">thing </a>that <a href=""strongs://7430"">creepeth </a><a href=""strongs://5921"">upon </a>the <a href=""strongs://776"">earth</a>, <a href=""strongs://834"">wherein </a><span style=""color:#808080;font-style:italic;""> there </span><span style=""color:#808080;font-style:italic;""> is </span><a href=""strongs://5315|2416"">life</a>, <span style=""color:#808080;font-style:italic;""> I </span><span style=""color:#808080;font-style:italic;""> have </span><span style=""color:#808080;font-style:italic;""> given </span><a href=""strongs://853""></a><a href=""strongs://3605"">every </a><a href=""strongs://3418"">green </a><a href=""strongs://6212"">herb </a>for <a href=""strongs://402"">meat</a>: and it <a href=""strongs://1961"">was </a><a href=""strongs://3651"">so</a>.
1 $1$31$ And <a href=""strongs://430"">God </a><a href=""strongs://7200"">saw </a><a href=""strongs://853""></a>every <a href=""strongs://3605"">thing </a><a href=""strongs://834"">that </a>he had <a href=""strongs://6213"">made</a>, and, <a href=""strongs://2009"">behold</a>, <span style=""color:#808080;font-style:italic;""> it </span><span style=""color:#808080;font-style:italic;""> was </span><a href=""strongs://3966"">very </a><a href=""strongs://2896"">good</a>. And the <a href=""strongs://6153"">evening </a>and the <a href=""strongs://1242"">morning </a><a href=""strongs://1961"">were </a>the <a href=""strongs://8345"">sixth </a><a href=""strongs://3117"">day</a>.
1 $2$1$ Thus the <a href=""strongs://8064"">heavens </a>and the <a href=""strongs://776"">earth </a>were <a href=""strongs://3615"">finished</a>, and <a href=""strongs://3605"">all </a>the <a href=""strongs://6635"">host </a>of them.
1 $2$2$ And on the <a href=""strongs://7637"">seventh </a><a href=""strongs://3117"">day </a><a href=""strongs://430"">God </a><a href=""strongs://3615"">ended </a>his <a href=""strongs://4399"">work </a><a href=""strongs://834"">which </a>he had <a href=""strongs://6213"">made</a>; and he <a href=""strongs://7673"">rested </a>on the <a href=""strongs://7637"">seventh </a><a href=""strongs://3117"">day </a>from <a href=""strongs://4480|3605"">all </a>his <a href=""strongs://4399"">work </a><a href=""strongs://834"">which </a>he had <a href=""strongs://6213"">made</a>.
1 $2$3$ And <a href=""strongs://430"">God </a><a href=""strongs://1288"">blessed </a><a href=""strongs://853""></a>the <a href=""strongs://7637"">seventh </a><a href=""strongs://3117"">day</a>, and <a href=""strongs://6942"">sanctified </a>it: <a href=""strongs://3588"">because </a>that in it he had <a href=""strongs://7673"">rested </a>from <a href=""strongs://4480|3605"">all </a>his <a href=""strongs://4399"">work </a><a href=""strongs://834"">which </a><a href=""strongs://430"">God </a><a href=""strongs://1254"">created </a>and <a href=""strongs://6213"">made</a>.
1 $2$4$
<a href=""strongs://428"">These </a>
<span style=""color:#808080;font-style:italic;""> are </span> the <a href=""strongs://8435"">generations </a>of the <a href=""strongs://8064"">heavens </a>and of the <a href=""strongs://776"">earth </a>when they were <a href=""strongs://1254"">created</a>, in the <a href=""strongs://3117"">day </a>that the <a href=""strongs://3068"">LORD </a><a href=""strongs://430"">God </a><a href=""strongs://6213"">made </a>the <a href=""strongs://776"">earth </a>and the <a href=""strongs://8064"">heavens</a>,
1 $2$5$ And <a href=""strongs://3605"">every </a><a href=""strongs://7880"">plant </a>of the <a href=""strongs://7704"">field </a><a href=""strongs://2962"">before </a>it <a href=""strongs://1961"">was </a>in the <a href=""strongs://776"">earth</a>, and <a href=""strongs://3605"">every </a><a href=""strongs://6212"">herb </a>of the <a href=""strongs://7704"">field </a><a href=""strongs://2962"">before </a>it <a href=""strongs://6779"">grew</a>: <a href=""strongs://3588"">for </a>the <a href=""strongs://3068"">LORD </a><a href=""strongs://430"">God </a>had <a href=""strongs://3808"">not </a>caused it to <a href=""strongs://4305"">rain </a><a href=""strongs://5921"">upon </a>the <a href=""strongs://776"">earth</a>, and <span style=""color:#808080;font-style:italic;""> there </span><span style=""color:#808080;font-style:italic;""> was </span><a href=""strongs://369"">not </a>a <a href=""strongs://120"">man </a>to <a href=""strongs://5647"">till </a><a href=""strongs://853""></a>the <a href=""strongs://127"">ground</a>.
1 $2$6$ But there went <a href=""strongs://5927"">up </a>a <a href=""strongs://108"">mist </a><a href=""strongs://4480"">from </a>the <a href=""strongs://776"">earth</a>, and <a href=""strongs://8248"">watered </a><a href=""strongs://853""></a>the <a href=""strongs://3605"">whole </a><a href=""strongs://6440"">face </a>of the <a href=""strongs://127"">ground</a>.
1 $2$7$ And the <a href=""strongs://3068"">LORD </a><a href=""strongs://430"">God </a><a href=""strongs://3335"">formed </a><a href=""strongs://853""></a><a href=""strongs://120"">man </a><span style=""color:#808080;font-style:italic;""> of </span> the <a href=""strongs://6083"">dust </a><a href=""strongs://4480"">of </a>the <a href=""strongs://127"">ground</a>, and <a href=""strongs://5301"">breathed </a>into his <a href=""strongs://639"">nostrils </a>the <a href=""strongs://5397"">breath </a>of <a href=""strongs://2416"">life</a>; and <a href=""strongs://120"">man </a><a href=""strongs://1961"">became </a>a <a href=""strongs://2416"">living </a><a href=""strongs://5315"">soul</a>.
1 $2$8$ And the <a href=""strongs://3068"">LORD </a><a href=""strongs://430"">God </a><a href=""strongs://5193"">planted </a>a <a href=""strongs://1588"">garden </a><a href=""strongs://4480|6924"">eastward </a>in <a href=""strongs://5731"">Eden</a>; and <a href=""strongs://8033"">there </a>he <a href=""strongs://7760"">put </a><a href=""strongs://853""></a>the <a href=""strongs://120"">man </a><a href=""strongs://834"">whom </a>he had <a href=""strongs://3335"">formed</a>.
1 $2$9$ And out <a href=""strongs://4480"">of </a>the <a href=""strongs://127"">ground </a>made the <a href=""strongs://3068"">LORD </a><a href=""strongs://430"">God </a>to <a href=""strongs://6779"">grow </a><a href=""strongs://3605"">every </a><a href=""strongs://6086"">tree </a>that is <a href=""strongs://2530"">pleasant </a>to the <a href=""strongs://4758"">sight</a>, and <a href=""strongs://2896"">good </a>for <a href=""strongs://3978"">food</a>; the <a href=""strongs://6086"">tree </a>of <a href=""strongs://2416"">life </a>also in the <a href=""strongs://8432"">midst </a>of the <a href=""strongs://1588"">garden</a>, and the <a href=""strongs://6086"">tree </a>of <a href=""strongs:
Looks like we would also change dot to match newline also by doing
re.MULTILINE | re.DOTALL
That is fine up until first line and all next line matches due to dot!
Is there a way to tell it to match all except given pattern (that shows next line)?
for example using above with DOTALL/MULTILINE with below it get returned as single line when it should be two.
1 $3$5$
<a href=""http://daniweb.com"">For </a>
<a href=""http://daniweb.com"">For </a><a href=""http://daniweb.com"">For </a>
<a href=""http://daniweb.com"">For </a><a href=""http://daniweb.com"">For </a>
2 $4$6$
<a href=""http://daniweb.com"">For </a>
<a href=""http://daniweb.com"">For </a><a href=""http://daniweb.com"">For </a>
<a href=""http://daniweb.com"">For </a><a href=""http://daniweb.com"">For </a>
Oh! and it just returns 1 $3$5$ when I do
res = re.findall(r'(\d{1,}\s*\$\s*\d{1,}\s*\$\s*\d{1,}\s*\$*.*)', data, re.MULTILINE)
for line in res:
print line
exit(0)
it is supposed to return a whole thing as single line.
text file is big and I didn't write myself!
the text below does not work even in re.M mode. Is there anything else I can do?
1 $3$5$
<a href=""http://daniweb.com"">For </a>
<a href=""http://daniweb.com"">For </a><a href=""http://daniweb.com"">For </a>
<a href=""http://daniweb.com"">For </a><a href=""http://daniweb.com"">For </a>
"copyright", "credits" or "license()" for more information. >>> data = """2 $5$233$ check big cat if it have not eaten all the meat 3 $5$233$ check big cat if it have not eaten all the meat <a href=""http://example.com"">An Example duh! </a> <a href=""http://example.com"">An Example duh! </a> 2 $5$233$ check big cat if it have not eaten all the meat check big cat if it have not eaten all the meat <a href=""http://example.com"">An Example duh! </a> 2 $5$233$ check big cat if it have not eaten all the meat""" >>> re.findall(r'(\d* \$\d*\d*.*) ', data) ['2 $5$233$ check big cat if it have not eaten all the', '3 $5$233$ check big cat if it have not eaten all the meat', '2 $5$233$ check big cat if it have not eaten all the meat', '2 $5$233$ check big cat if it have not eaten all the']
Let me check, but your solution seems geniously simple!
Hi,
I need to concatanate lines based on regex. Lines to be concatanated are scattered. All lines begin with number$number$number$number$sentences. There is nothing to mark the end of sentence, only the beginning. Here is an example. I want to rewrite this one
2 $5$233$ check big cat if it have not eaten all the meat
3 $5$233$ check big cat if it have not eaten all the meat
<a href=""http://example.com"">An Example duh! </a>
<a href=""http://example.com"">An Example duh! </a>
2 $5$233$ check big cat if it have not eaten all the meat
check big cat if it have not eaten all the meat
<a href=""http://example.com"">An Example duh! </a>
2 $5$233$ check big cat if it have not eaten all the meat
into this one
2 $5$233$ check big cat if it have not eaten all the meat
3 $5$233$ check big cat if it have not eaten all the meat <a href=""http://example.com"">An Example duh! </a> <a href=""http://example.com"">An Example duh! </a>
2 $5$233$ check big cat if it have not eaten all the meat check big cat if it have not eaten all the meat <a href=""http://example.com"">An Example duh! </a>
2 $5$233$ check big cat if it have not eaten all the meat
Since I have been while out of python, I'm running out of ideas and I need your help
Thanks
part of the problem is that an RTF file is both sequential and sometimes heirarchichal.
HTML is purely heirarchichal. at some point, you would need to make a decision WHEN to turn off something like bold or italics.
also, because rtf is sequential, with straight translation and no parsing you could theoretically end up with
\bthis is bold\ibold italics \b0italics\i0regular text
coming out with invaliddly nested HTML like this:
<strong>this is bold<em>bold italics </strong>italics</em>regular text
On situation like this, how do you go about?
then is SimpleXMLElement derived from SimpleXML, or is SimpleXML derived from SimpleXMLElement, or are they both separate classes? I am not sure I could read the PHP source code from the tarball.
I had thought that maybe SimpleXMLElement was derived from SimpleXML, but the documentation does not say anything.
The name says it, it is an element of SimpleXML. See this section that deals with that
just google "rtf format specification". rtf is essentially an ANSI text file. it can have pictures embedded in it, probably through some encoded-binary method.
http://support.microsoft.com/kb/86999parsers and lexical analyzers are the subject of compilers. compilers are used to translate ascii C code format to binary code or some other language or can be used basically as a converter.
flex and bison (lex and yacc) are compiler generator languages that generate C or C++ code you can compile. there are books on writing compilers. it's a complicated subject, and it's generally a good idea to take a college class (it's a credit class and it's available at some community colleges) on the subject and be very familiar with the language you are using.
Issue is not Docs, I have read them. I want to know how would other implement parser that for example will take rtf document and may parse it to html for browser and back to rtf for saving in file systems.
And no, I don't want to write that complex compiler stuffs
SimpleXML is not the same class as SimpleXMLElement. that tutorial is about a different class, but it is nice to have anyway.
Did you even bother to read it? I have read and printed it, it is all about SimpleXML.
BTW SimpleXML is a package which contain SimpleXMLElement. So far that is simplest and best tut I have seen on the subject!
Hi,
I need to write very simple RTF parser to write and read basic rtf (bold,italic, underline, paragraph et al). I have searched for techniques I can implement but havent found good example.
I would like to hear from you guys what approach whatsoever you consider to be best for you.
Thanks!