Package org.exist.atom.util

Examples of org.exist.atom.util.NodeHandler


  public void mergeEntry(final Txn transaction, final ElementImpl target,
      Element source, final String updated) {
   
    final List<Node> toRemove = new ArrayList<Node>();
    DOM.forEachChild(target, new NodeHandler() {
      @Override
      public void process(Node parent, Node child) {
        if (child.getNodeType() == Node.ELEMENT_NODE) {
          final String ns = child.getNamespaceURI();
          if (ns != null && ns.equals(Atom.NAMESPACE_STRING)) {
            final String lname = child.getLocalName();
            if ("updated".equals(lname)) {
              // Changed updated
              DOMDB.replaceText(transaction, (ElementImpl) child,
                  updated);
            } else if ("link".equals(lname)) {
              final String rel = ((Element) child).getAttribute("rel");
              if (!"edit".equals(rel)
                  && !"edit-media".equals(rel)) {
                // remove it
                toRemove.add(child);
              }
            } else if (!"id".equals(lname)
                && !"published".equals(lname)) {
              // remove it
              toRemove.add(child);
            }
          } else {
            // remove it
            toRemove.add(child);
          }
        } else {
          toRemove.add(child);
        }
      }
    });

    for (final Node child : toRemove) {
      target.removeChild(transaction, child);
    }

    DOM.forEachChild(source, new NodeHandler() {
      @Override
      public void process(Node parent, Node child) {
        if (child.getNodeType() == Node.ELEMENT_NODE) {
          final String ns = child.getNamespaceURI();
          if (ns != null && ns.equals(Atom.NAMESPACE_STRING)) {
View Full Code Here


  public void mergeFeed(final DBBroker broker, final Txn transaction,
      final ElementImpl target, Element source, final String updated) {
   
    final DocumentImpl ownerDocument = (DocumentImpl) target.getOwnerDocument();
    final List<Node> toRemove = new ArrayList<Node>();
    DOM.forEachChild(target, new NodeHandler() {
      @Override
      public void process(Node parent, Node child) {
        if (child.getNodeType() == Node.ELEMENT_NODE) {
          final String ns = child.getNamespaceURI();
          if (ns != null) {
View Full Code Here

TOP

Related Classes of org.exist.atom.util.NodeHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.