Topic
1 reply Latest Post - ‏2011-11-11T07:08:30Z by mukulg
Venki52
Venki52
1 Post
ACCEPTED ANSWER

Pinned topic How to pass the missing value for XPath from Xml Input Stage

‏2011-11-09T19:32:51Z |
Hi,

While parsing the XML message using XML input stage, for some of the Xpaths (mentioned in Output tab) we don't have values in the source XML file. But for this the values needs to populate as Null.
I have tried with options available in XMl stage, but no luck.

Also i am getting the below mentioned warning and the records are dropping.

XML_Input_3,0: Warning: Jb_XML_InputStage_New.XML_Input_3: XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 166, column: 6): Expected end of tag 'ns1:tradingTimestamps'

Can anyone let me know how to resolve this issue.

Thanks.
Updated on 2011-11-11T07:08:30Z at 2011-11-11T07:08:30Z by mukulg
  • mukulg
    mukulg
    28 Posts
    ACCEPTED ANSWER

    Re: How to pass the missing value for XPath from Xml Input Stage

    ‏2011-11-11T07:08:30Z  in response to Venki52
    The error trace you've posted seems to tell, that Xalan is present in your technical environment. So possibly, an XSLT 1.0 fragment like below may be feasible to handle this situation (assuming you want to test the existence or the value of element "a"),
    
    <xsl:variable name=
    "effectiveVal"> <xsl:choose> <xsl:when test=
    "not(a = '')"> <!-- OR possibly, not(a) --> <xsl:value-of select=
    "a"/> </xsl:when> <xsl:otherwise> <xsl:text>Null</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:variable>
    


    If you can use XPath 2.0, this might be accomplished with following expressions,
    
    
    
    if (not(a = 
    '')) then a 
    
    else 
    'Null'
    

    OR
    
    
    
    if (not(a)) then a 
    
    else 
    'Null'
    


    Thanks