Project

General

Profile

« Previous | Next » 

Revision 3740

ignore commented out DOCTYPE declarations (don't force validation on them)

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
2021 2021
        StringBuffer cbuff = new StringBuffer();
2022 2022
        java.util.Stack st = new java.util.Stack();
2023 2023
        boolean validate = false;
2024
        boolean commented = false;
2024 2025
        int c;
2025 2026
        int inx;
2026 2027
        
......
2028 2029
        while ((st.empty() || st.size() < 4) && ((c = xmlreader.read()) != -1)) {
2029 2030
            cbuff.append((char) c);
2030 2031
            
2032
            if ((inx = cbuff.toString().indexOf("<!--")) != -1) {
2033
            	commented = true;
2034
            }
2035
            
2031 2036
            // "<!DOCTYPE" keyword is found; put it in the stack
2032 2037
            if ((inx = cbuff.toString().indexOf("<!DOCTYPE")) != -1) {
2033 2038
                cbuff = new StringBuffer();
......
2062 2067
            && (((String) st.peek()).equals("PUBLIC") | ((String) st
2063 2068
                    .pop()).equals("SYSTEM"))
2064 2069
                    && ((String) st.pop()).equals("<!DOCTYPE")) {
2065
                validate = true;
2070
                validate = true && !commented;
2066 2071
            }
2067 2072
        }
2068 2073
        

Also available in: Unified diff