XML with embedded XPath in the content…

Wow.  I haven’t written in awhile.    Been off in the land of metadata for the past few months, or heads down on some other projects.  No excuse — some juicy real-time/xml/java issues have been coming up lately and are piled here on my desk to be entered here.   I also have to finally figure out how to do attachments so that I can share some DataStage Jobs and other stuff.

 Ran into an interesting one today that I haven’t seen before, and I see a lot of XML issues.   Guess there’s always something new around the corner, and in reality I’ve only scratched the surface of what XML has to offer….and unless my teammates at IBM and/or our customers run into something, I’m not likely to see it.

 Anyway, this one is pretty cool.   I was given an xml document whose content contains references that point to “other” xml content in the same document.   In this case, it is a node with an attibute containing XPath pointing to another node somewhere (presumably above) in the document.   This attribute is present if-and-only-if all the other sub-elements of the node are missing.  If so, the processing needs to locate the other node and retrieve the values found there in order to populate all the values of the node containing this “reference” attribute.  A sort of “recursive” lookup into the same xml document.

I haven’t entirely worked out the solution using DataStage yet, although the strategy is fairly clear.   First retrieve the node, check for the reference attribute, and if present, pull out the XPath.   This XPath then needs to be used further on in the flow to pull some “other” content from the same XML document.  Compare for nulls and then take the populated content before moving forward…  A bit tedious, but do-able, since DataStage lets me throw XPath around and dynamically create and use Stylesheets.

Anyone else encountered XML like this with internal references?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: