在c#中使用后代方法修改节点值?

在c#中使用后代方法修改节点值?,c#,linq-to-xml,C#,Linq To Xml,如何使用子体方法将节点的内容从一个文件替换到另一个文件。 我试过了 XDocument refFile = Xdocument.Load(@"D:\MyPrjocets\Data\dt.xml"); var content = (from v in refFile.Descendants("lbl") select v).First().Value; XDocument fil

如何使用子体方法将节点的内容从一个文件替换到另一个文件。 我试过了

XDocument refFile = Xdocument.Load(@"D:\MyPrjocets\Data\dt.xml");
                var content = (from v in refFile.Descendants("lbl")
                            select v).First().Value;
                XDocument file2modify = Xdocument.Load(@"D:\14.10.2017\xyz.xml");
                file2modify.Descendants("label").First().SetElementValue("label",content);
                file2modify.Save(@"D:\14.10.2017\xyz.xml");
但是数据会像
(1)A.
那样被修改,在这里它应该像
A.
一样,也就是说,它附加到节点上,而不是用新的值删除以前的值。我该如何解决这个问题? REF文件的结构类似于

    <?xml version="1.0" encoding="utf-8"?>
    <metadata>
      <abstract>
        <lbl>A.</lbl>
        <p>Ram is a good boy</p>
        <doi-x>10.14/10.317.1</doi-x>
        <author type="address">
          <Street>7A Cox Street</Street>
          <City>Acampo</City>
          <State>CA</State>
          <Zip>95220</Zip>
          <Country>USA</Country>
        </author>
........ .........
      </abstract>
    </metadata>

A.
拉姆是个好孩子

