anudinaorg / xml-dir-listing

Automatically exported from code.google.com/p/xml-dir-listing
Apache License 2.0
0 stars 0 forks source link

FATAL error when generating XML file #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. sh ./xml-dir-listing -o qq.xml "./"

What is the expected output? What do you see instead?

Generating listing for /Users/phil/xml-dir-listing.0.2/bin/.
INFO - Generating listing for /Users/phil/xml-dir-listing.0.2/bin/.
Fatal error in generating document: java.lang.IllegalStateException: 
Attempt to end document in serializer when elements are unclosed
FATAL - Fatal error in generating document: 
java.lang.IllegalStateException: Attempt to end document in serializer when 
elements are unclosed

What version of the product are you using? On what operating system?

0.2

Mac OSX 10.5.7

Please provide any additional information below.

Original issue reported on code.google.com by philcolb...@gmail.com on 18 Jul 2009 at 6:21

GoogleCodeExporter commented 8 years ago
I am having this same issue. What is the solution? thanks.

Original comment by mcundiff...@gmail.com on 6 Mar 2010 at 5:21

GoogleCodeExporter commented 8 years ago
Hi there, 

I believe this is down to Saxon being picked up in the classpath. I have bundled
Xerces into the trunk and updated the launch script. Please can you try this 
out and
see if it works?

svn checkout http://xml-dir-listing.googlecode.com/svn/trunk/ 
xml-dir-listing-read-only
cd xml-dir-listing-read-only
ant test-cli-unix

Original comment by monsieur...@gmail.com on 8 Mar 2010 at 7:45

GoogleCodeExporter commented 8 years ago
The latest release hopefully fixes this issue by updating the classpath in the 
launch
script.

http://xml-dir-listing.googlecode.com/files/xml-dir-listing.0.2.1.zip

Thanks mcundiff1 for the help!

Original comment by monsieur...@gmail.com on 9 Mar 2010 at 5:21

GoogleCodeExporter commented 8 years ago
I have this BASH script that does a reasonable job, and can be easily 
customised.

However I'm sure xml-dir-listing is faster and better.

I use 

scriptname <dir> | xmllint --format - | less

For dir, you can use . .. ./ ../ or / as well.

#!/bin/bash

# WARNING: To break this, you need to enter a lot of ctrl-c's

# heavy recursion so allow a bigger stack
ulimit -s 32768

# run with low priority so you can do other stuff while it works
renice -n +19 -p $$

function doDir {
  # directory name may contain illegal XML characters so we won't use attributes
  #echo "<dir name=\"${1}\">"
  echo "<dir>"
  echo "<dirname><![CDATA[${1}]]></dirname>"
  # get all files and directories
  ls -Ab1 "$1/" | while read file; do
    # recursively process directories but not sym-links
    if [ -d "${1}/${file}" ] && [ ! -h "${1}/${file}" ]; then
      # don't do . and .. either
      if [ "$file" != "." ] && [ "$file" != ".." ]; then
        doDir "${1}/${file}"
      fi
    else
      # output the file
      echo "<file><![CDATA[$file]]></file>"
    fi
  done
  echo "</dir>"
}

# normalise initial directories so they all work
DIR=$1
if [ "."   == "$DIR" ]; then DIR="$(pwd)"   ; fi
if [ ".."  == "$DIR" ]; then DIR=".."       ; fi
if [ "../" == "$DIR" ]; then DIR=".."       ; fi
if [ "./"  == "$DIR" ]; then DIR="$(pwd)"   ; fi
if [ "/"   == "$DIR" ]; then DIR=""     ; fi

doDir $DIR

Original comment by philcolb...@gmail.com on 11 Mar 2010 at 8:56