Code example for XMLReader

Methods: setContentHandlersetErrorHandlersetProperty

    // Next, get an entity resolver that uses the given catalog path, and attach it to the reader. 
    XMLCatalogResolver resolver = Resolvers.newXMLCatalogResolver(catalogPath);
    try { 
      reader.setProperty("", resolver);
    catch (SAXNotRecognizedException e) {
      throw new DeveloperError("Property cannot be assigned or retrieved on XMLReader.", e);
    catch (SAXNotSupportedException e) {
      throw new DeveloperError("Requested value cannot be set to given property on XMLReader.", e);
    // Finally, attach the given content handler and a basic error handler, and return. 
    reader.setErrorHandler(new SimpleSAXErrorHandler(logger));
    return reader;
   * Renders a given element name and set of attributes as a start tag, including a namespace declaration, if requested.