Question
Australian Customs and Boarder Protection Service
AU
Last activity: 7 Mar 2016 1:12 EST
XML with wrong date format does not give any error, instead it sets Date property in Int- class to blank
We are facing one issue. When Pega consumes an XML with a wrong date format, it does not give any error rather it is setting the property (Date property in Int- class) to blank. Do you have any resolution to this?
Thanks,
Joseph
Message was edited by: Lochan to branch from https://mesh.pega.com/thread/50505
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
PEG
IN
Hi Joseph,
I used below xsd to perform date validation.
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="JoinDate" type="testdate"/>
<xs:element name="EndDate" type="testdate"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Hi Joseph,
I used below xsd to perform date validation.
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="JoinDate" type="testdate"/>
<xs:element name="EndDate" type="testdate"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="testdate">
<xs:restriction base="xs:string">
<xs:pattern value="(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[012])-(19|20)\d\d"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
As per this pattern validation would be something 01-01-2015
When I give input XML like below.
Input XML:
<employee> <lastname>Goll</lastname>
<JoinDate>01-01-2015</JoinDate>
<EndDate>01-01-2016</EndDate>
</employee>
Output from Parse-XML:
When I pass wrong input as below.
<employee> <lastname>Goll</lastname>
<JoinDate>01-01-AAAA</JoinDate>
<EndDate>0126-01-20</EndDate>
</employee>
Output from Parse-XML:
To make this work, one need to set XML Validation in XML tab of Parse-XML rule.
Hope this helps!
Pegasystems Inc.
US
please provide more details: prpc version, use case (guess parse xml?, if yes, provide sample xml), etc.
Australian Customs and Boarder Protection Service
AU
Hi Kevin,
We are using Pega 7.1.9
As you can see from xml sample data below (highlighted in yellow), the EffectiveFromDate and EffectiveToDate are incorrect data inputs. ie. the date is defined as YYYY-MM-DD.
This is what you see when the tracer is ON
There is no EffectiveFrom and To date showing in the tracer.
Regards
Joseph
Australian Customs and Boarder Protection Service
AU
Pegasystems Inc.
US
great, thanks! Now can you check if your namespaces are defined, similar to this link: https://community.pega.com/support/support-articles/parsing-xml-not-happening-properly-salesforce-api?
Accepted Solution
PEG
IN
Hi Joseph,
I used below xsd to perform date validation.
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="JoinDate" type="testdate"/>
<xs:element name="EndDate" type="testdate"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Hi Joseph,
I used below xsd to perform date validation.
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="JoinDate" type="testdate"/>
<xs:element name="EndDate" type="testdate"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="testdate">
<xs:restriction base="xs:string">
<xs:pattern value="(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[012])-(19|20)\d\d"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
As per this pattern validation would be something 01-01-2015
When I give input XML like below.
Input XML:
<employee> <lastname>Goll</lastname>
<JoinDate>01-01-2015</JoinDate>
<EndDate>01-01-2016</EndDate>
</employee>
Output from Parse-XML:
When I pass wrong input as below.
<employee> <lastname>Goll</lastname>
<JoinDate>01-01-AAAA</JoinDate>
<EndDate>0126-01-20</EndDate>
</employee>
Output from Parse-XML:
To make this work, one need to set XML Validation in XML tab of Parse-XML rule.
Hope this helps!
Australian Customs and Boarder Protection Service
AU
Thank you Ganggababu, we're now seeing the error message after turn on the XML validation option.. Very much appreciated.
Joseph
PEG
IN
You are welcome Joseph Lee . Please close this thread as answered.