Constructor

@param str text The contents of the tag
@param str[] data Reference to doc comment data array
@param RootDoc root The root object
349000
public function linkTag($text, &$data, &$root)
    {
        parent::linkPlainTag($text, $data, $root);
        $this->_name = '@link';
    }
960956
private void saveSummaryXml(SampleNode root) {

        root.sortTree();
        Document doc = DocumentHelper.createDocument();
        Element rootElem = doc.addElement("root");
        root.appendToXml(rootElem);
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        outformat.setEncoding("UTF-8");
        try {
            XMLWriter writer = new XMLWriter(buffer, outformat);
            writer.write(doc);
            writer.flush();
            try (FileOutputStream fos = new FileOutputStream(m_summaryFilename)) {
                fos.write(buffer.toByteArray());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
1362574
function xmlparse(xml) {
	xml = xml.trim();

	// strip comments
	xml = xml.replace(/<!--[\s\S]*?-->/g, '');

	return document();

	/**
	 * XML document.
	 */

	function document() {
		return {
			declaration: declaration(),
			root: tag(),
		};
	}

	/**
	 * Declaration.
	 */

	function declaration() {
		var m = match(/^<\?xml\s*/);
		if (!m) return;

		// tag
		var node = {
			attributes: {},
		};

		// attributes
		while (!(eos() || is('?>'))) {
			var attr = attribute();
			if (!attr) return node;
			node.attributes[attr.name] = attr.value;
		}

		match(/\?>\s*/);

		return node;
	}

	/**
	 * Tag.
	 */

	function tag() {
		var m = match(/^<([\w-:.]+)\s*/);
		if (!m) return;

		// name
		var node = {
			name: m[1],
			attributes: {},
			children: [],
		};

		// attributes
		while (!(eos() || is('>') || is('?>') || is('/>'))) {
			var attr = attribute();
			if (!attr) return node;
			node.attributes[attr.name] = attr.value;
		}

		// self closing tag
		if (match(/^\s*\/>\s*/)) {
			return node;
		}

		match(/\??>\s*/);

		// content
		node.content = content();

		// children
		var child;
		while ((child = tag())) {
			node.children.push(child);
		}

		// closing
		match(/^<\/[\w-:.]+>\s*/);

		return node;
	}

	/**
	 * Text content.
	 */

	function content() {
		var m = match(/^([^<]*)/);
		if (m) return m[1];
		return '';
	}

	/**
	 * Attribute.
	 */

	function attribute() {
		var m = match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);
		if (!m) return;
		return {name: m[1], value: strip(m[2])};
	}

	/**
	 * Strip quotes from `val`.
	 */

	function strip(val) {
		return val.replace(/^['"]|['"]$/g, '');
	}

	/**
	 * Match `re` and advance the string.
	 */

	function match(re) {
		var m = xml.match(re);
		if (!m) return;
		xml = xml.slice(m[0].length);
		return m;
	}

	/**
	 * End-of-source.
	 */

	function eos() {
		return 0 == xml.length;
	}

	/**
	 * Check for `prefix`.
	 */

	function is(prefix) {
		return 0 == xml.indexOf(prefix);
	}
}
449149
public void setNodeText(Node n, String text) {
        if (n == null)
            return;
        Node nc = null;
        while ((nc = n.getFirstChild()) != null) {
            n.removeChild(nc);
        }
        if (n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode") != null)
            n.getAttributes().removeNamedItemNS(XFA_DATA_SCHEMA, "dataNode");
        n.appendChild(domDocument.createTextNode(text));
        changed = true;
    }
518800
public static Text[] toTextArray(Document doc, Object o) throws PageException {
	// Node[]
	if (o instanceof Node[]) {
	    Node[] nodes = (Node[]) o;
	    if (_isAllOfSameType(nodes, Node.TEXT_NODE)) return (Text[]) nodes;

	    Text[] textes = new Text[nodes.length];
	    for (int i = 0; i < nodes.length; i++) {
		textes[i] = toText(doc, nodes[i]);
	    }
	    return textes;
	}
	// Collection
	else if (o instanceof Collection) {
	    Collection coll = (Collection) o;
	    Iterator<Object> it = coll.valueIterator();
	    List<Text> textes = new ArrayList<Text>();
	    while (it.hasNext()) {
		textes.add(toText(doc, it.next()));
	    }
	    return textes.toArray(new Text[textes.size()]);
	}
	// Node Map and List
	Node[] nodes = _toNodeArray(doc, o);
	if (nodes != null) return toTextArray(doc, nodes);
	// Single Text Node
	try {
	    return new Text[] { toText(doc, o) };
	}
	catch (ExpressionException e) {
	    throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Text Array");
	}
    }
913760
@SuppressWarnings({"unused"})
	private void doTreeTagOld(JCas jcas) {
		File tmpDocument = null;
		BufferedWriter tmpFileWriter;
		ArrayList<Token> tokens = new ArrayList<Token>();
		
		try {
			// create a temporary file and write our pre-existing tokens to it.
			tmpDocument = File.createTempFile("postokens", null);
			tmpFileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmpDocument), "UTF-8"));

			// iterate over existing tokens
			FSIterator ai = jcas.getAnnotationIndex(Token.type).iterator();
			while(ai.hasNext()) {
				Token t = (Token) ai.next();
				
				tokens.add(t);
				if (!(t.getBegin() == t.getEnd())){
					tmpFileWriter.write(t.getCoveredText() + ttprops.newLineSeparator);
				}
			}
			
			tmpFileWriter.close();
		} catch(IOException e) {
			Logger.printError("Something went wrong creating a temporary file for the treetagger to process.");
			System.exit(-1);
		}

		// Possible End-of-Sentence Tags
		HashSet<String> hsEndOfSentenceTag = new HashSet<String>();
		hsEndOfSentenceTag.add("SENT");   // ENGLISH, FRENCH, GREEK, 
		hsEndOfSentenceTag.add("$.");     // GERMAN, DUTCH
		hsEndOfSentenceTag.add("FS");     // SPANISH
		hsEndOfSentenceTag.add("_Z_Fst"); // ESTONIAN
		hsEndOfSentenceTag.add("_Z_Int"); // ESTONIAN
		hsEndOfSentenceTag.add("_Z_Exc"); // ESTONIAN
		hsEndOfSentenceTag.add("ew"); // CHINESE
		
		try {
			Process p = ttprops.getTreeTaggingProcess(tmpDocument);
			Logger.printDetail(component, "TreeTagger (pos tagging) with: " + ttprops.parFileName);
				
			BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream(), "UTF-8"));
			
			Sentence sentence = null;
			// iterate over all the output lines and tokens array (which have the same source and are hence symmetric)
			int i = 0;
			String s = null;
			while ((s = in.readLine()) != null) {
				// grab a token
				Token token = tokens.get(i++);
				// modified (Aug 29, 2011): Handle empty tokens (such as empty lines) in input file
				while (token.getCoveredText().equals("")){
					// if part of the configuration, also add sentences to the jcas document
					if ((annotate_sentences) && (token.getPos() != null && token.getPos().equals("EMPTYLINE"))) {
						// Establish sentence structure
						if (sentence == null) {
							sentence = new Sentence(jcas);
							sentence.setBegin(token.getBegin());
						}
		
						// Finish current sentence if end-of-sentence pos was found or document ended
						sentence.setEnd(token.getEnd());
						if (sentence.getBegin() < sentence.getEnd()){
							sentence.addToIndexes();
						}
						
						// Make sure current sentence is not active anymore so that a new one might be created
						sentence = null;
//						sentence = new Sentence(jcas);
					}
					token.removeFromIndexes();
					token = tokens.get(i++);
				}
				// remove tokens, otherwise they are in the index twice
				token.removeFromIndexes(); 
				// set part of speech tag and add to indexes again
				if (!(token.getCoveredText().equals(""))){
					token.setPos(s);
					token.addToIndexes();
				}
				
				// if part of the configuration, also add sentences to the jcas document
				if(annotate_sentences) {
					// Establish sentence structure
					if (sentence == null) {
						sentence = new Sentence(jcas);
						sentence.setBegin(token.getBegin());
					}
	
					// Finish current sentence if end-of-sentence pos was found or document ended
					if (hsEndOfSentenceTag.contains(s) || i == tokens.size()) {
						sentence.setEnd(token.getEnd());
						sentence.addToIndexes();
						
						// Make sure current sentence is not active anymore so that a new one might be created
						sentence = null;
					}
				}
			}
			while (i < tokens.size()){
				if (!(sentence == null)){
					sentence.setEnd(tokens.get(tokens.size()-1).getEnd());
					sentence.addToIndexes();
				}
				Token token = tokens.get(i++);
				if (token.getPos() != null && token.getPos().equals("EMPTYLINE")){
					token.removeFromIndexes();
				}
			}
			in.close();
			p.destroy();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			// Delete temporary files
			tmpDocument.delete();
		}
	}
