Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

PHP/XML: Difference between revisions

From ZeroWiki
imported>beonit
No edit summary
 
imported>beonit
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
PHP에서 XML 사용법
PHP에서 XML 사용법
== DOM ==
== DOM ==
* [http://devzone.zend.com/node/view/id/1713#Heading7 원문]
* [http://devzone.zend.com/node/view/id/1713#Heading7 원문] --> php로 xml다루는 방법을 아주 쉽게 설명했네요
  $dom = new DomDocument();
  $dom = new DomDocument();
  $dom->load("articles.xml");
  $dom->load("articles.xml");
  $dom->load("file:///articles.xml");
  $dom->load("file:///articles.xml");
  // If you want to output the XML document to the browser or as standard output, use:
  // If you want to output the XML document to the browser or as standard output, use:
  print $dom->saveXML();
  print $dom->saveXML();
  // If you want to save it to a file, use:
  // If you want to save it to a file, use:
  print $dom->save("newfile.xml");
  print $dom->save("newfile.xml");
  //
  //
  $titles = $dom->getElementsByTagName("title");
  $titles = $dom->getElementsByTagName("title");
Line 14: Line 19:
     print $node->textContent . " ";
     print $node->textContent . " ";
  }
  }
----
[[PHP]], [[XML]]



Latest revision as of 01:16, 19 September 2008

PHP에서 XML 사용법

DOM

  • 원문 --> php로 xml다루는 방법을 아주 쉽게 설명했네요
$dom = new DomDocument();

$dom->load("articles.xml");

$dom->load("file:///articles.xml");

// If you want to output the XML document to the browser or as standard output, use:
print $dom->saveXML();

// If you want to save it to a file, use:
print $dom->save("newfile.xml");

//
$titles = $dom->getElementsByTagName("title");
foreach($titles as $node) {
   print $node->textContent . " ";
}

PHP, XML