Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]DomDocument, dom document pytanie
--Jurand--
post
Post #1





Goście







Witam mam pewne pytanie .. w momencie gdy dodaje kolejne elementy do dokumentu xml ... powiedzmy

xml->append(xml->createElement('test'));

w koncowym efekcie gdy zapisze plik wszstkie elementy sa w jednej lini ! <element/><element/><element/> ...
czy ktos wie moze jak zrobic by document ladnie sie ukladal czytelnie w postaci
<element/>
<element/>
<element/>

dziekuje
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
wookieb
post
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




Na samym początku
  1. $xml->formatOutput = true;
Go to the top of the page
+Quote Post
--jurand--
post
Post #3





Goście







  1.  
  2. $this->dom = new DOMDocument('1.0', 'utf-8');
  3. $this->dom->preserveWhiteSpace = false;
  4. $this->dom->formatOutput = true;
  5. $this->dom->Load($this->name);
  6.  


uzywam takiego kodu na poczatku a output w pliku ciagle

<test/><test/><test/><test/><test/><test/><test/><test/><test/><test/><test/><test/></content>


Go to the top of the page
+Quote Post
--Jurand--
post
Post #4





Goście







hmmmm ...ogolnie za 2gim dodaniem powiodlo sie .. z tego wynika ... ze pierwsze wrzucenie danych do pustego roota jest niesformatowane dobrze ... jak dorzuca sie elementy to dopiero formatuje dobrze xmla ..
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 5.10.2025 - 16:08