當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。