protected PageDefinition parse(String path, URL url, Object extra) throws Exception { final Locator locator = extra != null ? (Locator) extra : getLocator(_wapp, path); return new Parser(_wapp, locator).parse(url, path); } }
parse(pgdef, pi);
} else if (o instanceof ProcessingInstruction) { breakLine = false; parse(pgdef, (ProcessingInstruction) o); } else if (o instanceof Comment) { breakLine = false;
/** Parses from the specified reader. * * @param extension the default extension if doc (of reader) doesn't specify * an language. Ignored if null. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. */ public PageDefinition parse(Reader reader, String extension) throws Exception { //if (log.isDebugEnabled()) log.debug("Parsing "+reader); return parse(TreeBuilderFactory.makeBuilder(extension).parse(reader), extension); }
/** Returns the page definition of the specified raw content in DOM; * never null. * * @param locator the locator used to locate taglib and other resources. * If null, wapp is assumed ({@link WebApp} is also assumed). * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @exception UiException if failed to parse */ public static final PageDefinition getPageDefinitionDirectly(WebApp wapp, Locator locator, Document doc, String extension) { try { return new Parser(wapp, locator).parse(doc, extension); } catch (Exception ex) { throw UiException.Aide.wrap(ex); } }
protected PageDefinition parse(String path, File file, Object extra) throws Exception { final Locator locator = extra != null ? (Locator) extra : getLocator(_wapp, path); Parser parser = new Parser(_wapp, locator); // Bug ZK-1132 if (file.exists()) { return parser.parse(file, path); } else { InputStream stream = parser.getLocator().getResourceAsStream(path); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(stream)); PageDefinition pgdef = parser.parse(reader, Servlets.getExtension(path)); pgdef.setRequestPath(path); return pgdef; } finally { if (reader != null) reader.close(); } } }
/** Returns the page definition of the raw content from the specified * reader; never null. * * @param locator the locator used to locate taglib and other resources. * If null, wapp is assumed ({@link WebApp} is also assumed). * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @exception UiException if failed to parse */ public static final PageDefinition getPageDefinitionDirectly(WebApp wapp, Locator locator, Reader reader, String extension) throws IOException { try { return new Parser(wapp, locator).parse(reader, extension); } catch (IOException ex) { throw ex; } catch (Exception ex) { throw UiException.Aide.wrap(ex); } }
/** Parses the specified file. * * @param path the request path. * It is used as {@link org.zkoss.zk.ui.Page#getRequestPath}, or null * if not available. */ public PageDefinition parse(File file, String path) throws Exception { //if (log.isDebugEnabled()) log.debug("Parsing "+file); String extension = Servlets.getExtension(file.getName()); final PageDefinition pgdef = parse(TreeBuilderFactory.makeBuilder(extension).parse(file), extension); pgdef.setRequestPath(path); return pgdef; }
/** Parses the specified URL. * * @param path the request path. * It is used as {@link org.zkoss.zk.ui.Page#getRequestPath}, or null * if not available. */ public PageDefinition parse(URL url, String path) throws Exception { //if (log.isDebugEnabled()) log.debug("Parsing "+url); String extension = Servlets.getExtension(url.toExternalForm()); final PageDefinition pgdef = parse(TreeBuilderFactory.makeBuilder(extension).parse(url), extension); pgdef.setRequestPath(path); return pgdef; }