Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> xml dodawanie atrybutu
MatXpl
post 3.03.2013, 11:11:13
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 1.06.2010

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


  1. $xml = simplexml_load_file("aaa.xml");
  2. foreach ($xml as $x);
  3. {
  4. $x->$child= addChild("aaa");
  5. foreach ($xml->body->children() as $child);
  6. {
  7. $xml->$child->addAttribute("name",name);
  8. $xml->$child->addAttribute("id",id);
  9. $xml->$child->addAttribute("data",data);
  10. }
  11. }


jak to zrobić?

Ten post edytował MatXpl 3.03.2013, 11:11:33
Go to the top of the page
+Quote Post
sazian
post 3.03.2013, 12:06:27
Post #2





Grupa: Zarejestrowani
Postów: 1 045
Pomógł: 141
Dołączył: 19.09.2006
Skąd: B-tów

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


jak co zrobić ?
i co to za potworki
$x->$child
co to $child ?

$xml->$child->addAttribute("name",name);
dlaczego $xml->$child i co niby miałby by zrobić
i gdzie definiujesz stałą name ?
Go to the top of the page
+Quote Post
MatXpl
post 3.03.2013, 13:16:30
Post #3





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 1.06.2010

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


name itp mam zdefiniowane chodzi o to żeby otworzyć plik, stworzyć w nim child i dodać do niego atrybuty
Go to the top of the page
+Quote Post
_Borys_
post 3.03.2013, 15:36:18
Post #4





Grupa: Zarejestrowani
Postów: 587
Pomógł: 190
Dołączył: 5.02.2011
Skąd: 64-800

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


Po co te pętle
Parsing XML in PHP Using SimpleXML
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 Wersja Lo-Fi Aktualny czas: 14.08.2025 - 09:45