Dynamic Mapping between two xml.Very urgent

Hi,

I have an requirement such that I have a complex XML that gets mapped to another XML. The cross mapping structure for this is given in a database.Do you think we can get an optimised solution for this using webMethods.Kindly give me some ways of doing the same .

How do I find a node dynamically in a document and map it? Help me out by giving some way outs for the same.

Thanks in Advance

How is the “mapping” between the two doc types described in your database table?

Mark

Mark,
Sorry for the late turn-around.
I have a schema of source vendor and I have schema of target vendor. the database has source vendor’s xml tag and value which corresponds to one of target vendor’s xml tag and value. Once the tag and value are matched target vendor’s xml is created.
What i meant with Dynamic mapping is Tag A of source can go in Tag B of Target. I want to extract node and value for each tag coming over and then construct each tag for target vendor. Hope I answered your question.
Can you suggest me what optimize approach can i take in webmethods.
Thanks in advance

I think you’d be better off creating an XSL stylesheet to map the data from schema a to schema b. If you are using IS 6.5, you can use the new XSLT service to execute the stylesheet to transform the data. If you are using an older version, then you can download the XSLT Package from Advantage to do this.

You could probably hack something together to perform the functions as XSLT. I can almost guarantee that it would be slower and harder to maintain than an XSL / XSLT solution.

HTH,

Mark

I am using 6.1. Actually there will be 3 partners who will be sending me xml. I need to convert that to target xml. Everybody will have different set of mapping in db. Will XSLT package be help for me ?

I would think so. Using a standards-based approach to transforming xml from one form to another seems to make sense regardless of how many partners are involved.

I’m not sure how your custom mappings were created or are maintained. You would be replicating that work to create the XSL stylesheets. However, you would be avoiding creation of a custom transformation engine to apply the custom mapping to perform the transformation. That, to me, seems like a much better approach.

Mark

Thanks for your suggestion. I will see If I can use XSLT module.
Is there a way in webMethods to extract node name and node value if we have the document ?

There is a way using Integration Server (webMethods is a company, not a product) to query an XML node. Look in the Built-in Services Reference and search for queryXML.

Sohan,

Using pub.xml:queryXMLNode (WmPublic) service gives out xml node information.Please see the service documentation regarding required inputs of the service.

HTH,
RMG

“Give a man a fish, and he’ll eat for a day.
Teach a man to fish and he’ll eat for a lifetime.”

Rob, if you want to learn to fly fish in Colorado there’s a great place right across the street from your current project location (the photo is of one of their instructors), alhtough I don’t know what flyfishing has to do with integration. :slight_smile:

Mark

rmg,
pub.xml:queryXMLNode gives me the node information/value. What I want is both the node value and node name. Is it possible ?

Search is your friend.

See this post and this one.

Hi,
I need your suggestion to accomplish the below task in webmethods.
Requirement is something like this :
I have partners sending me complex xml files. I have to read that xml file line by line/tag by tag, and then for each tag query the database for its corresponding target node and value and then prepare the target xml.
example : abc
xyz

efg



jkl


I want to make sure that the below approach is good / Is there any good approach I can take.
Currently I hv decided to write a java program which parse the xml and gives me tag and value for each level. Based on the level I get I construct path(ex. ) and then pass the fullpath of xml tag and value to the database and get target node and value.
Let me know if there is a simpler way to accomplish this task.
Thanks

Writing a java program for this is not a good solution. If you won’t or can’t use XSLT, create two document types from the schemas representing your source and target documents and use Flow MAP statements to map between them.

Your are on your own from here.

I assume you were handed this “solution” to implement. IMO, this is a very poor approach. I assume also that the intent is to externalize the mapping so that someone else can maintain the mappings. Not a terrible idea but the use of a DB to hold the mappings probably not the way to go. Another thing to consider is how often do the mappings change? They shouldn’t change that much–if they do then the upfront analysis has been very shoddy.

Java is absolutely the wrong thing to use in this case. Just say no.

As Mark suggested earlier, using XSLT is one possible approach that externalizes the mapping so that so-called business users can maintain the mapping by updating the XSLT. Perhaps you can chat with whomever is responsible for maintaining the DB entries and go over the pros and cons of the solution using a DB vs. XSLT.

Personally, I’d go with simply mapping from source to target (or maybe from source to canonical form to target) directly within Developer, as Mark suggests in his most recent post. It’s easy to maintain and debug. I’m not a big fan of XSLT but it is nice if the mapping needs to be externalized however you need a completely different set of tools for development and debugging.

The strength of Integration Server (webMethods is the company, not the product name) and Developer is the speed with which one can develop solutions for manipulating XML. Don’t drop to Java. Don’t needlessly externalize things that don’t change much.

Guys,

can anyone tell me how are you going to acheive dynamic mapping between 2 xml files. i too have the same requirement…