Looping over XML Rows

That’s the worst XML I’ve seen in a long time! ;o)

You need 1 root tag (that encapsulates all other elements) and a repeating row/element would have the same XML node name - such as <row>.
You could have <row id=“1”></row> or something but not unique element names like you’ve shown (row1, row2, etc).

Get them to create proper XML!

Thanks Will.

I can suggest that they change their XML to something that is better formed with repeating row’s, but I am unsure whether they will comply.

Are there any webMethods services which can aid me in joining like-named tags into a record-list? Would a flat-file template help? We are using IS4.6

If you are saddled with using that XML, then here’s something that you may be able to do:

Using REGEX or regular expressions, you can pass the entire XML string into the replace function and using the regex /^<row/>. Do this twice, once for <row_x> and then again for the closing tag </row_x>.

Of course, change the search pattern for closing bracket /^</\row/

It’s kinda crazy, but it may work.

The best thing to do of course is to generate proper xml.




This is not an XML file…It is a user defined flat file that looks like XML. If you can not get them to create a proper XML then defining the structure as a FF might be much easier.

Good luck


Satyen - Alphan is onto something. This doesn’t seem to be XML at all - you can’t have tags defined on the fly like that. If your partner insists it is XML, ask them for the DTD or schema – tell them you require it to import the DTD as an WM record structure (which is true).

Rays’ advice seems to be the best – use widlcards and pub.string:replace to transform the problem tags: <rownn> to plain old XML tags: <row>. If you want to preserve or extract the ‘NN’ number information, you could use the EDI adapter.

Thanks Guys!!

I inisisted that our partner send us a DTD or XML Schema…and they suddenly agreed to ammend their XML structure!

Now We have a record list of tblData!!

Thanks for all the support, suggestions and guidance.

Had they not changed, then the REGEX method sounds fairly simple, and a flat-file template might also be a good route too.