Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create new element if node value is too large.

Status
Not open for further replies.

rssullivan

Programmer
Apr 19, 2011
1
0
0
US
I'm new to XML and would like to know the best way/tool to split an element if a value based on the size of a node value. I'm going to have hundreds of this type of situation, so I would like to find a programmatic solution if possible.

For example, in the following XML I need to create a new <threads> element if the <note> value is to large:

/* I need to change this: */
<threads>
<ID>7399</ID>
<acctID>51</acctID>
<entered>2011-05-14T12:56:06.000-07:00</entered>
<entryType>8</entryType>
<note>I am too big...now i'm not....
<seq>1</seq>
</threads>

/*..to two elements: */
<threads>
<ID>7399</ID>
<acctID>51</acctID>
<entered>2011-05-14T12:56:06.000-07:00</entered>
<entryType>8</entryType>
<note>I am too big...
<seq>1</seq>
</threads>

<threads>
<ID>7399</ID>
<acctID>51</acctID>
<entered>2011-05-14T12:56:06.000-07:00</entered>
<entryType>8</entryType>
<note>now i'm not....
<seq>1</seq>
</threads>

Thank you very much!
rssullivan
 
Why would you need to do that? Presumably, there is something that would make the <note> item "too big." What is that?

And why would you duplicate the entire <thread> node when you could put multiple <note> items within a <thread>?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top