이제 XML 파일이 있고 섹션 레벨 속성 (특히 두 번째 또는 세 번째 레벨)을 수정해야합니다. 예를 들어 :두 번째 또는 세 번째 레벨 섹션 요소에서 조건이 일치하는 경우 속성 값 변경
는입력 :
<?xml version="1.0"?>
<article>
<front></front>
<body>
<sec id="sec1">
<title>1. Introduction</title><p>The cerebrospinal venous system has been the focus of many studies in the last few years, because of the hypothesized involvement of insufficient extracranial venous drainage in central nervous system disorders such as multiple sclerosis, normal-pressure hydrocephalus, and transient monocular blindness [<xref ref-type="bibr" rid="B1">1</xref>–<xref ref-type="bibr" rid="B4">4</xref>]. An insufficiency in venous blood drainage can be due to the presence of single or multiple stenosis on the main routes of cerebrospinal venous system [<xref ref-type="bibr" rid="B5">5</xref>].</p>
<sec id="sec1.1">
<title>Section level 2</title>
<p><def-list><def-item><term>term I:</term><def><p>defintion I</p></def></def-item><def-item><term>term 2:</term><def><p>defintion 2</p></def></def-item></def-list>In the past years, great efforts have been made to develop excellent algorithms and tools for the processing and analyzing of traditional BS-Seq data [<xref ref-type="bibr" rid="B7">7</xref>–<xref ref-type="bibr" rid="B10">10</xref>] but none for hairpin-BS-Seq data. In this study, we designed and implemented HBS-tools and compared them against other state-of-the-art mapping tools. Our result indicated that HBS-tools have a reduced mapping time and improved mapping efficiency.</p>
</sec>
</sec></body>
</article>
는 두 번째 또는 세 번째 레벨 섹션 요소 내가 특정 섹션 수준 att1="deflist"
에 대한 속성을 삽입해야 다음 DEF-목록을 선행합니다.
예상 출력 :
이<?xml version="1.0"?>
<article>
<front></front>
<body>
<sec id="sec1">
<title>1. Introduction</title><p>The cerebrospinal venous system has been the focus of many studies in the last few years, because of the hypothesized involvement of insufficient extracranial venous drainage in central nervous system disorders such as multiple sclerosis, normal-pressure hydrocephalus, and transient monocular blindness [<xref ref-type="bibr" rid="B1">1</xref>–<xref ref-type="bibr" rid="B4">4</xref>]. An insufficiency in venous blood drainage can be due to the presence of single or multiple stenosis on the main routes of cerebrospinal venous system [<xref ref-type="bibr" rid="B5">5</xref>].</p>
<sec id="sec1.1" att1="deflist">
<title>Section level 2</title>
<p><def-list><def-item><term>term I:</term><def><p>defintion I</p></def></def-item><def-item><term>term 2:</term><def><p>defintion 2</p></def></def-item></def-list>In the past years, great efforts have been made to develop excellent algorithms and tools for the processing and analyzing of traditional BS-Seq data [<xref ref-type="bibr" rid="B7">7</xref>–<xref ref-type="bibr" rid="B10">10</xref>] but none for hairpin-BS-Seq data. In this study, we designed and implemented HBS-tools and compared them against other state-of-the-art mapping tools. Our result indicated that HBS-tools have a reduced mapping time and improved mapping efficiency.</p>
</sec>
</sec></body>
</article>
MyCode : 더러운 코드에 대한
use strict;
use warnings;
use XML::Twig;
my $t= XML::Twig->new(twig_handlers =>
{ 'sec/section/def-list' => \&Check_deflist }
)
->parsefile('input.xml');
sub Check_deflist
{ }
사과가 ... 누군가가이 일에 저를 도울 수하고 감상 할 수있다.
XML과 xpath 표현식이 일치하지 않습니다. 당신은 각각'sec'와'section'을 가지고 있습니다. 더러운 코드에 대해 사과하는 대신 [편집] 할 수 있고 적어도 복사하고 붙여 넣을 수있는'DATA' 섹션을 가진 완전한 예제를 제공 할 수 있습니다. 아직 해결하지 않으셨습니까? – simbabque