Change of namespace in xml

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
harikhk
Participant
Posts: 64
Joined: Tue Jun 04, 2013 11:36 am

Change of namespace in xml

Post by harikhk »

Hi,
I have a problem for which I was unable to find some solution from the search. Posting it here.

I have an exiting job with xml unpack stage to read the xml file and output data to some text files.

Now there is a change in xsd from the source, change of namespace and additional elements

Earlier the namespace is ......../Event/1.0 and now it is changed to ......../Event/2.0 and so when I replace the xsd definition and in the XML_parser setup, from DocumentRoot when I browse for the new xsd all the earlier mappings(output links mapping) are throwing errors and this is requiring me to remap every column.

To validate from my end, in the new xsd I have retained the earlier namespace ......../Event/1.0 and repeated above steps passing through XMLParse Setup and Document root i do not see any errors.

So I concluded it is only because of change of namespace, the errors are thrown.

I have around 600 columns to be mapped for the existing job.
Can anyone know a better way to handle this(new namespace) so that I can avoid remapping of all columns
Thanks,
HK
*Go GREEN..Save Earth*
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Depending on the size of the document, one thought is to just pre-process it....put the entire xml document into a single longvarchar, and then pass it thru a Transformer and hit it with something like ereplace(), and zap all of the x123: namespace prefixes to q999: or similar scenario. ...basically replacing them all to the ones that you need, if indeed it is really just a "new" namespace prefix.

A lot of times it is an "additional" prefix, in which case, you would need to map your new columns anyway, but in this case, it sounds like it is just a change.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That "preprocess" suggestion is something we had to do in a somewhat similar situation. A Gov't vendor provided XML with a missing namespace which caused our parsing job to fail, something they were not able / willing to correct. So now we pre-process them and add in what is missing using nawk and then load the resulting files.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply