469,336 Members | 5,955 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Mapping of elements from 2 different Namespaces.

I have a query regarding mapping of 2 different namespace elements :

1).I get the undermentioned XML data from a system:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4">
  4.     <Order Acct="1" ExDest="ExchDest">
  5.         <Hdr Snt="2007-04-05T13:34:47"/>
  6.         <Instrmt Issr="Barclays" MMY="200903"/>
  7.     </Order>
  8. </FIXML>
  9.  
  10.  

2).The above XML element values need to be extracted and put in the format that we are
using below with the prefix i:

Expand|Select|Wrap|Line Numbers
  1. <i:Interest xsi:schemaLocation="http://www.abc.com/interests:i 
  2.                                 http://ABC/derivatives/interests/interests.xsd" 
  3.                                 xsi:type="i:vanilla" 
  4.                                 xmlns:i="http://www.abc.com/interests:i" 
  5.                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  6.                                 xmlns:strategies="http://www.abc.com/derivatives/strategies">
  7. <i:ID>249403</i:ID>
  8. <i:Status>0</i:Status>
  9. <i:Generation>2</i:Generation>
  10. <i:Entered Formatted="" Format="dd mmm yyyy hh:mm:ss">2007-04-02T18:34:43</i:Entered>
  11.     <i:Updated Formatted="" Format="dd mmm yyyy hh:mm:ss">2007-04-02T18:36:47</i:Updated>
  12. <i:Description>EQ.D</i:Description>
  13.   .........
  14.  
  15.  
Now,my query is:

1) Do I need any mapping mechanism to read data from the XML defined in (1) in the format defined in (2).
If so,please can you suggest a way for this?

2) OR is it a wise idea to hardcode the elements with the prefix of 'i:' in my style sheet as below :

Expand|Select|Wrap|Line Numbers
  1.  
  2.     <?xml version="1.0" encoding="UTF-8"?>
  3.     <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  4.      xmlns:fo="http://www.w3.org/1999/XSL/Format" 
  5.      xmlns:fix="http://www.fixprotocol.org/FIXML-4-4"  
  6.      xmlns:i="http://www.abc,com/common/interests:i"
  7.      exclude-result-prefixes="fo i ">
  8.  
  9. <xsl:template match="fix:FIXML">
  10.    <xsl:apply-templates select="fix:Order"/>
  11. </xsl:template>
  12.  
  13. <xsl:template match="fix:Order">
  14.  
  15. <OrderCancelRequest>
  16. <i:ID>
  17. <xsl:value-of select="@Acct"/>
  18. </i:ID>
  19. </OrderCancelRequest>    
  20.  
Please suggest a way for this ? Help appreciated.
Apr 20 '07 #1
3 1322
Please ignore this question.
Thanks,
Apr 20 '07 #2
dorinbogdan
839 Expert 512MB
Hi,

Is the question more needed?
If not I will remove it.

Thanks,
Dorin.
Apr 23 '07 #3
Yes Dorin,you can delete this query.
Thanks,
Ajay
Apr 23 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Navin Mishra | last post: by
33 posts views Thread by abs | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.