import javax.swing.text.Element; //导入方法依赖的package包/类

/**

* Writes out all empty elements (all tags that have no

* corresponding end tag).

*

* @param elem an Element

* @exception IOException on any I/O error

* @exception BadLocationException if pos represents an invalid

* location within the document.

*/

protected void emptyTag(Element elem) throws BadLocationException, IOException {

if (!inContent && !inPre) {

indent();

}

AttributeSet attr = elem.getAttributes();

closeOutUnwantedEmbeddedTags(attr);

writeEmbeddedTags(attr);

if (attr != null && matchNameAttribute(attr, HTML.Tag.CONTENT)) {

inContent = true;

text(elem);

}

else if (attr != null && matchNameAttribute(attr, HTML.Tag.COMMENT)) {

comment(elem);

}

else {

boolean isBlock = isBlockTag(elem.getAttributes());

if (inContent && isBlock) {

writeLineSeparator();

indent();

}

Object nameTag = (attr != null) ? attr.getAttribute(StyleConstants.NameAttribute) : null;

Object endTag = (attr != null) ? attr.getAttribute(HTML.Attribute.ENDTAG) : null;

boolean outputEndTag = false;

// If an instance of an UNKNOWN Tag, or an instance of a

// tag that is only visible during editing

//

if (nameTag != null && endTag != null && (endTag instanceof String) && ((String) endTag).equals("true")) {

outputEndTag = true;

}

if (completeDoc && matchNameAttribute(attr, HTML.Tag.HEAD)) {

if (outputEndTag) {

// Write out any styles.

writeStyles(((HTMLDocument) getDocument()).getStyleSheet());

}

wroteHead = true;

}

write('

if (outputEndTag) {

write('/');

}

write(elem.getName());

writeAttributes(attr);

write('>');

if (attr != null && matchNameAttribute(attr, HTML.Tag.TITLE) && !outputEndTag) {

Document doc = elem.getDocument();

String title = (String) doc.getProperty(Document.TitleProperty);

write(title);

}

else if (!inContent || isBlock) {

writeLineSeparator();

if (isBlock && inContent) {

indent();

}

}

}

}

java getdocument_Java Element.getDocument方法代码示例相关推荐

  1. java kryo_Kryo框架使用方法代码示例

    Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...

  2. java readtimeout_Java HttpURLConnection.getReadTimeout方法代码示例

    import java.net.HttpURLConnection; //导入方法依赖的package包/类 /** * 得到响应对象 * * @param urlConnection * @retu ...

  3. java invalidate_Java Component.invalidate方法代码示例

    import java.awt.Component; //导入方法依赖的package包/类 /** Installs the component we will embed to display t ...

  4. java hasmoreelements_Java IOException.hasMoreElements方法代码示例

    import java.io.IOException; //导入方法依赖的package包/类 /** * fileName���� ���� package �������� ������ ���� ...

  5. java methode_Java Method.getTypeParameters方法代码示例

    import java.lang.reflect.Method; //导入方法依赖的package包/类 private void validateRuleMethod(MethodRuleDefin ...

  6. java locationuitool_Java JavaUI.getLibraryJavadocLocation方法代码示例

    import org.eclipse.jdt.ui.JavaUI; //导入方法依赖的package包/类 /** * Shows the UI for configuring a javadoc l ...

  7. java setmethod_Java Operation.setJavaMethod方法代码示例

    import com.sun.tools.internal.ws.processor.model.Operation; //导入方法依赖的package包/类 private void createJ ...

  8. java cancel_Java RunnableFuture.cancel方法代码示例

    import java.util.concurrent.RunnableFuture; //导入方法依赖的package包/类 @Test public void testSnapshotAsyncC ...

  9. replaceselection();java'_Java JTextComponent.replaceSelection方法代码示例

    import javax.swing.text.JTextComponent; //导入方法依赖的package包/类 public void actionPerformed(final Action ...

最新文章

  1. 天翼云认证--大纲介绍
  2. 360全景图three.js
  3. 实现JavaScript继承
  4. 10.4 使用instanceof操作符判断对象类型
  5. linux udp端口大数据包,Linux协议栈中UDP数据报从网卡到用户空间流程总结
  6. 51 NOD 1227 平均最小公倍数(杜教筛)
  7. Java如何将指定字符串转化为指定日期格式
  8. 微软随.NET 4.5发布新REST API框架
  9. 虽然苏伊士运河大堵塞了,但是全球“玩家”收获了真实的快乐
  10. 关于Python学习的一点说明
  11. 机器学习知识点整理(《机器学习》——周志华)
  12. (二十一) Sed编辑器高级部分
  13. 华为网络设备-访问控制列表配置实验
  14. 解决 Unit is masked
  15. java 调停者模式_[Java教程]《JAVA与模式》之调停者模式
  16. 黑马淘淘商城第十二天 购物车实现、订单确认页面展示
  17. 网页制作学习3----实现连缀功能
  18. STM32 高级定时TIM 死区时间计算--C语言实现
  19. 字符编码和字符集基础知识
  20. 小甲鱼课后作业_【第九讲勤思课后作业】二元一次方程组的解法巩固加油站

热门文章

  1. hotmail 收不到邮件的问题
  2. hotmail手机端_Hotmail下载_Hotmail官方app手机最新版安装 - 人人下载
  3. 聊聊vscode配置settings.json知其所以然(附大量配置)
  4. mysql 页分裂_Innodb页面分裂
  5. 微信小程序订阅消息推送(附带后台java代码)
  6. 货币的价值--钱的价值与投资
  7. 使用windows自带功能实现局域网两台电脑之间共享文件夹
  8. C. Cyclic Permutations
  9. 元旦假期小事-鱼刺卡喉咙
  10. 在mt4平台上炒外汇的数值能做假吗?