Groups | Blog | Home
all groups > dotnet xml > august 2003 >

dotnet xml : Add new element in the text of another element


Dave
8/12/2003 4:56:25 PM
Hi,

I have an xml file which looks sort of like this:

<Drugs>
<Drug>
<Name>Losartan Potassium</Name>
<Indications>Antihypertensive</Indications>
<SideEffects>BP Change, GI Distress, etc</SideEffects>
<Warninigs>Dizziness, insomnia, cough, URI, anemia</Warnings>
<Drug>
</Drugs>

What I need to do is to search for specific text strings (from a
glossary) within a few of the elements and convert it to something
like this:

<Drugs>
<Drug>
<Name>Losartan Potassium</Name>
<Indications>Antihypertensive</Indications>
<SideEffects>BP Change, <term id="241">GI Distress</term>,
etc</SideEffects>
<Warninigs><term id="7">Dizziness</term>, insomnia, cough,
URI, anemia</Warnings>
<Drug>
</Drugs>

I've tried a couple of things that haven't gotten me anywhere. Can
somebody point me in the right direction?

Thanks,
Dave
Knute Hestness
8/13/2003 3:32:27 PM
I would try breaking out the warnings elements like so:
<Drugs>
<Drug>
<Name>Losartan Potassium</Name>
<Indications>Antihypertensive</Indications>
<SideEffects>BP Change, <term id="241">GI
Distress</term>,
etc</SideEffects>
<Warninigs><warn id="7">Dizziness</warn>,
<warn>insomnia</warm><warn>cough</warn><warn>URI</warn>
<warn>anemia</warn></Warnings>
<Drug>
</Drugs>

Then when you pass it back just search for specific
warnings and create a new master document that has
glossary explanations for each <warn/> tag.

Just an idea.

Knute

[quoted text, click to view]
AddThis Social Bookmark Button