// Path: core/src/main/java/edu/upenn/library/xmlaminar/Element.java
// public class Element {
// 
//     public final String uri;
//     public final String prefix;
//     public final String localName;
//     public final String qName;
//     public static final Attributes EMPTY_ATTS = new UnmodifiableAttributes();
// 
//     public Element(String uri, String prefix, String localName) {
//         this.uri = uri.intern();
//         this.prefix = prefix.intern();
//         this.localName = localName.intern();
//         if (prefix.equals("")) {
//             qName = this.localName;
//         } else {
//             qName = (prefix + ":" + localName).intern();
//         }
//     }
// 
//     public Element(String localName) {
//         uri = "";
//         prefix = "";
//         qName = localName.intern();
//         this.localName = localName = qName;
//     }
// 
//     public void start(ContentHandler ch) throws SAXException {
//         start(ch, EMPTY_ATTS);
//     }
// 
//     public void start(ContentHandler ch, Attributes atts) throws SAXException {
//         ch.startElement(uri, localName, qName, atts);
//     }
// 
//     public void end(ContentHandler ch) throws SAXException {
//         ch.endElement(uri, localName, qName);
//     }
// 
//     public static void logXML(ContentHandler ch, Element element, String message) throws SAXException {
//         char[] messageChars = message.toCharArray();
//         element.start(ch);
//         ch.characters(messageChars, 0, messageChars.length);
//         element.end(ch);
//     }
// 
//     private static class UnmodifiableAttributes extends AttributesImpl {
// 
//         @Override
//         public void addAttribute(String uri, String localName, String qName, String type, String value) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setAttribute(int index, String uri, String localName, String qName, String type, String value) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setAttributes(Attributes atts) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setLocalName(int index, String localName) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setQName(int index, String qName) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setType(int index, String type) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setURI(int index, String uri) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setValue(int index, String value) {
//             throw new UnsupportedOperationException();
//         }
// 
//     }
// 
// }


import edu.upenn.library.xmlaminar.Element;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Stack;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;
                throw new RuntimeException("unreadable directory: "+f);
            }
        }
        if (writeOutput) {
            endFile(type, canonFile, isSymlink, !preWriteOutput);
            if (!preWriteOutput) {
                writeOutput = false;
            }
        }
    }

    private static File getCanonFile(File file) throws IOException {
        if (file == null) {
            throw new NullPointerException("File must not be null");
        }
        File canon;
        if (file.getParent() == null) {
            canon = file;
        } else {
            File canonDir = file.getParentFile().getCanonicalFile();
            canon = new File(canonDir, file.getName());
        }
        return canon;
    }

    private static boolean isSymlink(File canonFile) throws IOException {
        return !canonFile.getCanonicalFile().equals(canonFile.getAbsoluteFile());
    }

    private static boolean isCircularSymlink(File canonFile, Stack<String> symlinkPathStack, boolean isSymlink) throws IOException {
// Path: core/src/main/java/edu/upenn/library/xmlaminar/Element.java
// public class Element {
// 
//     public final String uri;
//     public final String prefix;
//     public final String localName;
//     public final String qName;
//     public static final Attributes EMPTY_ATTS = new UnmodifiableAttributes();
// 
//     public Element(String uri, String prefix, String localName) {
//         this.uri = uri.intern();
//         this.prefix = prefix.intern();
//         this.localName = localName.intern();
//         if (prefix.equals("")) {
//             qName = this.localName;
//         } else {
//             qName = (prefix + ":" + localName).intern();
//         }
//     }
// 
//     public Element(String localName) {
//         uri = "";
//         prefix = "";
//         qName = localName.intern();
//         this.localName = localName = qName;
//     }
// 
//     public void start(ContentHandler ch) throws SAXException {
//         start(ch, EMPTY_ATTS);
//     }
// 
//     public void start(ContentHandler ch, Attributes atts) throws SAXException {
//         ch.startElement(uri, localName, qName, atts);
//     }
// 
//     public void end(ContentHandler ch) throws SAXException {
//         ch.endElement(uri, localName, qName);
//     }
// 
//     public static void logXML(ContentHandler ch, Element element, String message) throws SAXException {
//         char[] messageChars = message.toCharArray();
//         element.start(ch);
//         ch.characters(messageChars, 0, messageChars.length);
//         element.end(ch);
//     }
// 
//     private static class UnmodifiableAttributes extends AttributesImpl {
// 
//         @Override
//         public void addAttribute(String uri, String localName, String qName, String type, String value) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setAttribute(int index, String uri, String localName, String qName, String type, String value) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setAttributes(Attributes atts) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setLocalName(int index, String localName) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setQName(int index, String qName) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setType(int index, String type) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setURI(int index, String uri) {
//             throw new UnsupportedOperationException();
//         }
// 
//         @Override
//         public void setValue(int index, String value) {
//             throw new UnsupportedOperationException();
//         }
// 
//     }
// 
// }


// Path: core/src/main/java/edu/upenn/library/xmlaminar/fsxml/FilesystemXMLReader.java
import edu.upenn.library.xmlaminar.Element;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Stack;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;

                throw new RuntimeException("unreadable directory: "+f);
            }
        }
        if (writeOutput) {
            endFile(type, canonFile, isSymlink, !preWriteOutput);
            if (!preWriteOutput) {
                writeOutput = false;
            }
        }
    }

    private static File getCanonFile(File file) throws IOException {
        if (file == null) {
            throw new NullPointerException("File must not be null");
        }
        File canon;
        if (file.getParent() == null) {
            canon = file;
        } else {
            File canonDir = file.getParentFile().getCanonicalFile();
            canon = new File(canonDir, file.getName());
        }
        return canon;
    }

    private static boolean isSymlink(File canonFile) throws IOException {
        return !canonFile.getCanonicalFile().equals(canonFile.getAbsoluteFile());
    }

    private static boolean isCircularSymlink(File canonFile, Stack<String> symlinkPathStack, boolean isSymlink) throws IOException {
        if (!isSymlink) {