Transform a Common Content CSNode entity into a Comment object that can be added to a Content Specification.

@param node The CSNode to be transformed.
@return The transformed Comment object.
967851
protected static CommonContent transformCommonContent(CSNodeWrapper node) {
        final CommonContent commonContent;
        if (node.getNodeType() == CommonConstants.CS_NODE_COMMON_CONTENT) {
            commonContent = new CommonContent(node.getTitle());
        } else {
            throw new IllegalArgumentException("The passed node is not a Comment");
        }

        commonContent.setUniqueId(node.getId() == null ? null : node.getId().toString());

        return commonContent;
    }
200245
function (node) {
        var ownerDocument = node.ownerDocument,
            qualified = _gpfWebGetNamespaceAndName(this._nodeName);
        if (qualified) {
            return ownerDocument.createElementNS(qualified.namespace, qualified.name);
        }
        return ownerDocument.createElement(this._nodeName);
    }
727282
public void buildSignature(XMLNode node, Content annotationDocTree) {
        annotationDocTree.addContent(writer.getSignature(currentMember));
    }
383836
private JSDocInfo parseInlineTypeDoc(Comment node) {
    String comment = node.value;
    int lineno = lineno(node.location.start);
    int charno = charno(node.location.start);

    // The JsDocInfoParser expects the comment without the initial '/**'.
    int numOpeningChars = 3;
    JsDocInfoParser parser =
      new JsDocInfoParser(
          new JsDocTokenStream(comment.substring(numOpeningChars),
              lineno,
              charno + numOpeningChars),
          comment,
          node.location.start.offset,
          templateNode,
          config,
          errorReporter);
    return parser.parseInlineTypeDoc();
  }
934920
function(){
    var obj = new nodes.Object
      , id, val, comma, hash;
    this.expect('{');
    this.skipWhitespace();

    while (!this.accept('}')) {
      if (this.accept('comment')
        || this.accept('newline')) continue;

      if (!comma) this.accept(',');
      id = this.accept('ident') || this.accept('string');

      if (!id) {
        this.error('expected "ident" or "string", got {peek}');
      }

      hash = id.val.hash;

      this.skipSpacesAndComments();
      this.expect(':');

      val = this.expression();

      obj.setValue(hash, val);
      obj.setKey(hash, id.val);

      comma = this.accept(',');
      this.skipWhitespace();
    }

    return obj;
  }
1366183
public void buildMemberComments(XMLNode node, Content annotationDocTree) {
        if(! configuration.nocomment){
            writer.addComments((MemberDoc) members.get(currentMemberIndex),
                    annotationDocTree);
        }
    }
124244
function getCommentedClassNode(node) {
    if (node.type !== "ClassBody") {
        return null;
    }
    // look for a constructor() and then look for property tags which we can annotate with.
    var constructNode = null;
    for (var i = 0; i < node.body.length; i++) {
        if (node.body[i].kind === "constructor" && node.body[i].type === "MethodDefinition") {
            constructNode = node.body[i];
        }
    }

    if (!constructNode || !constructNode.leadingComments) {
        return null;
    }

    // check for @property JSDoc on the constructor
    var constructDocs = null;
    for (var i=0; i<constructNode.leadingComments.length; i++) {
        if (constructNode.leadingComments[i].type === "Block") {
            constructDocs = extractJsdoc(constructNode.leadingComments[i].value);
            break;
        }
    }
    return {
        node: node,
        jsdoc: constructDocs
    };
}
1320026
def comment(node):
    
    parent = node.parentNode
    comment = node.ownerDocument.createComment(node.toxml())
    parent.replaceChild(comment, node)
    return comment
1241327
public static Comment[] toCommentArray(Document doc, Object o) throws PageException {
	// Node[]
	if (o instanceof Node[]) {
	    Node[] nodes = (Node[]) o;
	    if (_isAllOfSameType(nodes, Node.COMMENT_NODE)) return (Comment[]) nodes;

	    Comment[] comments = new Comment[nodes.length];
	    for (int i = 0; i < nodes.length; i++) {
		comments[i] = toComment(doc, nodes[i]);
	    }
	    return comments;
	}
	// Collection
	else if (o instanceof Collection) {
	    Collection coll = (Collection) o;
	    Iterator<Object> it = coll.valueIterator();
	    List<Comment> comments = new ArrayList<Comment>();
	    while (it.hasNext()) {
		comments.add(toComment(doc, it.next()));
	    }
	    return comments.toArray(new Comment[comments.size()]);
	}
	// Node Map and List
	Node[] nodes = _toNodeArray(doc, o);
	if (nodes != null) return toCommentArray(doc, nodes);
	// Single Text Node
	try {
	    return new Comment[] { toComment(doc, o) };
	}
	catch (ExpressionException e) {
	    throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Comment Array");
	}
    }
