title: How to parse xml file in batch (CMD)
body: <p>Can you help me to list browsers from this file
  <a href="http://techpatterns.com/downloads/firefox/useragentswitcher.xml" rel="nofollow">http://techpatterns.com/downloads/firefox/useragentswitcher.xml</a>
  into txt file, separated by %tab% delimiter?</p>
  
  <p>3 or 4 columns should be there: </p>
  
  <p>1) folder description from example data:  <code>&lt;folder description="Browsers - Windows"&gt;</code></p>
  
  <p>2) browser type from example data: <code>&lt;folder description="Legacy Browsers"&gt;</code></p>
  
  <p>3) user agent from example data:<code>&lt;useragent description="Avant Browser 1.2" useragent="Avant Browser/1.2.789rel1 (http://www.avantbrowser.com)" app</code></p>
  
  <p>Here I see 1st problem, because some browsers arn't in folder <code>&lt;folder description="Legacy Browsers"&gt;"</code> but under <code>&lt;separator/&gt;</code></p>
  
  <p>So the 1st column should define system, second is type and third is browser.</p>
  
  <p>The next problem is that the Devises folder contains one more folder.</p>
  
  <pre><code>@echo off 
  Setlocal EnableDelayedExpansion
  SET file=useragentswitcher.xml
  SET delim="
  
  FOR /F "tokens=* skip=1" %%F IN (!file!) DO (
    REM echo %%F
    call :parse "%%F" &gt; temp.txt
    FOR /F "tokens=1,2,3,4,5,6,7 skip=1 delims=" %%A IN (temp.txt) DO (
      IF "%%A"=="folder" (
        SET /A level=!level!+1
        echo Level:!level!
        ) ELSE IF "%%A"=="/folder" (
            SET /A level=!level!-1
            echo Level:!level!
          )
  
     echo A:%%A
    )
    pause
  )
  
  exit /b
  
  :parse
  Setlocal EnableDelayedExpansion
    SET A=%*
    REM REMOVE double paranthesis and &lt;&gt; 
    SET A=!A:~2,-2!
    REM replace double qoutes
    SET A=!A:"=µ!
    FOR /F "tokens=1,2 delims=µ=" %%A IN ("!A!") DO (
      SET first=%%A
      SET second=%%B
      echo !first!
      FOR /F "tokens=1,2 delims= " %%A IN ("!first!") DO (
        echo %%A
        echo %%B
      )
      echo !second!
    )
  endlocal
  exit /b
  </code></pre>
  
  <p>This parses one tag of the line and I am going to work with it now.</p>