org.w3c.dom.Notation类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中org.w3c.dom.Notation类的一些代码示例,展示了Notation类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notation类的具体详情如下:
包路径:org.w3c.dom.Notation
类名称:Notation

Notation介绍

[英]This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (see section 4.7 of the XML 1.0 specification [XML 1.0]), or is used for formal declaration of processing instruction targets (see section 2.6 of the XML 1.0 specification [XML 1.0]). The nodeName attribute inherited from Node is set to the declared name of the notation.

The DOM Core does not support editing Notation nodes; they are therefore readonly.

A Notation node does not have any parent.

See also the Document Object Model (DOM) Level 3 Core Specification.
[中]此接口表示DTD中声明的符号。一种表示法可以通过名称声明未解析实体的格式(参见XML1.0规范的section 4.7[XML 1.0]),也可以用于处理指令目标的正式声明(参见XML1.0规范的{$2$}[XML 1.0])。继承自NodenodeName属性被设置为符号的声明名称。
DOM核心不支持编辑Notation节点;因此,它们是只读的。
Notation节点没有任何父节点。
另见{4$}。

代码示例

代码示例来源:origin: net.open-esb.core/manage

/**
 * Present a Notation as a String.
 * @param notation a Notation Node.
 * @return the String representation of the Notation.
 */
private String notationToString(Notation notation)
{
  StringBuffer sb = new StringBuffer();
  sb.append("<!NOTATION " + notation.getNodeName());
  String pubID = notation.getPublicId();
  String sysID = notation.getSystemId();
  if ( pubID != null )
  {
    sb.append(" PUBLIC " + pubID);
    if ( sysID != null )
    {
      sb.append(" " + sysID);
    }
  }
  else if ( sysID != null )
  {
    sb.append(" SYSTEM " + sysID);
  }
  sb.append("\n");
  return sb.toString();
}

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
 Document doc;
 DocumentType docType;
 NamedNodeMap notaionsMap;
 Notation notation;
 Notation notation2;
 int notationPosition;
 doc = (Document) load("hc_staff", false);
 docType = doc.getDoctype();
 notaionsMap = docType.getNotations();
 notation = (Notation) notaionsMap.getNamedItem("notation1");
 notation2 = (Notation) notaionsMap.getNamedItem("notation1");
 notationPosition = (int) notation.compareDocumentPosition(notation2);
 assertEquals("nodecomparedocumentposition24", 0, notationPosition);
 }