1319206
public static CharSequence getNodeText(AccessibilityNodeInfoCompat node) {
        if (node == null) {
            return null;
        }

        // Prefer content description over text.
        // TODO: Why are we checking the trimmed length?
        final CharSequence contentDescription = node.getContentDescription();
        if (!TextUtils.isEmpty(contentDescription)
                && (TextUtils.getTrimmedLength(contentDescription) > 0)) {
            return contentDescription;
        }

        final CharSequence text = node.getText();
        if (!TextUtils.isEmpty(text)
                && (TextUtils.getTrimmedLength(text) > 0)) {
            return text;
        }

        return null;
    }
600404
private void removeCommentNodes(Document doc) {
        List<Node> toRemove = new ArrayList<>();
        NodeList children = doc.getChildNodes();
        for (int cn = 0; cn < children.getLength(); cn++) {
            Node child = children.item(cn);
            if (Node.COMMENT_NODE == child.getNodeType()) {
                toRemove.add(child);
            }
        }
        for (Node child : toRemove) {
            doc.removeChild(child);
        }
    }
867760
public static Node addPartitionsToNode(final Node node, final Set<Integer> donatedPartitions) {
        List<Integer> deepCopy = new ArrayList<Integer>(node.getPartitionIds());
        deepCopy.addAll(donatedPartitions);
        Collections.sort(deepCopy);
        return updateNode(node, deepCopy);
    }
1366862
public void buildSignature(XMLNode node, Content fieldDocTree) {
        fieldDocTree.addContent(
                writer.getSignature((FieldDoc) fields.get(currentFieldIndex)));
    }
1286199
public static KeyValueNode<?> transformMetaData(final CSNodeWrapper node) {
        return transformMetaData(node, new HashMap<Integer, Node>(), new HashMap<String, SpecTopic>(), new ArrayList<CSNodeWrapper>());
    }
258188
static public void displayNode(Node node) {
        try {
            TransformerFactory TF = TransformerFactory.newInstance();
              // Fortify Mod: disable external entity injection
            TF.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
            Transformer identity = TF.newTransformer();
		   // End Fortify Mod
            identity.transform(new DOMSource(node),
                    new StreamResult(System.out));
        } catch (Exception ex) {
            System.out.println("ERROR: " + ex.getMessage());
        }
    }
979280
protected static InfoTopic transformInfoTopic(final CSNodeWrapper parentNode, final CSInfoNodeWrapper node) {
        final InfoTopic infoTopic = new InfoTopic(node.getTopicId(), null);

        // Basic data
        infoTopic.setRevision(node.getTopicRevision());
        infoTopic.setConditionStatement(node.getCondition());
        infoTopic.setUniqueId(parentNode.getId() == null ? null : parentNode.getId().toString());

        return infoTopic;
    }
1175412
private Object fromNode(final ImmutableNode node) {
        if (!node.getChildren().isEmpty()) {
            final Map<String, List<ImmutableNode>> children = getChildrenWithName(node);

            final HashMap<String, Object> map = new HashMap<>();
            for (final Map.Entry<String, List<ImmutableNode>> entry : children.entrySet()) {
                assert !entry.getValue().isEmpty();
                if (entry.getValue().size() == 1) {
                    // Just one node.
                    final ImmutableNode child = entry.getValue().get(0);
                    final Object childValue = fromNode(child);
                    map.put(entry.getKey(), childValue);
                } else {
                    // Multiple nodes.
                    final ArrayList<Object> list = new ArrayList<>();
                    for (final ImmutableNode child : entry.getValue()) {
                        final Object childValue = fromNode(child);
                        list.add(childValue);
                    }
                    map.put(entry.getKey(), list);
                }
            }
            return map;
        } else {
            return node.getValue();
        }
    }