![](/img/trans.png)
[英]Annotating tree nodes with data for analysis with the Java Evolutionary Biology Library (JEBL)
[英]using java for XML data set in biology
我用Java编写了一个代码,用于解析要使用的xml文件。 现在我有问题。 我的数据集是AIMed,是这样的:
<passage>
<text>
Isolation of human delta-catenin and its binding specificity with presenilin 1.
We screened proteins for interaction with presenilin (PS) 1, and cloned the full-length cDNA of human delta-catenin, which encoded 1225 amino acids.
Yeast two-hybrid assay, GST binding assay and immunoprecipitation demonstrated that delta-catenin interacted with a hydrophilic loop region in the endoproteolytic C-terminal fragment of PS1, but not with that of PS-2.
These results suggest that PS1 and PS2 partly differ in function.
PS1 loop fragment containing the pathogenic mutation retained the binding ability.
We also found another armadillo-protein, p0071, interacted with PS1.
</text>
<annotation id="T1">
<infon key="file">ann</infon>
<infon key="type">protein</infon>
<location offset="19" length="13"></location>
<text>delta-catenin</text>
</annotation>
<relation id="R3">
<infon key="relation type">Interaction</infon>
<infon key="file">ann</infon>
<infon key="type">Relation</infon>
<node refid="T5" role="Arg1"></node>
<node refid="T6" role="Arg2"></node>
</relation>
</passage>
我正在使用SAXParser
,我的代码是这样的(用于文本标签):
else if (bText)
{
System.out.println("Text: "
+ new String(ch, start, length));
bText = false;
}
但它仅显示两个句子。 我的问题是如何解决?
遍历NodeList中的节点,直到找到相应的节点,将其转换为元素(在您的情况下为文本),然后使用element.getTextContent()。 为其查看Interface Node ,并认为它还将返回节点后代的文本(如果存在)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.