php-general Digest 6 Dec 2008 21:24:07 -0000 Issue 5830

Topics (messages 284233 through 284243):

Re: Convert .docx /.pdf file to .txt
        284233 by: Colin Guthrie
        284234 by: Ashley Sheridan

Re: How to Insert <?xml-stylesheet .....?> into DOMDocument
        284235 by: Nathan Rixham
        284243 by: Carlos Medina

Re: Poll of sorts: Javascript Form validation or PHP
        284236 by: Per Jessen
        284237 by: Nathan Rixham

Re: Parsing Strings
        284238 by: tedd
        284239 by: VamVan
        284240 by: Nathan Rixham
        284241 by: Nathan Rixham

How do you organise your PHP work ?
        284242 by: franzemmanuel

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
'Twas brillig, and Jagdeep Singh at 06/12/08 06:46 did gyre and gimble:
Hi!

I need a function to fetch text from docx file, but it is showing formated
characters in output. I was using fopen, fgets etc function .

I want to fetch text from .docx and save it to .txt file Without special
characters (Microsoft formated characters)

Is there any function or an example??

Nothing that I know of built in to PHP (although as docx is just XML AFAIK, you could just write an XSLT to extract the content).

You could also shell out to an application that would do it for you.

After about 5 seconds on google I found:

http://sourceforge.net/project/showfiles.php?group_id=235455

