Java Code Examples for javax.swing.text.html.parser.ParserDelegator#parse()
The following examples show how to use
javax.swing.text.html.parser.ParserDelegator#parse() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainPanel.java From java-swing-tips with MIT License | 6 votes |
@Override public void actionPerformed(ActionEvent e) { textArea.append(String.format("----%n%s%n", getValue(Action.NAME))); String id = field.getText().trim(); String text = editorPane.getText(); ParserDelegator delegator = new ParserDelegator(); try { delegator.parse(new StringReader(text), new HTMLEditorKit.ParserCallback() { @Override public void handleStartTag(HTML.Tag tag, MutableAttributeSet a, int pos) { Object attrId = a.getAttribute(HTML.Attribute.ID); textArea.append(String.format("%s@id=%s%n", tag, attrId)); if (id.equals(attrId)) { textArea.append(String.format("found: pos=%d%n", pos)); int endOffs = text.indexOf('>', pos); textArea.append(String.format("%s%n", text.substring(pos, endOffs + 1))); } } }, Boolean.TRUE); } catch (IOException ex) { ex.printStackTrace(); textArea.append(String.format("%s%n", ex.getMessage())); UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
Example 2
Source File: Html2String.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
public void parse() throws IOException { logger.debug("IN"); // put a capo toConvert = toConvert.replaceAll("<BR>", "|*|"); toConvert = toConvert.replaceAll("<BR/>", "|*|"); toConvert = toConvert.replaceAll("<br>", "|*|"); toConvert = toConvert.replaceAll("<br/>", "|*|"); StringReader stringReader = new StringReader(toConvert); buffer = new StringBuffer(); ParserDelegator delegator = new ParserDelegator(); // the third parameter is TRUE to ignore charset directive delegator.parse(stringReader, this, Boolean.FALSE); stringReader.close(); logger.debug("OUT"); }
Example 3
Source File: AnalizeWebParse.java From howsun-javaee-framework with Apache License 2.0 | 5 votes |
public List<String> parse(Reader file) throws Exception { if (file == null) { return null; } ParserDelegator pd = new ParserDelegator(); try { pd.parse(file, this, true); } catch (Exception e) { throw e; } return imgs; }
Example 4
Source File: bug7165725.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 5
Source File: bug7165725.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 6
Source File: bug7165725.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 7
Source File: bug7165725.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 8
Source File: bug7165725.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 9
Source File: bug7165725.java From hottub with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 10
Source File: bug7165725.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 11
Source File: bug7165725.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 12
Source File: bug7165725.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 13
Source File: bug7165725.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 14
Source File: bug7165725.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 15
Source File: bug7165725.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 16
Source File: bug7165725.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
static String getParsedContentOneLine(String path) throws Exception { File f = new File(path); FileReader fr = new FileReader(f); ParserDelegator pd = new ParserDelegator(); SBParserCallback sbcallback = new SBParserCallback(); pd.parse(fr, sbcallback, true); fr.close(); return sbcallback.getStringOneLine(); }
Example 17
Source File: Html2Text.java From ObjectLogger with Apache License 2.0 | 4 votes |
private void parse(String html) throws IOException { Reader reader = new StringReader(html); ParserDelegator parsers = new ParserDelegator(); parsers.parse(reader, this, Boolean.TRUE); }
Example 18
Source File: RefactoringPanel.java From netbeans with Apache License 2.0 | 4 votes |
public void parse(Reader in) throws IOException { s = new StringBuffer(); ParserDelegator delegator = new ParserDelegator(); // the third parameter is TRUE to ignore charset directive delegator.parse(in, this, Boolean.TRUE); }
Example 19
Source File: ButtonsHTMLParser.java From netbeans with Apache License 2.0 | 4 votes |
void parse() throws IOException { ParserDelegator pd = new ParserDelegator(); formParser = new FormHTMLParser(); Reader r = new StringReader(definition); pd.parse(r, formParser, true); }