下面列出了javax.swing.text.html.HTMLDocument#getDefaultRootElement ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
void checkComposedTextRun() {
HTMLDocument d = (HTMLDocument) ep.getDocument();
ElementIterator it = new ElementIterator(d.getDefaultRootElement());
while (true) {
Element e = it.next();
if (e == null) {
throw new RuntimeException("no composed text found");
}
AttributeSet a = e.getAttributes();
if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
}
if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
}
return;
}
}
}
public static Element loadElement(String txt){
//HTMLDocument doc= FHtml.loadHtmlBody(txt);
HTMLDocument doc= FSwingHtml.loadHtml(txt);
Element e=doc.getDefaultRootElement();
if (e==null){
System.out.print("error load html");
return null;
}
return e.getElement(1);
}