on 2005 Jul 19 9:04 PM
I have a xml file coming into XI (file ->XI)without namespace. I would like to change the root elment with ns tag add the namespace values with it.
ie.,
Coming in as
<Vendor>
.......
</Vendor>
I would like to change it to
<ns:Vendor xmlns:ns="urn:group01:legacy">
......
</ns:Vendor>
thanks
I recommend using XSLT for this purpose.
Use the copy-of select function for the inside tags.
If you need further help, let me know, I could provide an example for you.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dhandu,
if you create a message type:
<Vendor>
.......
</Vendor>
without the namespace
and one message type:
<ns:Vendor xmlns:ns="urn:group01:legacy">
......
</ns:Vendor>
with the namespace
and then a mapping from the one without to the one with the namespace
you'll have the namespace in your target message type - then you can do
whatever you want with it
is this what you're looking for?
Regards,
michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
but does you external definition requires this namespace?
you can always do 2 mappings one from something to message type with the namespace and the second one from this one to the second external definition ...
external - mapping - message type with namespace - mapping - external
but I don't know your scenario..
Regards,
michal
Michal
I did create all interface objects and mapping objects by adding "urn:" on the software component namespace table.
In that I did import external definition with no name space schema and did create message interface out of it.
Then in urn:group01:legacy namespace i did create message mapping between no namespace to with namespace and test it works great.
In the message interface it did allow me add the new source with no namespace and the target with interface with namespace. The source and target interface I add to on top of the exisiting vendor:group01:legacy to target CREMAS:CREMAS03. But I couldn't select to add the second mapping. The message mapping allows only one.
This is what I have
Interface Mapping
Source Interface -
TargetInterface
Vendorwithnospace -
Vendor_out
Vendor_out -
CREMAS:CREMAS03
Request
Source Message --- Mapping Program -
Target Message
Vendor -
<does not allow to add>--- Vendor
Vendor -
Vendor_CREMAS03 -
CREMAS:CREMAS03
I thought I can do the first mapping to add the namespace and have the output to feed it as input for the second mapping.
I know I can always use the configuration directory to output and make it as two jobs, but all I need is to add the namespace to the file root element.
Hi Dhandu,
Other way of doing this is using a Java Mapping, which writes in a particular line in your incoming msg & then you can go for your normal 'mapping' to target.
Incase you want to remove anything from msgs, then also, you can use Java mapping.
But you have to arrange the mapping sequence in the order In which you want them to execute.
so you can try these steps,
1) Java mapping which adds a tag
2) XSLT/Msg mapping (which can take in the msg after formatting)
Remember that when you play with namespace, the "mapping program" always refer the elements w.r.t the namespace, so there is "probably" a certain amount of risk for the elements not getting mapped properly.
Incase you go for XSLT
if required (when u dont get results in your mapping IDE - any external tool like stylus, xml spy )you may have to add the namespace in front of every element like /ns:xyz/ns:abc.
Best of luck
Hope this helps
Regards
Vishnu
Vishnu,Stefan & Sudhir
I did the change in namespace of a incoming xml (vendor without namespace)using the mapping of a external xsd with and without namespace (to a namespace of urn:group01.legacy) This works fine. (as Michal suggested). So, I have two mappings now, one for appending the namespace to the root element and another one to do the file to idoc mapping.
The issue is, how to I make this output from the first mapping of vendor as source target to CREMAS:CREMAS03 idoc using the same interface mapping. It is allowing only one map doesn't matter whether it is XSLT or Java or Message mapping.
Thanks
Hi Dhandu,
1) You can ADD mapping programs in required sequence in Interface Mapping object.
2) Since I normally, go by the Java XSLT way, I add my java class first in the sequence, which adds the tag & then the XSLT mapping.
3) The output of each seqeunce of mapping is automatically passed to the next in the sequence
Not sure if I completely answered your question, but it works like this for me.
Also, if you plan to use Java class (as above), make sure you read the namespace from a properties file. so you need not change/compile the Java code.
Hope this helps
Regards
Vishnu
User | Count |
---|---|
81 | |
11 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.