473,473 Members | 1,906 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add new element in the text of another element

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

Nov 11 '05 #1
1 1278
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
-----Original Message-----
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 aglossary) within a few of the elements and convert it to somethinglike 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. Cansomebody point me in the right direction?

Thanks,
Dave

.

Nov 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Tjerk Wolterink | last post by:
i have the following rule, <xsl:template match="br"> <br/> </xsl:template> This should convert all <br/> to <br/> but, my transformer transforms it all to
2
by: sbeerav | last post by:
Hi, I wanted to know if it is legal in XML to declare an element within itself. For example... <A> This is an element of type A. <A> This is another element of type A </A>
7
by: Quentin Huo | last post by:
Hi: I created a web-form user control. And in client-site, there is a link which will create a Input element object when it is clicked. <script language=javascript> ....... var nameInput =...
12
by: Nico Schuyt | last post by:
Maybe a stupid question (I'm not so familiar with javascript), but: I want to change background of a paragraph or list item on mouseover. The following code works: <p...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
14
by: hgraham | last post by:
Hi, I'm trying to understand how to work the dom, and all I'm trying to do is insert a link right before another link in the html based on it's href value. This isn't a real world example - I'm...
2
by: Lorenzo Thurman | last post by:
I would like to have an element, a text string, change into a select when a mouseover occurs and then change back to text when a selection is made or when a mouse out occurs. I looked a t using...
5
by: felipevaldez | last post by:
how can I put an element below another element, that's not absolutely positioned? so I have a n element, called X, and next to that, an element Y X Y XXXXXX
1
by: Darko | last post by:
Hello, I have an idea which requires me to change an input element's "type", but it doesn't work well in Internet Explorer, although it works just fine in Firefox. Namely, I want to have an...
4
by: bgold12 | last post by:
Hey, I have kind of a weird problem. I have a span that I'm intentionally overflowing a table cell (<td>), so that it stretches over the table cells to the right of the parent table cell. I want...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.