private Map<ComponentId,Element> createPages(List<NamedReader> pageReaders,boolean validateReaderNames) {
        Map<ComponentId,Element> pageElementsByPageId=new LinkedHashMap<>();
        for (NamedReader reader : pageReaders) {
            Element pageElement= XML.getDocument(reader).getDocumentElement();
            if ( ! pageElement.getNodeName().equals("page")) {
                logger.info("Ignoring '" + reader.getName() +
                         "': Expected XML root element 'page' but was '" + pageElement.getNodeName() + "'");
                continue;
            }
            String idString=pageElement.getAttribute("id");

            if (idString==null || idString.isEmpty())
                throw new IllegalArgumentException("Page template '" + reader.getName() + "' has no 'id' attribute in the root element");
            ComponentId id=new ComponentId(idString);
            if (validateReaderNames)
                validateFileName(reader.getName(),id,"page template");
            registry.register(new PageTemplate(id));
            pageElementsByPageId.put(id,pageElement);
        }
        return pageElementsByPageId;
    }
Reads all page template xml files in a given list of readers. This is called from the Vespa configuration model.

@param validateReaderNames should be set to true if the readers were created by files, not otherwise
@throws RuntimeException if <code>directory</code> is not a readable directory, or if there is some error in the XML
container-search/src/main/java/com/yahoo/search/pagetemplates/config/PageTemplateXMLReader.java