Guest User

Untitled

a guest
Sep 14th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. PHP XML DOM: working with a subsection of an xml document
  2. <quizzes>
  3. <quiz>
  4. <date>Yesterday</date>
  5. <question>This is the day's question</question
  6. </quiz>
  7. <quiz>
  8. <date>Today</date>
  9. <question>This is the day's question</question
  10. </quiz>
  11. <quiz>
  12. <date>Tomorrow</date>
  13. <question>This is the day's question</question
  14. </quiz>
  15. </quizzes
  16.  
  17. $xmlDoc = new DOMDocument()
  18. $xmlDoc->load($aboveXMLFile)
  19.  
  20. $subSection = $xmlDoc->getElementsByTagName("quiz")->item(0)
  21. $dateofSubSection = $subSection->getElementsByTagName("date")->item(0)->nodeValue;
  22. echo $dateofSubSection
Add Comment
Please, Sign In to add comment