Solved Need help to add text to multiple lines

April 5, 2013 at 10:51:07
Specs: Windows 7
Need help to add text to multiple lines without removing the existing lines
From this:
<Item ItemId="22" name="Output">
To this:
<ItemId"22" cancel="true" name"Output" MaxPriceTotal="310288" MinPriceTotal="197456" DurationInt="12" Stacks="0" StackSize="0" SellAll="true" Manual="false" />

(the numbers are diffrent in each line)

I currently have 86154 lines I need to add those and more text in between the <>

See More: Need help to add text to multiple lines

Report •

April 5, 2013 at 12:23:34
✔ Best Answer
I guess the first question is "In what application are you working?"

With that asked...

I'm confused. I can't tell what is correct and what's a typo so I don't want to get too far into this until I understand what you are after.

Let's start simple:

One of your 2 original strings is this:

<Item ItemId="22" name="Output">

Your replacement string begins with this:

<ItemId"22" cancel="true" name"Output"...

That not only has addtional text (cancel="true") it's also missing some things that were in the original string. The equal signs are missing and the first word (Item) is missing.

You said you wanted to add text but you didn't say anything about changing any of the existing text.

Could you clarify that?

Next, your "From this" contain 2 strings, yet your "To this" only contains 1. What happened to "<market>1000006</market>"?

Next, "(the numbers are diffrent in each line)"

Where will these numbers come from? Maybe the better question is "Where will any of the "additional" text come from?

As you can tell from my questions, we need a lot more information before we can offer any help.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •

April 5, 2013 at 12:45:16
Thanks for the answer!
Yeah I had some typos... Forgot the "=" in the second string.
And the file I'm writing in is XML.

I did forget to mention that aswell, I want to both add text and change the existing one (remove spaces/new row and the <market></market> tags)
The numbers in between <market></market> tags needs to stay where they are, just need to get rid of the tags around it.

Did copy paste from another XML file i have. IE all the numbers that are in <market> tags needs to be inserted into this format -> MaxPriceTotal="numbers here".

Additional text is tags and "code" from a different XML file that has a different structure in it. To ease it up, I need to change the whole structure in File A to the structure in File B

Report •

April 5, 2013 at 20:27:03
It looks like (so far) it would be easier to apply this concept: make a copy of file A and plant the critical items from file B into the critical locations of file A. A "before and after" snapshot might help. (An example is worth a thousand words, or at least a thousand bytes).

Report •

Related Solutions

April 6, 2013 at 10:42:41
Q1: Is this really XML, or just HTML?
Q2: I'm seeing a lot of values there that you appear to be pulling out of thin air. How are you pulling out those numbers?
Q3: These were probably generated from some database. Why don't you just regenerate this file with the specified changes, instead of trying to hack in the changes after the fact?

How To Ask Questions The Smart Way

Report •

Ask Question