Package dk.brics.xmlgraph

Examples of dk.brics.xmlgraph.XMLGraph.merge()


    right.getContents().add(text.getIndex());

    switch (s.getKind()) {
    case APPEND:
    case PREPEND:
      g.merge(xmlsrc);
      left.getContents().addAll(base.getRoots());
      g.getRoots().clear();
      g.getRoots().add(seq.getIndex());
      return g;
View Full Code Here


    case PREPENDCONTENT:{
      final StatusMap stm = evaluateXPathOrRoot(s.getXPath(), g);
      boolean empty = checkXPathEmpty(s, g, stm);
      if (empty)
        return g;
      g.merge(xmlsrc);
      g.getRoots().retainAll(base.getRoots());
      // TODO can we append as root here???
      g.processReachableNodes(new NodeProcessor<Object>() {
        @Override
        public Object process(ElementNode n) {
View Full Code Here

    case INSERTBEFORE: {
      final StatusMap stm = evaluateXPathOrRoot(s.getXPath(), g);
      boolean empty = checkXPathEmpty(s, g, stm);
      if (empty)
        return g;
      g.merge(xmlsrc);
      g.getRoots().retainAll(base.getRoots());
      g.processReachableNodes(new NodeProcessor<Object>() {
        @Override
        public Object process(ChoiceNode ch) {
          LinkedHashSet<Integer> cs = new LinkedHashSet<Integer>(ch.getContents());
View Full Code Here

      return g;
    }
    g.getRoots().clear();
    g.getRoots().add(stm_nodes.getStmNode(s, g).getIndex());
    if (nextnode != null) {
      g.merge(nextnode);
      mergeContents(stm_nodes.getStmNextNode(s, g), nextnode.getRoots(), g);
    }
    if (firstattr != null) {
      g.merge(firstattr);
            mergeContents(stm_nodes.getStmFirstAttribute(s, g), firstattr.getRoots(), g);
View Full Code Here

    if (nextnode != null) {
      g.merge(nextnode);
      mergeContents(stm_nodes.getStmNextNode(s, g), nextnode.getRoots(), g);
    }
    if (firstattr != null) {
      g.merge(firstattr);
            mergeContents(stm_nodes.getStmFirstAttribute(s, g), firstattr.getRoots(), g);
    }
    if (firstchild != null) {
      g.merge(firstchild);
            mergeContents(stm_nodes.getStmFirstChild(s, g), firstchild.getRoots(), g);
View Full Code Here

    if (firstattr != null) {
      g.merge(firstattr);
            mergeContents(stm_nodes.getStmFirstAttribute(s, g), firstattr.getRoots(), g);
    }
    if (firstchild != null) {
      g.merge(firstchild);
            mergeContents(stm_nodes.getStmFirstChild(s, g), firstchild.getRoots(), g);
    }
    g.getRoots().clear();
    g.getRoots().add(stm_nodes.getStmNode(s, g).getIndex());
    switch (s.getKind()) {
View Full Code Here

        ArrayList<Automaton> ss = new ArrayList<Automaton>();
        ss.add(s.getStringSource());
        ss.add(tn.getText());
        tn.replaceText(Automaton.union(ss), g);
      }
      g.merge(xmlsrc);
      if (s.getKind() == PlugStm.Kind.PLUGWRAP) {
        g.getRoots().clear();
        g.getRoots().add(stm_nodes.getPlugWrapTopNode(s, g).getIndex());
        restoreEdges(stm_nodes.getPlugWrapTopNode(s, g), g);
        stm_nodes.getPlugWrapContentNode(s, g).setContent(base.getRoots(), g);
View Full Code Here

    boolean empty = checkXPathEmpty(s, g, stm);
    if (empty)
      return g;

    g.merge(xmlsrc);
    g.getRoots().retainAll(base.getRoots());

    final TextNode text = stm_nodes.getSetTextNode(s, g);
    text.replaceText(s.getStringSource(), g);
View Full Code Here

    switch (s.getKind()) {
    case ELEMENT:
      stm_nodes.getCopyElementNode(s, g).setName(getFirstElementNames(base), g);
      restoreEdges(stm_nodes.getCopyElementNode(s, g).getContent(), g);
      if (firstattr != null) {
        g.merge(firstattr);
        stm_nodes.getCopyFirstAttribute(s, g).setContent(firstattr.getRoots(), g);
      }
      if (firstchild != null) {
        g.merge(firstchild);
        stm_nodes.getCopyFirstChild(s, g).setContent(firstchild.getRoots(), g);
View Full Code Here

      if (firstattr != null) {
        g.merge(firstattr);
        stm_nodes.getCopyFirstAttribute(s, g).setContent(firstattr.getRoots(), g);
      }
      if (firstchild != null) {
        g.merge(firstchild);
        stm_nodes.getCopyFirstChild(s, g).setContent(firstchild.getRoots(), g);
      }
      if (nextnode != null) {
        g.merge(nextnode);
        stm_nodes.getCopyNextNode(s, g).setContent(nextnode.getRoots(), g);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.