Java Code Examples for javax.swing.text.html.HTMLEditorKit#Parser
The following examples show how to use
javax.swing.text.html.HTMLEditorKit#Parser .
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: bug8005391.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 2
Source File: bug8005391.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 3
Source File: bug8005391.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 4
Source File: bug8005391.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 5
Source File: bug8005391.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 6
Source File: bug8005391.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 7
Source File: HTMLEditorKitWriterBug.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { String htmlDoc = "<pre><p> </pre>"; try { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName( "javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); } catch (Exception ex) { throw new RuntimeException("Test Failed " + ex); } }
Example 8
Source File: bug8005391.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 9
Source File: bug8005391.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 10
Source File: bug8005391.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 11
Source File: bug8005391.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 12
Source File: bug8005391.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 13
Source File: bug8005391.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 14
Source File: bug8005391.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int N = 10; for (int i = 0; i < N; i++) { HTMLEditorKit kit = new HTMLEditorKit(); Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0); parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true); htmlReader.flush(); CharArrayWriter writer = new CharArrayWriter(1000); kit.write(writer, doc, 0, doc.getLength()); writer.flush(); String result = writer.toString(); if (!result.contains("<tt><a")) { throw new RuntimeException("The <a> and <tt> tags are swapped"); } } }
Example 15
Source File: DodsURLExtractor.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public HTMLEditorKit.Parser getParser() { return super.getParser(); }