Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
4 replies Latest Post - ‏2013-12-03T17:07:15Z by michaelkdown
PingLu
PingLu
44 Posts
ACCEPTED ANSWER

Pinned topic Can Cast Iron validate an xml file against an xsd file?

‏2012-06-01T14:00:39Z |
If I get an xml file from an FTP server, can Cast Iron validate this xml file against an xsd file? Thanks in advance.
Updated on 2012-06-01T15:08:03Z at 2012-06-01T15:08:03Z by PingLu
  • Sathya400
    Sathya400
    13 Posts
    ACCEPTED ANSWER

    Re: Can Cast Iron validate an xml file against an xsd file?

    ‏2012-06-01T14:51:15Z  in response to PingLu
    Yes. You can. Use validate XML activity.
    • PingLu
      PingLu
      44 Posts
      ACCEPTED ANSWER

      Re: Can Cast Iron validate an xml file against an xsd file?

      ‏2012-06-01T15:08:03Z  in response to Sathya400
      thx
    • SwethaRai
      SwethaRai
      47 Posts
      ACCEPTED ANSWER

      Re: Can Cast Iron validate an xml file against an xsd file?

      ‏2013-11-25T11:51:12Z  in response to Sathya400

      Hi,

      To validate a XML from a source application for the NULL/Blank values, do we have built -in function or a custom function should be coded?

      Please help with the logic for checking NULL values in an incoming source xml (for mandatory field check)

      Thanks,

      Swetha Rai

  • michaelkdown
    michaelkdown
    36 Posts
    ACCEPTED ANSWER

    Re: Can Cast Iron validate an xml file against an xsd file?

    ‏2013-12-03T17:07:15Z  in response to PingLu

    An Validate XML activity can not be used to check if there is content INSIDE of an element it can only check if that element is present. So if for example you have a field called "telephone_number" and your schema definition is set to minOccurs="1" then the following scenarios will pass/fail

     

    Element not present ---- FAIL ----

    Element looks like this - <telephone_number/> --- PASS ---- As node is present but it doesnt care about content

    Element looks like this - <telephone_number>0123456798</telephone_number> --- PASS ---- Node is present so passes and happens to have content.

     

    If you want to check if a node has content you have to create a customer XSLT that looks inside the nodes you will need to use logic that looks like this:

    <xsl:if test="telephone_number != '' or telephone_number">
        [ADD SOME LOGIC IN HERE]
    </xsl:if>

    This simple if statement looks for both the node has data != '' part and that the node is there.