If it works or not I have no idea!

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--- End Message ---
--- Begin Message ---
On Sat, 2008-12-06 at 09:17 +0000, Colin Guthrie wrote:
> 'Twas brillig, and Jagdeep Singh at 06/12/08 06:46 did gyre and gimble:
> > Hi!
> > 
> > I need a function to fetch text from docx file, but it is showing formated
> > characters in output. I was using fopen, fgets etc function .
> > 
> > I want to fetch text from .docx and save it to .txt file Without special
> > characters (Microsoft formated characters)
> > 
> > Is there any function or an example??
> 
> Nothing that I know of built in to PHP (although as docx is just XML 
> AFAIK, you could just write an XSLT to extract the content).
> 
> You could also shell out to an application that would do it for you.
> 
> After about 5 seconds on google I found:
> 
> http://sourceforge.net/project/showfiles.php?group_id=235455
> 
> If it works or not I have no idea!
> 
> Col
> 
> -- 
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>    Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>    Mandriva Linux Contributor [http://www.mandriva.com/]
>    PulseAudio Hacker [http://www.pulseaudio.org/]
>    Trac Hacker [http://trac.edgewall.org/]
> 
> 
Also, as far as I believe, docx isn't just an XML document, but rather a
zip file of xml docs and other media.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Shanon Swafford wrote:
I have the following code:

#!/usr/bin/php -q
<?PHP
error_reporting(E_ALL);
ini_set('display_errors', '1');
    $doc = new DOMDocument();
    $doc->formatOutput = true;

    $foo = $doc->createElement("foo");
    $doc->appendChild($foo);

    $bar = $doc->createElement("bar");
    $foo->appendChild($bar);

    $bazz = $doc->createElement("bazz");
    $foo->appendChild($bazz);

    echo $doc->saveXML();

?>

Which generates:

<?xml version="1.0"?>
<foo>
  <bar/>
  <bazz/>
</foo>

Is there a way to make it create the following XML?

<?xml version="1.0"?>
<?xml-stylesheet href="xsl_table.xsl" type="text/xsl"?>
<foo>
  <bar/>
  <bazz/>
</foo>

I can't seem to find any dom functions to do this.

Thanks in advance,
Shanon



DOMProcessingInstruction as such:

<?php
error_reporting(E_ALL | E_STRICT);

$doc = new DOMDocument();
$doc->formatOutput = true;

// processing instruction data
$styleheetParams = 'href="xsl_table.xsl" type="text/xsl"';

// create processing instruction
$xmlstylesheet = new DOMProcessingInstruction( 'xml-stylesheet', $styleheetParams);

//append it to the doc
$doc->appendChild($xmlstylesheet);

$foo = $doc->createElement("foo");
$doc->appendChild($foo);

$bar = $doc->createElement("bar");
$foo->appendChild($bar);

$bazz = $doc->createElement("bazz");
$foo->appendChild($bazz);

echo $doc->saveXML();

?>

regards;

--- End Message ---
--- Begin Message ---
Shanon Swafford schrieb:
I have the following code:

#!/usr/bin/php -q
<?PHP
error_reporting(E_ALL);
ini_set('display_errors', '1');
    $doc = new DOMDocument();
    $doc->formatOutput = true;

    $foo = $doc->createElement("foo");
    $doc->appendChild($foo);

    $bar = $doc->createElement("bar");
    $foo->appendChild($bar);

    $bazz = $doc->createElement("bazz");
    $foo->appendChild($bazz);

    echo $doc->saveXML();

?>

Which generates:

<?xml version="1.0"?>
<foo>
  <bar/>
  <bazz/>
</foo>

Is there a way to make it create the following XML?

<?xml version="1.0"?>
<?xml-stylesheet href="xsl_table.xsl" type="text/xsl"?>
<foo>
  <bar/>
  <bazz/>
</foo>

I can't seem to find any dom functions to do this.

Thanks in advance,
Shanon


Hi Shanon,
please look at the Class itself, if you can modify the Header of the XML data over a method/Constant.

Greetings

Carlos Medina

--- End Message ---
--- Begin Message ---
Terion Miller wrote:

> I have a huge form to validate and wonder which is better javascript
> validation or php, the page is a php page, I actually put js
> validation on it but then it stopped working (stopped inserting into
> the db) not sure if that had anything to do with it....
> What does everyone prefer?

I don't think it's about the developer preference, it's about the user. 
Javascript enables lots of checking at data entry time, and can improve
the overall user experience.  If you're not particularly concerned with
the user experience, don't bother with javascript. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Per Jessen wrote:
Terion Miller wrote:

I have a huge form to validate and wonder which is better javascript
validation or php, the page is a php page, I actually put js
validation on it but then it stopped working (stopped inserting into
the db) not sure if that had anything to do with it....
What does everyone prefer?

I don't think it's about the developer preference, it's about the user. Javascript enables lots of checking at data entry time, and can improve
the overall user experience.  If you're not particularly concerned with
the user experience, don't bother with javascript.

/Per Jessen, Zürich


where as I think validation always needs to happen at the server side; each application or script should be self contained, it needs to check that the data it recieves is valid before working with it; if it is not valid it needs to inform the system that sent it the data is not valid.

The system that sent it in this case is the html output; so you need a method of displaying errors in the html.

That is the bare minimum and always needed.

As for making the experience nicer; javascript is good for this; it can be used to pre-validate input on the way in to the system; but should not be relied upon as it can be turned off, stop functioning due to another faulty javascript on the page or simply not be supported by the client. You still need the server side validation though.

So.. more of a case of always validate server side; and should / do you want to use javascript validation in addition.

IMHO :p



--- End Message ---
--- Begin Message ---
At 4:18 PM -0800 12/5/08, Jason Todd Slack-Moehrle wrote:
How might I also parse and address like: SCOTTSDALE, AZ 85254

It has a comma and a space

-Jason

On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote:

OK, making good learning progress today.

I have a string that is: Jason Slack

and I want it broken at the space so i get Jason and then Slack

I am looking at parse_str, but I dont get how to do it with a space. The example is using []=.

Then I want to assign like:

$fname = "Jason";
$lname = "Slack";

Any ideas?

-Jason

-Jason:

This is pretty basic stuff -- read the manuals about strings:

http://www.php.net/manual/en/book.strings.php

If you have shown that you've spent time reading and then have a problem, please post your question. But don't expect us to do your homework for you.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
u can use split() or explode ().

Thanks

On Sat, Dec 6, 2008 at 9:27 AM, tedd <[EMAIL PROTECTED]> wrote:

> At 4:18 PM -0800 12/5/08, Jason Todd Slack-Moehrle wrote:
>
>> How might I also parse and address like: SCOTTSDALE, AZ 85254
>>
>> It has a comma and a space
>>
>> -Jason
>>
>> On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote:
>>
>>  OK, making good learning progress today.
>>>
>>> I have a string that is: Jason Slack
>>>
>>> and I want it broken at the space so i get Jason and then Slack
>>>
>>> I am looking at parse_str, but I dont get how to do it with a space. The
>>> example is using []=.
>>>
>>> Then I want to assign like:
>>>
>>> $fname = "Jason";
>>> $lname = "Slack";
>>>
>>> Any ideas?
>>>
>>> -Jason
>>>
>>
> -Jason:
>
> This is pretty basic stuff -- read the manuals about strings:
>
> http://www.php.net/manual/en/book.strings.php
>
> If you have shown that you've spent time reading and then have a problem,
> please post your question. But don't expect us to do your homework for you.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
tedd wrote:
At 4:18 PM -0800 12/5/08, Jason Todd Slack-Moehrle wrote:
How might I also parse and address like: SCOTTSDALE, AZ 85254

It has a comma and a space

-Jason

On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote:

OK, making good learning progress today.

I have a string that is: Jason Slack

and I want it broken at the space so i get Jason and then Slack

I am looking at parse_str, but I dont get how to do it with a space. The example is using []=.

Then I want to assign like:

$fname = "Jason";
$lname = "Slack";

Any ideas?

-Jason

-Jason:

This is pretty basic stuff -- read the manuals about strings:

http://www.php.net/manual/en/book.strings.php

If you have shown that you've spent time reading and then have a problem, please post your question. But don't expect us to do your homework for you.

Cheers,

tedd


this is wrong on so many levels, but his name indicates that he's more of a delegator than a doer :p
--- End Message ---
--- Begin Message ---
tedd wrote:
At 4:18 PM -0800 12/5/08, Jason Todd Slack-Moehrle wrote:
How might I also parse and address like: SCOTTSDALE, AZ 85254

It has a comma and a space

-Jason

On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote:

OK, making good learning progress today.

I have a string that is: Jason Slack

and I want it broken at the space so i get Jason and then Slack

I am looking at parse_str, but I dont get how to do it with a space. The example is using []=.

Then I want to assign like:

$fname = "Jason";
$lname = "Slack";

Any ideas?

-Jason

-Jason:

This is pretty basic stuff -- read the manuals about strings:

http://www.php.net/manual/en/book.strings.php

If you have shown that you've spent time reading and then have a problem, please post your question. But don't expect us to do your homework for you.

Cheers,

tedd


this is wrong on so many levels, but his name indicates that he's more of a delegator than a doer :p
--- End Message ---
--- Begin Message ---
Hi !
I wanted to know how you organise your work when you develop a project ?
- I have a checking list to control each file.
- I make a diagram (with Impress).
- And a CalcSheet to follow my variables.
(examples : http://www.surleweb.biz/development.php).

And you ? How do you work ?

Have a good evening everybody !

--- End Message ---

Reply via email to