/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package com.xpn.xwiki.it.xhtml;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

/**
 * Used to overwrite the the default entity resolver and get the entities from the resources.
 * 
 * @version $Id$
 */
class ResourcesEntityResolver implements EntityResolver
{
    private static final String ENTITIES_ROOT = "/entities";

    /**
     * {@inheritDoc}
     * 
     * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
     */
    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
    {
        int index = systemId.lastIndexOf("/");

        String dtd = ENTITIES_ROOT + "/" + (index != -1 ? systemId.substring(index) : systemId);
        InputStream stream = ResourcesEntityResolver.class.getResourceAsStream(dtd);

        return new InputSource(new InputStreamReader(stream));
    }
}

@@ -1687,14 +1687,8 @@
 OT +
- %22/%22 +
  (in
@@ -1726,16 +1726,22 @@
 index) :
+ %22/%22 +
  systemI

Fix tests