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


Java UserDataHandler类代码示例

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


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

示例1: fireUserDataHandlers

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * Fire any UserDataHandlers on the given oldNode.
 */
protected void fireUserDataHandlers(short type,
                                    Node oldNode,
                                    Node newNode) {
    AbstractNode an = (AbstractNode) oldNode;
    if (an.userData != null) {
        Iterator i = an.userData.entrySet().iterator();
        while (i.hasNext()) {
            Map.Entry e = (Map.Entry) i.next();
            UserDataHandler h
                = (UserDataHandler) an.userDataHandlers.get(e.getKey());
            if (h != null) {
                h.handle(type,
                         (String) e.getKey(),
                         e.getValue(),
                         oldNode,
                         newNode);
            }
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:AbstractNode.java

示例2: adoptNode

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
public Node adoptNode(Node source)
  throws DOMException
{
  if (source == null || !(source instanceof GnomeNode))
    {
      return null;
    }
  Node ret = xmljAdoptNode(source);
  if (source instanceof GnomeNode)
    {
      ((GnomeNode) source).
        notifyUserDataHandlers(UserDataHandler.NODE_ADOPTED,
                               source, ret);
    }
  return ret;
}
 
开发者ID:vilie,项目名称:javify,代码行数:17,代码来源:GnomeDocument.java

示例3: setUserData

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
public Object setUserData(String key, Object data, UserDataHandler handler)
{
  // TODO handler
  if (userData == null)
    {
      userData = new HashMap();
    }
  if (handler != null)
    {
      if (userDataHandlers == null)
        {
          userDataHandlers = new HashMap();
        }
      userDataHandlers.put(key, handler);
    }
  return userData.put(key, data);
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:GnomeNode.java

示例4: cloneNode

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * <b>DOM L1</b>
 * Returns a clone of this node which optionally includes cloned
 * versions of child nodes.  Clones are always mutable, except for
 * entity reference nodes.
 */
public Node cloneNode(boolean deep)
{
  if (deep)
    {
      return cloneNodeDeepInternal(true, null);
    }

  DomNode node = (DomNode) clone();
  if (nodeType == ENTITY_REFERENCE_NODE)
    {
      node.makeReadonly();
    }
  notifyUserDataHandlers(UserDataHandler.NODE_CLONED, this, node);
  return node;
}
 
开发者ID:vilie,项目名称:javify,代码行数:22,代码来源:DomNode.java

示例5: setUserData

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
public Object setUserData(String key, Object data, UserDataHandler handler)
{
  if (userData == null)
    {
      userData = new HashMap();
    }
  if (handler != null)
    {
      if (userDataHandlers == null)
        {
          userDataHandlers = new HashMap();
        }
      userDataHandlers.put(key, handler);
    }
  return userData.put(key, data);
}
 
开发者ID:vilie,项目名称:javify,代码行数:17,代码来源:DomNode.java

示例6: validateChildren

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
protected boolean validateChildren() throws ParserException
{
    super.validateChildren();
    Node parent = this.getNode().getParentNode();

    if (parent != null && parent.getNodeType() == 9)
    {
        this.getNode().setUserData("validated", true, (UserDataHandler)null);

        if (this._topLevelNodes != null)
        {
        	for (String nodeName : this._topLevelNodes) {
        		this.validateNamedChildren(2, nodeName, (IValidatorFactory<?>)null);
        	}
        }
    }

    return true;
}
 
开发者ID:lawremi,项目名称:CustomOreGen,代码行数:20,代码来源:ValidatorRoot.java

示例7: startElement

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
{
    Node current = this.nodeStack.peek();
    Document doc = current.getNodeType() == 9 ? (Document)current : current.getOwnerDocument();
    int lineNumber = this.locator.getLineNumber();
    String filename = this.locator.getSystemId();
    Element newElement = doc.createElementNS(uri, qName);
    newElement.setUserData("line-number", lineNumber, (UserDataHandler)null);
    newElement.setUserData("filename", filename, (UserDataHandler)null);
    current.appendChild(newElement);

    for (int c = 0; c < attributes.getLength(); ++c)
    {
        Attr attr = doc.createAttributeNS(attributes.getURI(c), attributes.getQName(c));
        attr.setValue(attributes.getValue(c));
        attr.setUserData("line-number", lineNumber, (UserDataHandler)null);
        attr.setUserData("filename", filename, (UserDataHandler)null);
        newElement.setAttributeNodeNS(attr);
    }

    this.nodeStack.push(newElement);
}
 
开发者ID:lawremi,项目名称:CustomOreGen,代码行数:23,代码来源:LineAwareSAXHandler.java

示例8: validateChildren

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
protected boolean validateChildren() throws ParserException
{
    super.validateChildren();
    String optionName = (String)this.validateRequiredAttribute(String.class, "name", true);
    ConfigOption option = this.getParser().target.getConfigOption(optionName);

    if (option == null)
    {
        throw new ParserException("Option \'" + optionName + "\' is not a recognized option.", this.getNode());
    }
    else
    {
        this.getNode().setUserData("validated", Boolean.valueOf(true), (UserDataHandler)null);
        this.checkChildrenValid();
        Object value = option.getValue();
        this.replaceWithNode(new Node[] {value == null ? null : this.getNode().getOwnerDocument().createTextNode(value.toString())});
        return false;
    }
}
 
开发者ID:lawremi,项目名称:CustomOreGen,代码行数:20,代码来源:ValidatorRefOption.java

示例9: setUserData

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * This DOM Level 3 method is not supported for {@code IIOMetadataNode}
 * and will throw a {@code DOMException}.
 * @throws DOMException - always.
 */
public Object setUserData(String key,
                          Object data,
                          UserDataHandler handler) throws DOMException {
    throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
                           "Method not supported");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:IIOMetadataNode.java

示例10: cloneNode

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * Returns a duplicate of a given node. You can consider this a
 * generic "copy constructor" for nodes. The newly returned object should
 * be completely independent of the source object's subtree, so changes
 * in one after the clone has been made will not affect the other.
 * <P>
 * Note: since we never have any children deep is meaningless here,
 * ParentNode overrides this behavior.
 * @see ParentNode
 *
 * <p>
 * Example: Cloning a Text node will copy both the node and the text it
 * contains.
 * <p>
 * Example: Cloning something that has children -- Element or Attr, for
 * example -- will _not_ clone those children unless a "deep clone"
 * has been requested. A shallow clone of an Attr node will yield an
 * empty Attr of the same name.
 * <p>
 * NOTE: Clones will always be read/write, even if the node being cloned
 * is read-only, to permit applications using only the DOM API to obtain
 * editable copies of locked portions of the tree.
 */
public Node cloneNode(boolean deep) {

    if (needsSyncData()) {
        synchronizeData();
    }

    NodeImpl newnode;
    try {
        newnode = (NodeImpl)clone();
    }
    catch (CloneNotSupportedException e) {
        // if we get here we have an error in our program we may as well
        // be vocal about it, so that people can take appropriate action.
        throw new RuntimeException("**Internal Error**" + e);
    }

    // Need to break the association w/ original kids
    newnode.ownerNode      = ownerDocument();
    newnode.isOwned(false);

    // By default we make all clones readwrite,
    // this is overriden in readonly subclasses
    newnode.isReadOnly(false);

    ownerDocument().callUserDataHandlers(this, newnode,
                                         UserDataHandler.NODE_CLONED);

    return newnode;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:NodeImpl.java

示例11: setUserData

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * This DOM Level 3 method is not supported for {@code IIOMetadataNode}
 * and will throw a {@code DOMException}.
 * @throws DOMException always.
 */
public Object setUserData(String key,
                          Object data,
                          UserDataHandler handler) throws DOMException {
    throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
                           "Method not supported");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:IIOMetadataNode.java

示例12: cloneNode

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link org.w3c.dom.Node#cloneNode(boolean)}.
 */
public Node cloneNode(boolean deep) {
    Document n = (Document)newNode();
    copyInto(n);
    fireUserDataHandlers(UserDataHandler.NODE_CLONED, this, n);
    if (deep) {
        for (Node c = getFirstChild();
             c != null;
             c = c.getNextSibling()) {
            n.appendChild(n.importNode(c, deep));
        }
    }
    return n;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:17,代码来源:AbstractDocument.java

示例13: adoptNode1

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * Helper function for {@link #adoptNode(Node)}.
 */
protected void adoptNode1(AbstractNode n) {
    n.ownerDocument = this;
    switch (n.getNodeType()) {
        case Node.ATTRIBUTE_NODE:
            AbstractAttr attr = (AbstractAttr) n;
            attr.ownerElement = null;
            attr.unspecified = false;
            break;
        case Node.ELEMENT_NODE:
            NamedNodeMap nnm = n.getAttributes();
            int len = nnm.getLength();
            for (int i = 0; i < len; i++) {
                attr = (AbstractAttr) nnm.item(i);
                if (attr.getSpecified()) {
                    adoptNode1(attr);
                }
            }
            break;
        case Node.ENTITY_REFERENCE_NODE:
            while (n.getFirstChild() != null) {
                n.removeChild(n.getFirstChild());
            }
            break;
    }

    fireUserDataHandlers(UserDataHandler.NODE_ADOPTED, n, null);

    for (Node m = n.getFirstChild(); m != null; m = m.getNextSibling()) {
        switch (m.getNodeType()) {
            case Node.DOCUMENT_TYPE_NODE:
            case Node.ENTITY_NODE:
            case Node.NOTATION_NODE:
                return;
        }
        adoptNode1((AbstractNode) m);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:41,代码来源:AbstractDocument.java

示例14: setUserData

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements
 * {@link org.w3c.dom.Node#setUserData(String,Object,UserDataHandler)}.
 */
public Object setUserData(String key, Object data, UserDataHandler handler) {
    if (userData == null) {
        userData = new HashMap();
        userDataHandlers = new HashMap();
    }
    if (data == null) {
        userData.remove(key);
        return userDataHandlers.remove(key);
    }
    userDataHandlers.put(key, handler);
    return userData.put(key, data);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:17,代码来源:AbstractNode.java

示例15: importNode

import org.w3c.dom.UserDataHandler; //导入依赖的package包/类
public Node importNode(Node importedNode, boolean deep)
  throws DOMException
{
  Node ret = xmljImportNode(importedNode, deep);
  if (importedNode instanceof GnomeNode)
    {
      ((GnomeNode) importedNode)
        .notifyUserDataHandlers(UserDataHandler.NODE_IMPORTED,
                                importedNode, ret);
    }
  return ret;
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:GnomeDocument.java


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