Java 类org.w3c.dom.Notation 实例源码

项目:javify    文件:DomDoctype.java   
/**
 * Records the declaration of a notation in this DocumentType.
 *
 * @param name Name of the notation
 * @param publicId If non-null, provides the notation's PUBLIC identifier
 * @param systemId If non-null, provides the notation's SYSTEM identifier
 * @return The notation that was declared.
 *
 * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
 *    DocumentType is no longer writable.
 * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
 *    is not associated with a document.
 */
public Notation declareNotation(String name,
                                String publicId,
                                String systemId)
{
  DomNotation notation;

  if (isReadonly())
    {
      throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
    }
  getNotations();

  DomDocument.checkName(name, (owner != null) ?
                        "1.1".equals(owner.getXmlVersion()) : false);

  notation = new DomNotation(owner, name, publicId, systemId);
  notations.setNamedItem(notation);
  return notation;
}
项目:jvm-stm    文件:DomDoctype.java   
/**
 * Records the declaration of a notation in this DocumentType.
 *
 * @param name Name of the notation
 * @param publicId If non-null, provides the notation's PUBLIC identifier
 * @param systemId If non-null, provides the notation's SYSTEM identifier
 * @return The notation that was declared.
 *
 * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
 *  DocumentType is no longer writable.
 * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
 *  is not associated with a document.
 */
public Notation declareNotation(String name,
                                String publicId,
                                String systemId)
{
  DomNotation notation;

  if (isReadonly())
    {
      throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
    }
  getNotations();

  DomDocument.checkName(name, (owner != null) ?
                        "1.1".equals(owner.getXmlVersion()) : false);

  notation = new DomNotation(owner, name, publicId, systemId);
  notations.setNamedItem(notation);
  return notation;
}
项目:chromedevtools    文件:DomUtils.java   
static <R> R visitNode(Node node, NodeVisitor<R> visitor) {
  switch (node.getNodeType()) {
    case Node.ELEMENT_NODE: return visitor.visitElement((Element) node);
    case Node.ATTRIBUTE_NODE: return visitor.visitAttr((Attr) node);
    case Node.TEXT_NODE: return visitor.visitText((Text) node);
    case Node.CDATA_SECTION_NODE: return visitor.visitCDATASection((CDATASection) node);
    case Node.ENTITY_REFERENCE_NODE: return visitor.visitEntityReference((EntityReference) node);
    case Node.ENTITY_NODE: return visitor.visitEntity((Entity) node);
    case Node.PROCESSING_INSTRUCTION_NODE:
        return visitor.visitProcessingInstruction((ProcessingInstruction) node);
    case Node.COMMENT_NODE: return visitor.visitComment((Comment) node);
    case Node.DOCUMENT_NODE: return visitor.visitDocument((Document) node);
    case Node.DOCUMENT_TYPE_NODE: return visitor.visitDocumentType((DocumentType) node);
    case Node.DOCUMENT_FRAGMENT_NODE:
        return visitor.visitDocumentFragment((DocumentFragment) node);
    case Node.NOTATION_NODE: return visitor.visitNotation((Notation) node);
    default: throw new RuntimeException();
  }
}
项目:JamVM-PH    文件:DomDoctype.java   
/**
 * Records the declaration of a notation in this DocumentType.
 *
 * @param name Name of the notation
 * @param publicId If non-null, provides the notation's PUBLIC identifier
 * @param systemId If non-null, provides the notation's SYSTEM identifier
 * @return The notation that was declared.
 *
 * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
 *  DocumentType is no longer writable.
 * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
 *  is not associated with a document.
 */
public Notation declareNotation(String name,
                                String publicId,
                                String systemId)
{
  DomNotation notation;

  if (isReadonly())
    {
      throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
    }
  getNotations();

  DomDocument.checkName(name, (owner != null) ?
                        "1.1".equals(owner.getXmlVersion()) : false);

  notation = new DomNotation(owner, name, publicId, systemId);
  notations.setNamedItem(notation);
  return notation;
}
项目:gocd    文件:SaveContextVisitor.java   
public boolean enter(Notation notation) {
    String name = notation.getNodeName();
    String pubId = notation.getPublicId();
    String sysId = notation.getSystemId();
    buffer.append("<!NOTATION ");
    buffer.append(name);
    if (pubId != null) {
        buffer.append(" PUBLIC \"");
        buffer.append(pubId);
        buffer.append("\"");
        if (sysId != null) {
            buffer.append(" \"");
            buffer.append(sysId);
            buffer.append("\"");
        }
    } else if (sysId != null) {
        buffer.append(" SYSTEM \"");
        buffer.append(sysId);
        buffer.append("\"");
    }
    buffer.append(">");
    return true;
}
项目:classpath    文件:DomDoctype.java   
/**
 * Records the declaration of a notation in this DocumentType.
 *
 * @param name Name of the notation
 * @param publicId If non-null, provides the notation's PUBLIC identifier
 * @param systemId If non-null, provides the notation's SYSTEM identifier
 * @return The notation that was declared.
 *
 * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
 *    DocumentType is no longer writable.
 * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
 *    is not associated with a document.
 */
public Notation declareNotation(String name,
                                String publicId,
                                String systemId)
{
  DomNotation notation;

  if (isReadonly())
    {
      throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
    }
  getNotations();

  DomDocument.checkName(name, (owner != null) ?
                        "1.1".equals(owner.getXmlVersion()) : false);

  notation = new DomNotation(owner, name, publicId, systemId);
  notations.setNamedItem(notation);
  return notation;
}
项目:OpenJSharp    文件:DOMResultBuilder.java   
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);
    }
}
项目:OperatieBRP    文件:DomUtils.java   
/**
 * Bepaal of de gegeven node genegeerd kan worden.
 * @param node node
 * @return true, als de node genegeerd kan worden, anders false
 */
public static boolean isIgnorableNode(final Node node) {
    boolean result = false;
    if (node instanceof Comment || node instanceof Notation || node instanceof ProcessingInstruction) {
        // Commentaar, etc kan genegeerd worden
        result = true;
    }

    if (node instanceof Text && node.getTextContent().trim().isEmpty()) {
        // Lege text kan genegeerd worden
        result = true;
    }

    if (node instanceof Attr) {
        if (node.getNodeName().startsWith("xmlns")) {
            // Alles met namespaces wordt genegeerd
            result = true;
        }

        if ("class".equals(node.getLocalName())) {
            // Class identificatie wordt door het framework gebruikt.
            result = true;
        }
    }

    return result;
}
项目:openjdk-jdk10    文件:CoreDocumentImpl.java   
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:openjdk-jdk10    文件:DOMResultBuilder.java   
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);
    }
}
项目:openjdk-jdk10    文件:NotationTest.java   
private Notation findNotation(String name) throws SAXException, IOException, ParserConfigurationException {
    Document document = createDOM("Notation01.xml");
    NamedNodeMap nm = document.getDoctype().getNotations();
    for (int i = 0; i < nm.getLength(); i++) {
        if (nm.item(i).getNodeName().equals(name)) {
            return (Notation) nm.item(i);
        }
    }
    throw new RuntimeException("Notation: '" + name + "' not found.");
}
项目:openjdk9    文件:CoreDocumentImpl.java   
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:openjdk9    文件:DOMResultBuilder.java   
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);
    }
}
项目:openjdk9    文件:NotationTest.java   
private Notation findNotation(String name) throws SAXException, IOException, ParserConfigurationException {
    Document document = createDOM("Notation01.xml");
    NamedNodeMap nm = document.getDoctype().getNotations();
    for (int i = 0; i < nm.getLength(); i++) {
        if (nm.item(i).getNodeName().equals(name)) {
            return (Notation) nm.item(i);
        }
    }
    throw new RuntimeException("Notation: '" + name + "' not found.");
}
项目:lookaside_java-1.8.0-openjdk    文件:CoreDocumentImpl.java   
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:lookaside_java-1.8.0-openjdk    文件:DOMResultBuilder.java   
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);
    }
}
项目:javify    文件:UnparsedEntityUriFunction.java   
@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 "";
}
项目:jvm-stm    文件:UnparsedEntityUriFunction.java   
@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 "";
}
项目:infobip-open-jdk-8    文件:DOMResultBuilder.java   
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);
    }
}
项目:OLD-OpenJDK8    文件:DOMResultBuilder.java   
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);
    }
}
项目:JamVM-PH    文件:UnparsedEntityUriFunction.java   
@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 "";
}
项目:SplitCharater    文件:DOMResultBuilder.java   
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);
    }
}
项目:xmlunit    文件:AbstractNodeTester.java   
/**
 * Validate a single Node by delegating to node type specific methods.
 * @see #testAttribute(Attr)
 * @see #testCDATASection(CDATASection)
 * @see #testComment(Comment)
 * @see #testDocumentType(DocumentType)
 * @see #testElement(Element)
 * @see #testEntity(Entity)
 * @see #testEntityReference(EntityReference)
 * @see #testNotation(Notation)
 * @see #testProcessingInstruction(ProcessingInstruction)
 * @see #testText(Text)
 */
