Мне нужно установить xml значения элементов динамически. Я почти закончил, но мне нужно добавить условие как указано в c часть, и это не работает. У меня есть один компонентный тег, и внутри него есть 2 раздела, первый имеет код = "62387-6", а второй имеет код = "47045-0". Мне нужно добавить специфицированный c заголовок и текст в каждом из них.
То, что я пробовал, это:
(Declared)
Private _titleReferto As String = "Title Referto"
Private _testoReferto As String = "Testo Referto"
Private _titlePrestazione As String = "Title Prestazione"
Private _testoPrestazione As String = "Testo Prestazione"
(In the function that I invoke)
Me.setXmlValue(rootNode, Me._titleReferto, "//cr:component/cr:structuredBody/cr:component/cr:section/cr:code[@code='47045-0']/cr:title", NS)
Me.setXmlValue(rootNode, Me._testoReferto, "//cr:component/cr:structuredBody/cr:component/cr:section[code/@code='" + "47045-0" + "']/cr:text", NS)
Me.setXmlValue(rootNode, Me._titlePrestazione, "//cr:component/cr:structuredBody/cr:component/cr:section[code/@code='" + "62387-6" + "']/cr:title", NS)
Me.setXmlValue(rootNode, Me._testoPrestazione, "//cr:component/cr:structuredBody/cr:component/cr:section[code/@code='" + "62387-6" + "']/cr:text", NS)
Вот как мне нужно быть xml:
<component>
<structuredBody>
<component>
<section>
<code code="62387-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" codeSystemVersion="2.64" displayName="Interventi" /> <!-- OBBL-->
<title> Title Prestazione </title> <!-- OBBL-->
<text> <!-- OBBL-->
<paragraph>
<caption>Testo Prestazione</caption>
</paragraph>
</text>
</section>
</component>
<component>
<section>
<code code="47045-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" codeSystemVersion="2.64" displayName="Referto" /> <!-- OBBL-->
<title> Title Referto </title> <!-- OBBL-->
<text> <!-- OBBL-->
<paragraph>
Testo Referto
</paragraph>
</text>
</section>
</component>
</structuredBody>
</component>