Results 1 to 2 of 2

Thread: Xmlreader

  1. #1
    Join Date
    Apr 2014

    Unhappy Xmlreader

    I have a huge XML file, and I have to usr XMLREADER for matters of speed.

    My XML file can look sometinhg like this:

    I nedd to output only the names of my COSTUMERS

    I Have tryed something like this:
    PHP Code:
    $xmlReader = new XMLReader();
    $xmlReader->read()) {
    $xmlReader->nodeType == XMLReader::ELEMENT && $xmlReader->localName == 'costumers') {
            while (
    $xmlReader->read()) {
    $xmlReader->nodeType == XMLReader::ELEMENT) {
    $xmlReader->localName == 'name') {
    But outputs all the names of costumers and supliers.
    How can I contain the ouput for only the COSTUMERS tag?

  2. #2
    Join Date
    Apr 2014
    I've never read an XML file before using php so forgive me if this is wrong. But, isn't your second while loop just iterating over ALL the xml file and hence returning everything that is a 'name'. Surely you need put something in to only parse the 'costumers' tag?


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles