downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DOMText::isWhitespaceInElementContent> <DOMText
[edit] Last updated: Fri, 23 Mar 2012

view this page in

DOMText::__construct

(PHP 5)

DOMText::__constructYeni bir DOMText nesnesi oluşturur

Açıklama

__construct ([ string $değer ] )

Yeni bir DOMText nesnesi oluşturur.

Değiştirgeler

değer

Metin düğümünün değeri. Belirtilmezse boş bir metin düğümü oluşturulur.

Örnekler

Örnek 1 - Yeni bir DOMText nesnesi oluşturmak

<?php

$dom 
= new DOMDocument('1.0''utf-8');
$element $dom->appendChild(new DOMElement('root'));
$text $element->appendChild(new DOMText('kök değer'));
echo 
$dom->saveXML();
/* çıktısı:
     <?xml version="1.0" encoding="utf-8"?><root>kök değer</root> */

?>

Ayrıca Bakınız



add a note add a note User Contributed Notes DOMText::__construct
Thomas 27-Apr-2012 01:54
I experinced that DOMText, given a integer as only value to the constructor failed to return valid data. I had to typecast the input to a string first:

$intValue = 3252; // Post/Zip-code
$some_element->appendChild( new DOMText( (string) $intValue) );

When not typecasting using "(string)" the XML output from $root->saveXML() would not validate.

 
show source | credits | sitemap | contact | advertising | mirror sites