/**

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

notation = (Notation) notationsMap.getNamedItem("notation2");
notationImported = (Notation) newDoc.importNode(notation, true);
baseURI = notationImported.getBaseURI();
assertNull("nodegetbaseuri14", baseURI);

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

notationImpNew1 = (Notation) docImp.importNode(notation1, false);
notationImpNew2 = (Notation) docImp.importNode(notation2, true);
publicId1 = notation1.getPublicId();
publicId1Imp = notation1.getPublicId();
publicId1NewImp = notation1.getPublicId();
systemId1Imp = notation1.getSystemId();
systemId1NewImp = notation1.getSystemId();
publicId2Imp = notation2.getPublicId();
publicId2NewImp = notation2.getPublicId();
systemId2 = notation2.getSystemId();
systemId2Imp = notation2.getSystemId();
systemId2NewImp = notation2.getSystemId();
assertEquals("documentimportnode22_N1PID", publicId1, publicId1Imp);
assertEquals("documentimportnode22_N1NPID", publicId1, publicId1NewImp);

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

notation = (Notation) notationList.getNamedItem("notation1");
   aNode = (Notation) doc.importNode(notation, false);
   ownerDocument = aNode.getOwnerDocument();
   docType = ownerDocument.getDoctype();
   system = docType.getSystemId();
   assertURIEquals("systemId", null, null, null, "staffNS.dtd", null, null, null, null, system);
publicVal = aNode.getPublicId();
   assertEquals("publicId", "notation1File", publicVal);
   system = aNode.getSystemId();
   assertNull("notationSystemId", system);

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
 Document doc;
 DocumentType docType;
 NamedNodeMap notations;
 Notation notationNode;
 String publicId;
 doc = (Document) load("staff", false);
 docType = doc.getDoctype();
 assertNotNull("docTypeNotNull", docType);
 notations = docType.getNotations();
 assertNotNull("notationsNotNull", notations);
 notationNode = (Notation) notations.getNamedItem("notation1");
 publicId = notationNode.getPublicId();
 assertEquals("publicId", "notation1File", publicId);
 }
/**

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
 Document doc;
 DocumentType docType;
 NamedNodeMap notations;
 Notation notationNode;
 String systemId;
 doc = (Document) load("staff", false);
 docType = doc.getDoctype();
 assertNotNull("docTypeNotNull", docType);
 notations = docType.getNotations();
 assertNotNull("notationsNotNull", notations);
 notationNode = (Notation) notations.getNamedItem("notation1");
 systemId = notationNode.getSystemId();
 assertNull("systemId", systemId);
 }
/**

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
 Document doc;
 DocumentType docType;
 NamedNodeMap notations;
 Notation notationNode;
 String notationName;
 doc = (Document) load("staff", false);
 docType = doc.getDoctype();
 assertNotNull("docTypeNotNull", docType);
 notations = docType.getNotations();
 assertNotNull("notationsNotNull", notations);
 notationNode = (Notation) notations.getNamedItem("notation1");
 notationName = notationNode.getNodeName();
 assertEquals("notationGetNotationNameAssert", "notation1", notationName);
 }
/**

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

NotationImpl newnotation =
(NotationImpl)createNotation(source.getNodeName());
newnotation.setPublicId(srcnotation.getPublicId());
newnotation.setSystemId(srcnotation.getSystemId());

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
 Document doc;
 DocumentType docType;
 NamedNodeMap notations;
 Notation notationNode;
 String publicId;
 doc = (Document) load("staff", false);
 docType = doc.getDoctype();
 assertNotNull("docTypeNotNull", docType);
 notations = docType.getNotations();
 assertNotNull("notationsNotNull", notations);
 notationNode = (Notation) notations.getNamedItem("notation2");
 publicId = notationNode.getPublicId();
 assertNull("publicId", publicId);
 }
/**

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
  * Runs the test case.
  * @throws Throwable Any uncaught exception causes test to fail
  */
  public void runTest() throws Throwable {
   Document doc;
   DocumentType docType;
   NamedNodeMap notations;
   Notation notationNode;
   String systemId;
   int index;
   doc = (Document) load("staff", false);
   docType = doc.getDoctype();
   assertNotNull("docTypeNotNull", docType);
   notations = docType.getNotations();
   assertNotNull("notationsNotNull", notations);
   notationNode = (Notation) notations.getNamedItem("notation2");
   systemId = notationNode.getSystemId();
   assertURIEquals("uriEquals", null, null, null, "notation2File", null, null, null, null, systemId);
}
  /**

代码示例来源:origin: com.helger/ph-isorelax

public boolean enter (final Notation notation)
{
 final String name = notation.getNodeName ();
 final String pid = notation.getPublicId ();
 final String sid = notation.getSystemId ();
 buffer_.append ("<!NOTATION ").append (name);
 if (pid != null)
 {
  buffer_.append (" PUBLIC \"").append (pid).append ("\"");
  if (sid != null)
  {
   buffer_.append (" \"").append (UXML.escapeSystemQuot (sid)).append ("\"");
  }
 }
 else
  if (sid != null)
  {
   buffer_.append (" SYSTEM \"").append (UXML.escapeSystemQuot (sid)).append ("\"");
  }
 buffer_.append (">");
 return (true);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

NotationImpl newnotation =
(NotationImpl)createNotation(source.getNodeName());
newnotation.setPublicId(srcnotation.getPublicId());
newnotation.setSystemId(srcnotation.getSystemId());

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
  * Runs the test case.
  * @throws Throwable Any uncaught exception causes test to fail
  */
  public void runTest() throws Throwable {
   Document doc;
   DocumentType docType;
   NamedNodeMap notationsMap;
   Notation notation;
   String baseURI;
   String docURI;
   doc = (Document) load("hc_staff", false);
   docType = doc.getDoctype();
   notationsMap = docType.getNotations();
   notation = (Notation) notationsMap.getNamedItem("notation1");
   baseURI = notation.getBaseURI();
   docURI = doc.getDocumentURI();
   assertEquals("sameAsDocURI", docURI, baseURI);
   assertURIEquals("entityBase", null, null, null, null, "hc_staff", null, null, Boolean.TRUE, baseURI);
}
  /**

代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite

/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
 Document doc;
 DocumentType docType;
 NamedNodeMap entitiesMap;
 NamedNodeMap notationsMap;
 Entity entity;
 Notation notation;
 int entityPosition;
 int notationPosition;
 doc = (Document) load("hc_staff", false);
 docType = doc.getDoctype();
 entitiesMap = docType.getEntities();
 notationsMap = docType.getNotations();
 entity = (Entity) entitiesMap.getNamedItem("alpha");
 notation = (Notation) notationsMap.getNamedItem("notation1");
 entityPosition = (int) entity.compareDocumentPosition(notation);
 assertEquals("nodecomparedocumentpositionFollowing22", 4, entityPosition);
 notationPosition = (int) notation.compareDocumentPosition(entity);
 assertEquals("nodecomparedocumentpositionPRECEDING22", 2, notationPosition);
 }
/**

代码示例来源:origin: org.wicketstuff.htmlvalidator/wicketstuff-isorelax

public boolean enter(Notation notation) {
String name = notation.getNodeName();
String pid = notation.getPublicId();
String sid = notation.getSystemId();
buffer_.append("<!NOTATION ");
buffer_.append(name);
if (pid != null) {
  buffer_.append(" PUBLIC \"");
  buffer_.append(pid);
  buffer_.append("\"");
  if (sid != null) {
  buffer_.append(" \"");
  buffer_.append(UXML.escapeSystemQuot(sid));
  buffer_.append("\"");
  }
} else if (sid != null) {
  buffer_.append(" SYSTEM \"");
  buffer_.append(UXML.escapeSystemQuot(sid));
  buffer_.append("\"");
}
buffer_.append(">");
return (true);
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

NotationImpl newnotation =
(NotationImpl)createNotation(source.getNodeName());
newnotation.setPublicId(srcnotation.getPublicId());
newnotation.setSystemId(srcnotation.getSystemId());

代码示例来源:origin: com.sun.xml.bind/jaxb-extra-osgi

public boolean enter(Notation notation) {
  String s = notation.getNodeName();
  String s1 = notation.getPublicId();
  String s2 = notation.getSystemId();
  buffer_.append("<!NOTATION ");
  buffer_.append(s);
  if(s1 != null) {
    buffer_.append(" PUBLIC \"");
    buffer_.append(s1);
    buffer_.append("\"");
    if(s2 != null) {
      buffer_.append(" \"");
      buffer_.append(UXML.escapeSystemQuot(s2));
      buffer_.append("\"");
    }
  } else
  if(s2 != null) {
    buffer_.append(" SYSTEM \"");
    buffer_.append(UXML.escapeSystemQuot(s2));
    buffer_.append("\"");
  }
  buffer_.append(">");
  return true;
}

代码示例来源:origin: com.phloc/isorelax

public boolean enter (final Notation notation)
{
 final String name = notation.getNodeName ();
 final String pid = notation.getPublicId ();
 final String sid = notation.getSystemId ();
 buffer_.append ("<!NOTATION ");
 buffer_.append (name);
 if (pid != null)
 {
  buffer_.append (" PUBLIC \"");
  buffer_.append (pid);
  buffer_.append ("\"");
  if (sid != null)
  {
   buffer_.append (" \"");
   buffer_.append (UXML.escapeSystemQuot (sid));
   buffer_.append ("\"");
  }
 }
 else
  if (sid != null)
  {
   buffer_.append (" SYSTEM \"");
   buffer_.append (UXML.escapeSystemQuot (sid));
   buffer_.append ("\"");
  }
 buffer_.append (">");
 return (true);
}

代码示例来源:origin: com.sun.xml.bind/jaxb-extra-osgi

private void _handleEntities(DocumentType documenttype) {
  try {
    NamedNodeMap namednodemap = documenttype.getEntities();
    int i = namednodemap.getLength();
    for(int j = 0; j < i; j++) {
      Entity entity = (Entity)namednodemap.item(j);
      String s = entity.getPublicId();
      String s1 = entity.getSystemId();
      String s2 = entity.getNotationName();
      if(s != null || s1 != null)
        _handleExternalEntity(entity.getNodeName(), s, s1, s2);
      else
        _handleInternalEntity(entity);
    }
    NamedNodeMap namednodemap1 = documenttype.getNotations();
    int k = namednodemap1.getLength();
    for(int l = 0; l < k; l++) {
      Notation notation = (Notation)namednodemap1.item(l);
      String s3 = notation.getPublicId();
      String s4 = notation.getSystemId();
      dtd_.notationDecl(notation.getNodeName(), s3, s4);
    }
  }
  catch(SAXException saxexception) {
    _errorReport(saxexception);
  }
}

相关文章