public void testNode(Node aNode, NodeTest forTest) throws NodeTestException {
    switch (aNode.getNodeType()) {
    case Node.ATTRIBUTE_NODE:
        // should not happen as attributes are not exposed by DOM traversal
        testAttribute((Attr)aNode);
        break;
    case Node.CDATA_SECTION_NODE:
        testCDATASection((CDATASection)aNode);
        break;
    case Node.COMMENT_NODE:
        testComment((Comment)aNode);
        break;
    case Node.DOCUMENT_TYPE_NODE:
        testDocumentType((DocumentType)aNode);
        break;
    case Node.ELEMENT_NODE:
        testElement((Element)aNode);
        break;
    case Node.ENTITY_NODE:
        testEntity((Entity)aNode);
        break;
    case Node.ENTITY_REFERENCE_NODE:
        testEntityReference((EntityReference)aNode);
        break;
    case Node.NOTATION_NODE:
        testNotation((Notation)aNode);
        break;
    case Node.PROCESSING_INSTRUCTION_NODE:
        testProcessingInstruction(
                                  (ProcessingInstruction) aNode);
        break;
    case Node.TEXT_NODE:
        testText((Text)aNode);
        break;
    default:
        throw new NodeTestException("No delegate method for Node type",
                                    aNode);
    }
}
项目:gocd    文件:SaveContextVisitor.java   
public boolean enter(Node node) {
    if (node instanceof Document) {
        return enter((Document)node);
    }
    if (node instanceof Element) {
        return enter((Element)node);
    }
    if (node instanceof Attr) {
        return enter((Attr)node);
    }
    if (node instanceof Text) {
        return enter((Text)node);
    }
    if (node instanceof CDATASection) {
        return enter((CDATASection)node);
    }
    if (node instanceof Comment) {
        return enter((Comment)node);
    }
    if (node instanceof DocumentType) {
        return enter((DocumentType)node);
    }
    if (node instanceof Entity) {
        return enter((Entity)node);
    }
    if (node instanceof EntityReference) {
        return enter((EntityReference) node);
    }
    if (node instanceof Notation) {
        return enter((Notation)node);
    }
    if (node instanceof ProcessingInstruction) {
        return enter((ProcessingInstruction)node);
    }
    return false;
}
项目:classpath    文件:UnparsedEntityUriFunction.java   
@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 "";
}
项目:openjdk-icedtea7    文件:DOMResultBuilder.java   
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);
    }
}
项目:FastInfoset    文件:DOM_FI_Encoder.java   
private void encodeHeader(Document d) throws IOException {
    List<UnparsedEntity> unParsedEntities = null;
    List<fastinfoset.Document.Notation> notations  = null;
    DocumentType docType = d.getDoctype();
    if (docType != null) {
        //Notations
        notations = getNotations(docType.getNotations());
        //Unparsed Entities
        unParsedEntities = getUnparsedEntities(docType.getEntities());
    }
    encodeHeader(d.getXmlEncoding(), d.getXmlStandalone(), d.getXmlVersion(), unParsedEntities, notations);
}
项目:FastInfoset    文件:DOM_FI_Encoder.java   
private List<fastinfoset.Document.Notation> getNotations(NamedNodeMap notations) {
    List<fastinfoset.Document.Notation> result = new ArrayList<fastinfoset.Document.Notation>();
    for (int i = 0; i < notations.getLength(); i++) {
        Notation n = (Notation) notations.item(i);
        result.add(new fastinfoset.Document.Notation(n.getNodeName(), n.getSystemId(), n.getPublicId()));
    }
    return result;
}
项目:scaleDOM    文件:CoreDocumentImpl.java   
/**
 * NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left
 * the process of building DTD information unspecified.)
 * 
 * @param name The name of the Notation we wish to describe
 * 
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where notations are not permitted. (HTML not yet
 *             implemented.)
 */
public Notation createNotation(String name) throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR",
                null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:chromedevtools    文件:DomUtils.java   
