/** * Visits and copies the specified node. * * @param node the node */ @Override public void visitBeforeChildren(ConfigurationNode node) { ConfigurationNode copy = (ConfigurationNode) node.clone(); copy.setParentNode(null); if (!copyStack.isEmpty()) { if (node.isAttribute()) { copyStack.peek().addAttribute(copy); } else { copyStack.peek().addChild(copy); } } copyStack.push(copy); }
/** * Visits and copies the specified node. * * @param node the node */ @Override public void visitBeforeChildren(ConfigurationNode node) { ConfigurationNode copy = (ConfigurationNode) node.clone(); copy.setParentNode(null); if (!copyStack.isEmpty()) { if (node.isAttribute()) { copyStack.peek().addAttribute(copy); } else { copyStack.peek().addChild(copy); } } copyStack.push(copy); }
public static ConfigurationNode writeChannel(Channel channel){ if(channel == null){ return null; } ConfigurationNode node = XMLConfigUtils.node(CHANNEL); node.addAttribute(XMLConfigUtils.node(CHANNEL_ID, channel.getId())); String name = channel.getName(); if(name != null && !name.isEmpty()){ node.addAttribute(XMLConfigUtils.node(MOTION_PATH_NAME, name)); } node.addChild(writeMotionPaths(channel.getMotionPaths())); return node; }
public static ConfigurationNode writeMotionPath(MotionPath mp){ if(mp == null){ return null; } ConfigurationNode node = XMLConfigUtils.node(MOTION_PATH); String name = mp.getName(); if(name != null && !name.isEmpty()){ node.addAttribute(XMLConfigUtils.node(MOTION_PATH_NAME, name)); } node.addChild(XMLConfigUtils.writeVersion(mp.getInterpolatorVersion(), INTERPOLATION_VERSION_TYPE)); node.addChild(writeControlPoints(mp.getControlPoints())); return node; }
/** * Returns a XML node for the given VersionProperty. * @param version VersionProperty to write * @param type type attribute for the VersionProperty * @return XML node for the given VersionProperty */ public static ConfigurationNode writeVersion(VersionProperty version, String type){ ConfigurationNode node = node(XML_VERSION); node.addAttribute(node(XML_VERSION_TYPE, type)); node.addChild(node(XML_VERSION_NAME, version.getName())); node.addChild(node(XML_VERSION_NUMBER, version.getNumber())); return node; }
/** * Returns a XML node for the given VersionProperty. * @param version VersionProperty to write * @param type type attribute for the VersionProperty * @return XML node for the given VersionProperty */ public static ConfigurationNode writeVersion(VersionProperty version, String type){ ConfigurationNode node = node(XML_VERSION); node.addAttribute(node(XML_VERSION_TYPE, type)); node.addChild(node(XML_VERSION_NAME, version.getName())); node.addChild(node(XML_VERSION_NUMBER, version.getNumber())); return node; }
parent.addAttribute(child);
parent.addAttribute(child);
/** * Helper method for processing a node add data object obtained from the * expression engine. This method will create all new nodes. * * @param data the data object * @return the new node * @since 1.3 */ private ConfigurationNode processNodeAddData(NodeAddData data) { ConfigurationNode node = data.getParent(); // Create missing nodes on the path for (String name : data.getPathNodes()) { ConfigurationNode child = createNode(name); node.addChild(child); node = child; } // Add new target node ConfigurationNode child = createNode(data.getNewNodeName()); if (data.isAttribute()) { node.addAttribute(child); } else { node.addChild(child); } return child; }
/** * Helper method for processing a node add data object obtained from the * expression engine. This method will create all new nodes. * * @param data the data object * @return the new node * @since 1.3 */ private ConfigurationNode processNodeAddData(NodeAddData data) { ConfigurationNode node = data.getParent(); // Create missing nodes on the path for (String name : data.getPathNodes()) { ConfigurationNode child = createNode(name); node.addChild(child); node = child; } // Add new target node ConfigurationNode child = createNode(data.getNewNodeName()); if (data.isAttribute()) { node.addAttribute(child); } else { node.addChild(child); } return child; }
result.getRootNode().addAttribute(attr);
result.getRootNode().addAttribute(attr);