private void addDTDEntities()

in doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java [589:621]


    private void addDTDEntities(XmlPullParser parser, String text) throws XmlPullParserException {
        int entitiesCount = StringUtils.countMatches(text, ENTITY_START);
        if (entitiesCount > 0) {
            final String txt = StringUtils.replace(text, ENTITY_START, "\n" + ENTITY_START);
            try (BufferedReader reader = new BufferedReader(new StringReader(txt))) {
                String line;
                String tmpLine = "";
                Matcher matcher;
                while ((line = reader.readLine()) != null) {
                    tmpLine += "\n" + line;
                    matcher = PATTERN_ENTITY_1.matcher(tmpLine);
                    if (matcher.find() && matcher.groupCount() == 7) {
                        String entityName = matcher.group(2);
                        String entityValue = matcher.group(5);

                        addEntity(parser, entityName, entityValue);
                        tmpLine = "";
                    } else {
                        matcher = PATTERN_ENTITY_2.matcher(tmpLine);
                        if (matcher.find() && matcher.groupCount() == 8) {
                            String entityName = matcher.group(2);
                            String entityValue = matcher.group(5);

                            addEntity(parser, entityName, entityValue);
                            tmpLine = "";
                        }
                    }
                }
            } catch (IOException e) {
                // nop
            }
        }
    }