Nested XML?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
pfisterfarm
Posts: 2
Joined: Wed Jan 21, 2009 12:23 am

Nested XML?

Post 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
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Nested XML?

Post 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>
pfisterfarm
Posts: 2
Joined: Wed Jan 21, 2009 12:23 am

Re: Nested XML?

Post by pfisterfarm »

I see... how about if sometimes there is item1 and item2, and sometimes there's just item1?

Thanks!
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Nested XML?

Post 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>
Post Reply