Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Jak ze stringa zrobić DOMElement[nieaktualne]
deirathe
post
Post #1





Grupa: Zarejestrowani
Postów: 426
Pomógł: 32
Dołączył: 24.05.2007

Ostrzeżenie: (0%)
-----


Mam np. taki string:
  1. <znacznik atrybut="wartosc" atrybut2="wartosc2" />

Jak z tego stworzyć DOMElement??

Ten post edytował deirathe 1.07.2007, 15:44:06


--------------------
Kawałek mojego blogu
Everything should be as simple as possible but not simpler.
A Einstein
Go to the top of the page
+Quote Post
flv
post
Post #2





Grupa: Zarejestrowani
Postów: 130
Pomógł: 1
Dołączył: 29.06.2007

Ostrzeżenie: (0%)
-----


Kod
$dom = new DOMDocument('1.0', 'UTF-8');
$element = $dom->create_element('znacznik');
$element->set_attribute('atrybut','wartosc');
$element->set_attribute('atrybut2','wartosc2');
$dom->appendChild($element);
echo $dom->saveXML();


Ten post edytował flv 1.07.2007, 11:46:55
Go to the top of the page
+Quote Post
dr_bonzo
post
Post #3





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

Ostrzeżenie: (0%)
-----


http://www.php.net/manual/en/function.dom-...ent-loadxml.php


--------------------
Nie lubię jednorożców.
Go to the top of the page
+Quote Post
deirathe
post
Post #4





Grupa: Zarejestrowani
Postów: 426
Pomógł: 32
Dołączył: 24.05.2007

Ostrzeżenie: (0%)
-----


Tak to też umiem, czyt. ze stringa bezpośrednio.
P.S. @dr_bonzo po co mi load xml, jak ja potrzebuje tylko DOMElement

Ten post edytował deirathe 1.07.2007, 13:07:27


--------------------
Kawałek mojego blogu
Everything should be as simple as possible but not simpler.
A Einstein
Go to the top of the page
+Quote Post
abc667
post
Post #5





Grupa: Zarejestrowani
Postów: 229
Pomógł: 0
Dołączył: 29.05.2007

Ostrzeżenie: (0%)
-----


no to wyrażenia regularne
Go to the top of the page
+Quote Post
deirathe
post
Post #6





Grupa: Zarejestrowani
Postów: 426
Pomógł: 32
Dołączył: 24.05.2007

Ostrzeżenie: (0%)
-----


najwyraźniej na to wygląda :/... Dobra dzięki wszystkim koniec topica


--------------------
Kawałek mojego blogu
Everything should be as simple as possible but not simpler.
A Einstein
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 16:13