@atomist/rug
Version:
TypeScript model for Atomist Rugs, see http://docs.atomist.com/
89 lines (78 loc) • 3.27 kB
text/typescript
/*
* Copyright 2015-2017 Atomist Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TreeNode, GraphNode, FormatInfo, PathExpressionEngine } from "@atomist/rug/tree/PathExpression";
import { ProjectContext } from "@atomist/rug/operations/ProjectEditor";
import { FileArtifactBacked } from "./FileArtifactBacked";
import { MutableView } from "./MutableView";
export { Xml };
/**
* XML
*/
interface Xml extends FileArtifactBacked, MutableView {
/**
* Add the specified content under the indicated xpath-selected node
*
* @param xpath {string} The XPath selector for the node to add the content under
* @param newNode {string} The new node name to be added as a child
* @param nodeContent {string} XML document to be added under the indicated node
*/
addChildNode(xpath: string, newNode: string, nodeContent: string): void;
/**
* Adds a node if it does not exist
*
* @param parentNodeXPath {string} The XPath selector for the parent node
* @param xPathOfNodeToPlace {string} The XPath selector for the node to be placed
* @param newNode {string} The name of the node being placed
* @param nodeContent {string} The content of the node being placed
*/
addNodeIfNotPresent(parentNodeXPath: string, xPathOfNodeToPlace: string, newNode: string, nodeContent: string): void;
/**
* Adds or replaces a node
*
* @param parentNodeXPath {string} The XPath selector for the parent node
* @param xPathOfNodeToReplace {string} The XPath selector for the node to replace
* @param newNode {string} The name of the node being placed
* @param nodeContent {string} The content of the node being placed
*/
addOrReplaceNode(parentNodeXPath: string, xPathOfNodeToReplace: string, newNode: string, nodeContent: string): void;
/**
* Tests whether a node matching the given xpath expression is present
*
* @param xpath {string} The XPath to test against for the presence of a node
* @returns {boolean}
*/
contains(xpath: string): boolean;
/**
* Deletes the specified node
*
* @param xpath {string} The XPath to the node to delete
*/
deleteNode(xpath: string): void;
/**
* Get the text content for a specific xpath expression
*
* @param xpath {string} The XPath to use to retrieve the test content
* @returns {string}
*/
getTextContentFor(xpath: string): string;
/**
* Set the text content for a specific xpath expression
*
* @param xpath {string} The XPath to use to set the test content
* @param newContent {string} New text content for the XPath
*/
setTextContentFor(xpath: string, newContent: string): void;
}