How can I encode from UTF-8 to windows-1251? (Russian encoding)
Read this in the manual, especially the user comments at the bottom: several scripts pasted that will help you out: http://uk2.php.net/utf8-encode
Thank you 🙂 Now i have another problem, when i try to use my script, my browser shows a blank page. There is the main part of the code. $xml = domxml_open_file("content.xml"); $root = $xml->document_element(); $root_child = $root->child_nodes(); for($i=0; $i<count($root_child);$i++) { echo $root_child[$i]->node_name; }
Hi,
do something like this
$root_child = $root->child_nodes(); print_r($root_child);
to check how the child nodes array looks like.
Thomas
It looks like:
Array ( [0] => domtext Object ( [type] => 3 [name] => #text [content] => [0] => 3 [1] => 146778496 ) [1] => domelement Object ( [type] => 1 [tagname] => head [0] => 4 [1] => 146778560 ) [2] => domtext Object ( [type] => 3 [name] => #text [content] => [0] => 5 [1] => 146778752 ) [3] => domelement Object ( [type] => 1 [tagname] => pic [0] => 6 [1] => 146778816 ) [4] => domtext Object ( [type] => 3 [name] => #text [content] => [0] => 7 [1] => 146778944 ) [5] => domelement Object ( [type] => 1 [tagname] => text [0] => 8 [1] => 146779008 ) [6] => domtext Object ( [type] => 3 [name] => #text [content] => [0] => 9 [1] => 146779200 ) )
Something wrong?
I think the problem is that node_name is a function and not a member variable. Try
echo $root_child[$i]->node_name();
instead.
EDIT: If that doesn't work:
$currentChild = $root_child[$i]; echo $currentChild->node_name();
🙂 🙂 🙂 🙂 🙂 🙂 🙂 🙂 🙂 🙂 Thank you!!!! But how can I get content from this xml document?