Page 1 of 1

Nested XML?

Posted: Wed Jan 21, 2009 12:28 am
by pfisterfarm
I've got a situation where a webpage has something like:

<div id="main">
<div id="item1">
</div>
<div id="item2">
</div>
</div>

Is TextPipe something I could use to grab this whole nested structure and write it to a separate file?

Thanks

Re: Nested XML?

Posted: Thu Jan 22, 2009 3:03 pm
by DataMystic Support
Sure - just use an EasyPattern like this:

<div id="main">
<div id="item1">[ capture(1+chars) ]</div>
<div id="item2">[ capture(1+chars) ]</div>
</div>

Re: Nested XML?

Posted: Fri Jan 23, 2009 2:28 am
by pfisterfarm
I see... how about if sometimes there is item1 and item2, and sometimes there's just item1?

Thanks!

Re: Nested XML?

Posted: Sat Jan 24, 2009 8:48 am
by DataMystic Support
Then try:

<div id="main">
<div id="item1">[ capture(1+chars) ]</div>[ 0+ whitespace, longest optional( '<div id="item2">', capture(1+chars), '</div>' ), 0+ whitespace ]</div>