Topic
  • 4 replies
  • Latest Post - ‏2013-12-03T17:07:15Z by michaelkdown
PingLu
PingLu
44 Posts

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

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

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

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

    ‏2012-06-01T15:08:03Z  
    • Sathya400
    • ‏2012-06-01T14:51:15Z
    Yes. You can. Use validate XML activity.
    thx
  • SwethaRai
    SwethaRai
    49 Posts

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

    ‏2013-11-25T11:51:12Z  
    • Sathya400
    • ‏2012-06-01T14:51:15Z
    Yes. You can. Use validate XML activity.

    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

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

    ‏2013-12-03T17:07:15Z  

    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.