Multiple XML doc Count

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deanvd
    New Member
    • Jun 2010
    • 2

    Multiple XML doc Count

    Hi
    I found this pice of code work great
    but cant get it to look in a folder and do a count of a specific tag in all XML doc's in the specified directory

    any help would be appreciated

    Code:
    $xml= "file.xml";
    $xmlDoc = new DOMDocument();
    $xmlDoc->load($xml);
    $tag= $xmlDoc->getElementsByTagName("tag");
    $numOftag = $tag->length;
    echo $numOftag;
    thank you
    Last edited by Dormilich; Jun 23 '10, 08:41 PM. Reason: Please use [code] tags when posting code
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    When you set it to look to a folder are you using the correct URI's? Are you using \ instead of /, or are you not escaping the characters properly?

    Comment

    • deanvd
      New Member
      • Jun 2010
      • 2

      #3
      Originally posted by jkmyoung
      When you set it to look to a folder are you using the correct URI's? Are you using \ instead of /, or are you not escaping the characters properly?
      Hi
      the script works 100% like it is
      just dont know how to make it work so that it scans all the XML doc's in a directory

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        scanning a directory for files

        Comment

        Working...