http://www.perlmonks.org?node_id=1003971


in reply to From a folder, read all the XML files and add the end tag if not present.

It is a quick check and a quick fix with a text editor, and there are only 25 files.

Sometimes it's easier to just do it manually.

That said, if you have the xmllint command-line tool available (which is fairly standard, and packaged by almost every Linux distribution), then that should be able to tell you very quickly which files have errors:

xmllint --noout *.xml
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
  • Comment on Re: From a folder, read all the XML files and add the end tag if not present.
  • Download Code

Replies are listed 'Best First'.
Re^2: From a folder, read all the XML files and add the end tag if not present.
by Anonymous Monk on Nov 15, 2012 at 09:20 UTC

    Thanks tobyink, but there is more than 25 files (around 300 is there and cant do it manualy, I just mentioned 25 as a number.) Also I am working on windows, so I cannot use 'xmllint'. Pls can you suggest with a module or a program?

      Also I am working on windows, so I cannot use 'xmllint'

      Sure you can. Don't go looking to reinvent xmllint, go looking how to install xmllint