@Override public R visitNotation(Notation node) {
  return visitDefault(node);
}
项目:In-the-Box-Fork    文件:DomTest.java   
@Override protected void setUp() throws Exception {
    transformer = TransformerFactory.newInstance().newTransformer();
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    builder = factory.newDocumentBuilder();
    domImplementation = builder.getDOMImplementation();
    document = builder.parse(new InputSource(new StringReader(xml)));

    // doctype nodes
    doctype = document.getDoctype();
    if (doctype.getEntities() != null) {
        sp = (Entity) doctype.getEntities().item(0);
    }
    if (doctype.getNotations() != null) {
        png = (Notation) doctype.getNotations().item(0);
    }

    // document nodes
    menu = document.getDocumentElement();
    item = (Element) menu.getChildNodes().item(1);
    itemXmlns = item.getAttributeNode("xmlns");
    itemXmlnsA = item.getAttributeNode("xmlns:a");
    name = (Element) item.getChildNodes().item(1);
    standard = name.getAttributeNode("a:standard");
    deluxe = name.getAttributeNode("deluxe");
    waffles = (Text) name.getChildNodes().item(0);
    description = (Element) item.getChildNodes().item(3);
    descriptionText1 = (Text) description.getChildNodes().item(0);
    descriptionText2 = (CDATASection) description.getChildNodes().item(1);
    descriptionText3 = (Text) description.getChildNodes().item(2);
    option1 = (Element) item.getChildNodes().item(5);
    option2 = (Element) item.getChildNodes().item(7);
    option2Reference = option2.getChildNodes().item(0);
    wafflemaker = (ProcessingInstruction) item.getChildNodes().item(9);
    nutrition = (Element) item.getChildNodes().item(11);
    vitamins = (Element) nutrition.getChildNodes().item(1);
    vitaminsXmlnsA = vitamins.getAttributeNode("xmlns:a");
    comment = (Comment) vitamins.getChildNodes().item(1);
    vitaminc = (Element) vitamins.getChildNodes().item(3);
    vitamincText = (Text) vitaminc.getChildNodes().item(0);

    allNodes = new ArrayList<Node>();

    if (sp != null) {
        allNodes.add(sp);
    }
    if (png != null) {
        allNodes.add(png);
    }

    allNodes.addAll(Arrays.asList(document, doctype, menu, item, itemXmlns,
            itemXmlnsA, name, standard, deluxe, waffles, description,
            descriptionText1, descriptionText2, descriptionText3, option1,
            option2, option2Reference, wafflemaker, nutrition, vitamins,
            vitaminsXmlnsA, comment, vitaminc, vitamincText));
}
项目:gocd    文件:SaveContextVisitor.java   
public void leave(Node node) {
    if (node instanceof Document) {
        leave((Document)node);
        return;
    }
    if (node instanceof Element) {
        leave((Element)node);
        return;
    }
    if (node instanceof Attr) {
        leave((Attr)node);
        return;
    }
    if (node instanceof Text) {
        return;
    }
    if (node instanceof CDATASection) {
        leave((CDATASection)node);
        return;
    }
    if (node instanceof Comment) {
        leave((Comment)node);
        return;
    }
    if (node instanceof DocumentType) {
        leave((DocumentType)node);
        return;
    }
    if (node instanceof Entity) {
        leave((Entity)node);
        return;
    }
    if (node instanceof EntityReference) {
        leave((EntityReference) node);
        return;
    }
    if (node instanceof Notation) {
        leave((Notation)node);
        return;
    }
    if (node instanceof ProcessingInstruction) {
        leave((ProcessingInstruction)node);
        return;
    }
}
项目:gocd    文件:SaveContextVisitor.java   
public void leave(Notation notation) {
    // no-op
}
项目:OpenJSharp    文件:CoreDocumentImpl.java   
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:infobip-open-jdk-8    文件:CoreDocumentImpl.java   
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:OLD-OpenJDK8    文件:CoreDocumentImpl.java   
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:SplitCharater    文件:CoreDocumentImpl.java   
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:openjdk-icedtea7    文件:CoreDocumentImpl.java   
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
项目:xmlunit    文件:AbstractNodeTester.java   
/**
 * Template delegator for testNode() method. OVERRIDE to add custom logic
 * @param notation
 * @exception NodeTestException always: override if required in subclass
 */
public void testNotation(Notation notation) throws NodeTestException {
    unhandled(notation);
}
项目:chromedevtools    文件:DomUtils.java   
R visitNotation(Notation node);