1200535
public Xml addContent(String text) {
        if(current == null) {
            throw new XmlModelException("Content can not be attached as root element: " + text);
        }
        Content content = new Content(text);
        content.setParent(current);
        current.addChildElement(content);
        return this;
    }
151086
public void buildFieldComments(XMLNode node, Content fieldDocTree) {
        if (!configuration.nocomment) {
            writer.addComments((FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
        }
    }
146916
public void buildMethodComments(XMLNode node, Content methodDocTree) {
        if (!configuration.nocomment) {
            MethodDoc method = (MethodDoc) methods.get(currentMethodIndex);

            if (method.inlineTags().length == 0) {
                DocFinder.Output docs = DocFinder.search(configuration,
                        new DocFinder.Input(method));
                method = docs.inlineTags != null && docs.inlineTags.length > 0 ?
                    (MethodDoc) docs.holder : method;
            }
            //NOTE:  When we fix the bug where ClassDoc.interfaceTypes() does
            //       not pass all implemented interfaces, holder will be the
            //       interface type.  For now, it is really the erasure.
            writer.addComments(method.containingClass(), method, methodDocTree);
        }
    }
1248221
function(str, lex) {
    if (lex) {
      w2.plugin({
        words: lex
      });
    }
    let doc = buildText(str, w2);
    doc.tagger();
    return doc;
  }
128059
private Element addRoot(Document document,
			Map<ReportBuilderImpl.ReportKey, Object> reportsData) {
		Element rootElement = document.createElement("project");
		if (reportsData.containsKey(ReportKey.PROJECT_NAME)) {
			rootElement.setAttribute("name",
					(String) reportsData.get(ReportKey.PROJECT_NAME));
		}
		document.appendChild(rootElement);
		return rootElement;
	}
499774
public function _buildTree(&$rootDoc, &$class, $depth = NULL)
    {
        if ($depth === NULL) {
            $start = TRUE;
            $depth = 0;
        } else {
            $start = FALSE;
        }
        $output = '';
        $undefinedClass = FALSE;
        if ($class->superclass()) {
            $superclass =& $rootDoc->classNamed($class->superclass());
            if ($superclass) {
                $result = $this->_buildTree($rootDoc, $superclass, $depth);
                $output .= $result[0];
                $depth = ++$result[1];
            } else {
                $output .= $class->superclass().'<br>';
                $output .= str_repeat('   ', $depth).' └─';
                $depth++;
                $undefinedClass = TRUE;
            }
        }
        if ($depth > 0 && !$undefinedClass) {
            $output .= str_repeat('   ', $depth).' └─';
        }
        if ($start) {
            $output .= '<strong>'.$class->name().'</strong><br />';
        } else {
            $output .= '<a href="'.str_repeat('../', $this->_depth).$class->asPath().'">'.$class->name().'</a><br>';
        }

        return array($output, $depth);
    }
173484
public static void addListener(Document doc, Element root) {
    Element listener = doc.createElement("listener");
    Element listenerClass = doc.createElement("listener-class");
    listener.appendChild(listenerClass);
    listenerClass.appendChild(doc
        .createTextNode("org.apache.shiro.web.env.EnvironmentLoaderListener"));

    addRelativeTo(root, listener, "listener", true);
  }
83417
private function __extractDocString($DocComment, $lines = null, $parse_tags = false)
    {
        $split = preg_split("/\r\n|\n|\r/", $DocComment);

        //clean up: removes useless chars like new-lines, tabs and *
        $_tmp = array();
        $_l=1;
        foreach ($split as $id => $row) {
            $_row = trim($row, "* /\n\t\r");
            if (!empty($_row) AND $_row[0]!='@') {
                $_tmp[$_l] = $_row;
                $_l++;
            }
        }           

        if (!empty($lines)) {
            if (is_numeric($lines)) {
                if (!isset($_tmp[ $lines ])) return '';
                $_tmp = array( $_tmp[ $lines ] );
            } elseif (is_array($lines)) {
                if (!empty($lines[1]))
                    $_tmp = array_slice($_tmp, array_search( $_tmp[ $lines[0] ], $_tmp)-1, $lines[1]);
                else
                    $_tmp = array_slice($_tmp, array_search( $_tmp[ $lines[0] ], $_tmp)-1 );
            }
        }

        return trim(implode("\n",$_tmp));
    }
12868
function Doclet(comment) {

			this.comment = comment = unwrap(comment);
			this.tags = [];

			var m;
			var lastContent = 0;
			var lastTag = "description";
			while ((m = rtag.exec(comment)) != null) {
				this._addTag(lastTag, comment.slice(lastContent, m.index));
				lastTag = m[2];
				lastContent = rtag.lastIndex;
			}
			this._addTag(lastTag, comment.slice(lastContent));
		}
1154680
public static void setElementContent(final Node n,
                                       final String s) throws SAXException {
    NodeList children = n.getChildNodes();

    for (int i = 0; i < children.getLength(); i++) {
      Node curnode = children.item(i);

      n.removeChild(curnode);
    }

    Document d = n.getOwnerDocument();

    final Node textNode = d.createTextNode(s);

    n.appendChild(textNode);
  }
1032455
public void comment(char[] ch, int start, int length)
        throws SAXException     {
        String commentText = new String(ch, start, length);
        trace("comment:" + commentText);
        Comment comment = currentDocument.createComment(commentText);
        appendNode(comment);
    }