10.14/10.317.1 考克斯街7A号 阿坎波 加利福尼亚州 95220 美国 ........ .........
而file2modify就像

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN"
"journalpublishing3.dtd">
<article
article-type="research-article"
dtd-version="3.0" xml:lang="en"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<front>
<journal-meta>
<journal-id journal-id-type="pmc">pnas</journal-id>
<journal-id journal-id-type="pubmed">Proc Natl Acad Sci U S A</journal-id>
<journal-id journal-id-type="publisher">PNAS</journal-id>
<issn>0027-8424</issn>
<publisher>
<publisher-name>The National Academy of Sciences</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="publisher-id">181325198</article-id>
<article-id pub-id-type="publisher-id">3251</article-id>
<article-id pub-id-type="doi">10.1073/pnas.181325198</article-id>
<title-group>
<article-title>The coreceptor mutation CCR5&#x0394;32 influences the dynamics of HIV epidemics and is selected for by HIV</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<name>
<surname>Sullivan</surname>
<given-names>Amy D.</given-names>
</name>
<xref ref-type="author-notes" rid="FN150">&#x002A;</xref>
</contrib>
<contrib contrib-type="author">
<name>
<surname>Wigginton</surname>
<given-names>Janis</given-names>
</name>
</contrib>
</contrib-group>
<aff>Department of Microbiology and Immunology, University of Michigan Medical School, Ann Arbor, MI 48109-0620</aff>
<author-notes>
<fn id="FN150">
<p>&#x002A; Present address: Centers for Disease Control and Prevention Epidemiology Program Office, State Branch Oregon Health Division, 800 NE Oregon Street, Suite 772, Portland, OR 97232.</p>
</fn>
<fn fn-type="com">
<p>Communicated by Avner Friedman, University of Minnesota, Minneapolis, MN</p>
</fn>
</author-notes>
<pub-date pub-type="pub">
<day>28</day>
<month>8</month>
<year>2001</year>
</pub-date>
<pub-date pub-type="epub">
<day>21</day>
<month>8</month>
<year>2001</year>
</pub-date>
<volume>98</volume>
<issue>18</issue>
<fpage>10214</fpage>
<lpage>10219</lpage>
<history>
<date date-type="received">
<day>30</day>
<month>5</month>
<year>2000</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#x00A9; 2001, The National Academy of Sciences</copyright-statement>
<copyright-year>2001</copyright-year>
</permissions>
<abstract>
<label>(1)</label>
<p>We explore the impact of a host genetic factor on heterosexual HIV epidemics by using a deterministic mathematical model. A protective allele unequally distributed across populations is exemplified in our models by the 32-bp deletion in the host-cell chemokine receptor CCR5, CCR5&#x0394;32. Individuals homozygous for CCR5&#x0394;32 are protected against HIV infection whereas those heterozygous for CCR5&#x0394;32 have lower pre-AIDS viral loads and delayed progression to AIDS. CCR5&#x0394;32 may limit HIV spread by decreasing the probability of both risk of infection and infectiousness. In this work, we characterize epidemic HIV within three dynamic subpopulations: CCR5&#x002F;CCR5 (homozygous, wild type), CCR5&#x002F;CCR5&#x0394;32 (heterozygous), and CCR5&#x0394;32&#x002F;CCR5&#x0394;32 (homozygous, mutant). Our results indicate that prevalence of HIV&#x002F;AIDS is greater in populations lacking the CCR5&#x0394;32 alleles (homozygous wild types only) as compared with populations that include people heterozygous or homozygous for CCR5&#x0394;32. Also, we show that HIV can provide selective pressure for CCR5&#x0394;32, increasing the frequency of this allele.</p>
</abstract>
<counts>
<fig-count count="15"/>
<table-count count="11"/>
<equation-count count="5"/>
<page-count count="1"/>
</counts>
</article-meta>
</front>
<body>
<p>Nineteen million people have died of AIDS since the discovery of HIV in the 1980s. In 1999 alone, 5.4 million people were newly infected with HIV (ref. <xref ref-type="bibr" rid="B1">1</xref> and <ext-link ext-link-type="url" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.unaids.org/epidemicupdate/report/Epireport.html">http://www.unaids.org/epidemicupdate/report/Epireport.html</ext-link>). (For brevity, HIV-1 is referred to as HIV in this paper.) Sub-Saharan Africa has been hardest hit, with more than 20&#x0025; of the general population HIV-positive in some countries (<xref ref-type="bibr" rid="B2">2</xref>, <xref ref-type="bibr" rid="B3">3</xref>). In comparison, heterosexual epidemics in developed, market-economy countries have not reached such severe levels. Factors contributing to the severity of the epidemic in economically developing countries abound, including economic, health, and social differences such as high levels of sexually transmitted diseases and a lack of prevention programs. However, the staggering rate at which the epidemic has spread in sub-Saharan Africa has not been adequately explained. The rate and severity of this epidemic also could indicate a greater underlying susceptibility to HIV attributable not only to sexually transmitted disease, economics, etc., but also to other more ubiquitous factors such as host genetics (<xref ref-type="bibr" rid="B4">4</xref>, <xref ref-type="bibr" rid="B5">5</xref>).</p>
<p>To exemplify the contribution of such a host genetic factor to HIV prevalence trends, we consider a well-characterized 32-bp deletion in the host-cell chemokine receptor CCR5, CCR5&#x0394;32. When HIV binds to host cells, it uses the CD4 receptor on the surface of host immune cells together with a coreceptor, mainly the CCR5 and CXCR4 chemokine receptors (<xref ref-type="bibr" rid="B6">6</xref>). Homozygous mutations for this 32-bp deletion offer almost complete protection from HIV infection, and heterozygous mutations are associated with lower pre-AIDS viral loads and delayed progression to AIDS (<xref ref-type="bibr" rid="B7">7</xref>&#x2013;<xref ref-type="bibr" rid="B14">14</xref>). CCR5&#x0394;32 generally is found in populations of European descent, with allelic frequencies ranging from 0 to 0.29 (<xref ref-type="bibr" rid="B13">13</xref>). African and Asian populations studied outside the United States or Europe appear to lack the CCR5&#x0394;32 allele, with an allelic frequency of almost zero (<xref ref-type="bibr" rid="B5">5</xref>, <xref ref-type="bibr" rid="B13">13</xref>). Thus, to understand the effects of a protective allele, we use a mathematical model to track prevalence of HIV in populations with or without CCR5&#x0394;32 heterozygous and homozygous people and also to follow the CCR5&#x0394;32 allelic frequency
<fig id="fig1">
<caption><p>HD tv</p></caption>
</fig>.</p>
<p>We hypothesize that CCR5&#x0394;32 limits epidemic HIV by decreasing infection rates, and we evaluate the relative contributions to this by the probability of infection and duration of infectivity. To capture HIV infection as a chronic infectious disease together with vertical transmission occurring in untreated mothers, we model a dynamic population (i.e., populations that vary in growth rates because of fluctuations in birth or death rates) based on realistic demographic characteristics (<xref ref-type="bibr" rid="B18">18</xref>). This scenario also allows tracking of the allelic frequencies over time. This work considers how a specific host genetic factor affecting HIV infectivity and viremia at the individual level might influence the epidemic in a dynamic population and how HIV exerts selective pressure, altering the frequency of this mutant allele.</p>
</body>
</article>

pnas
美国科学院学报
PNAS
0027-8424
国家科学院
181325198
3251
10.1073/pnas.181325198
共受体突变CCR5和x0394;32影响艾滋病毒流行的动态,并被艾滋病毒选中
沙利文
艾米·D。
*;
威金顿
贾尼斯
密歇根大学医学院微生物学与免疫学系,安娜堡,MI8109-0620
*;目前地址:波特兰东北俄勒冈州街800号772室俄勒冈州卫生部疾病控制和预防中心流行病学项目办公室,或97232

Avner Friedman,明尼苏达大学,明尼阿波利斯,MN/P> 28 8. 2001 21 8. 2001 98 18 10214 10219 30 5. 2000 版权所有©;2001年,国家科学院 2001 (1) 我们使用确定性数学模型探讨宿主遗传因素对异性恋艾滋病毒流行的影响。在我们的模型中,宿主细胞趋化因子受体CCR5、CCR5和#x0394中的32 bp缺失说明了一种保护性等位基因在人群中的不均匀分布;32CCR5和x0394纯合的个体;32株抗HIV感染,而CCR5和x0394杂合子;32人的艾滋病前期病毒载量较低,并延迟了向艾滋病的进展。CCR5和x0394;32可能通过降低感染风险和传染性来限制艾滋病毒的传播。在这项工作中,我们在三个动态亚群体中描述了流行性HIV:CCR5和x002F;CCR5(纯合子,野生型),CCR5/;CCR5和x0394;32(杂合子)和CCR5Δ;32/;CCR5和x0394;32(纯合子,突变型)。我们的结果表明,HIV的流行率/;缺乏CCR5Δ;32个等位基因(仅纯合野生型),与包括CCR5和#x0394杂合或纯合人群的人群相比;32此外,我们还表明HIV可以为CCR5和x0394提供选择性压力;32,增加该等位基因的频率

自从1980年代发现艾滋病毒以来,已有1900万人死于艾滋病。仅在1999年,就有540万人新感染了艾滋病毒(参考文献1和2)http://www.unaids.org/epidemicupdate/report/Epireport.html). (为简洁起见,本文将HIV-1称为HIV。)撒哈拉以南非洲地区受到的打击最为严重,有20多人感染;在一些国家的普通人群中,艾滋病毒呈阳性(2、3)。相比之下,发达市场经济国家的异性恋流行还没有达到如此严重的程度。在经济发展中的国家,导致该流行病严重性的因素很多,包括经济、健康和社会差异,如性传播疾病的高水平和缺乏预防计划。然而,这一流行病在撒哈拉以南非洲蔓延的惊人速度尚未得到充分解释。这一流行病的发生率和严重程度也可能表明更易感染艾滋病毒,这不仅归因于性传播疾病、经济等,还归因于其他更普遍的因素,如宿主遗传学(4,5)

为了说明这种宿主遗传因素对HIV流行趋势的贡献,我们认为在宿主细胞趋化因子受体CCR5、CCR5和XX044中有一个特征性的32 bp缺失;32当HIV与宿主细胞结合时,它使用宿主免疫细胞表面的CD4受体和一个共同受体,主要是CCR5和CXCR4趋化因子受体(6)。这种32 bp缺失的纯合子突变几乎可以完全防止艾滋病毒感染,而杂合子突变与较低的艾滋病前病毒载量和艾滋病进展延迟相关(7–;14)。CCR5和x0394;32通常存在于欧洲血统的人群中,等位基因频率在0到0.29之间(13)。在美国或欧洲以外研究的非洲和亚洲人口似乎缺乏CCR5和x0394;32个等位基因,等位基因频率几乎为零(5,13)。因此,为了了解保护性等位基因的作用,我们使用数学模型跟踪有或没有CCR5Δ;32个杂合子和纯合子人群,也遵循CCR5和x0394;32等位基因频率 高清电视

我们假设CCR5和x0394;32通过降低感染率来限制流行性艾滋病毒,我们通过感染概率和感染持续时间来评估相对贡献。为了将艾滋病毒感染作为一种慢性传染病与未经治疗的母亲中发生的垂直传播相结合,我们根据现实的人口特征对动态人口(即由于出生率或死亡率波动而增长率不同的人口)进行建模(18)。这种情况也允许跟踪随时间变化的等位基因频率。这项工作考虑了在个体水平上影响艾滋病毒感染性和病毒血症的特定宿主遗传因素如何影响动态人群中的流行,以及艾滋病毒如何施加选择压力,改变这种突变等位基因的频率


您只需更新
XElement.Value
属性即可:

...
file2modify.Descendants("label").First().Value = content;
file2modify.Save(@"D:\14.10.2017\xyz.xml");

您只需更新
XElement.Value
属性即可:

...
file2modify.Descendants("label").First().Value = content;
file2modify.Save(@"D:\14.10.2017\xyz.xml");

谢谢你的回复。顺便问一下,如何为
后代定义
祖先