当前位置: 首页>>代码示例>>Java>>正文


Java DocumentType.getNotations方法代码示例

本文整理汇总了Java中org.w3c.dom.DocumentType.getNotations方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentType.getNotations方法的具体用法?Java DocumentType.getNotations怎么用?Java DocumentType.getNotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.w3c.dom.DocumentType的用法示例。


在下文中一共展示了DocumentType.getNotations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doctypeDecl

import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:DOMResultBuilder.java

示例2: testGetNotations

import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
@Test
public void testGetNotations() throws Exception {
    DocumentType documentType = createDOM("DocumentType03.xml").getDoctype();
    NamedNodeMap nm = documentType.getNotations();
    assertEquals(nm.getLength(), 2); // should return 2 because the notation
                                     // name is repeated and
                                     // it considers only the first
                                     // occurence
    assertEquals(nm.item(0).getNodeName(), "gs");
    assertEquals(nm.item(1).getNodeName(), "name");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DocumentTypeTest.java

示例3: evaluate

import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
@Override
public Object evaluate(Node context, int pos, int len)
{
  int arity = args.size();
  List<Object> values = new ArrayList<Object>(arity);
  for (int i = 0; i < arity; i++)
    {
      Expr arg = args.get(i);
      values.add(arg.evaluate(context, pos, len));
    }
  String name = _string(context, values.get(0));
  DocumentType doctype = context.getOwnerDocument().getDoctype();
  if (doctype != null)
    {
      NamedNodeMap notations = doctype.getNotations();
      Notation notation = (Notation) notations.getNamedItem(name);
      if (notation != null)
        {
          String systemId = notation.getSystemId();
          // XXX absolutize?
          if (systemId != null)
            {
              return systemId;
            }
        }
    }
  return "";
}
 
开发者ID:vilie,项目名称:javify,代码行数:29,代码来源:UnparsedEntityUriFunction.java


注:本文中的org.w3c.dom.DocumentType.getNotations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。