Finally, an EBS posting!
For those of you using XMLP in your OA Framework pages you may have noticed (as did one of our EBS developers) that the VO method writeXML is great but the dates are pushed out in a non XMLP format i.e. 2006-06-05 07:01:12.0. XMLP needs to have the XSD date format,'YYYY-MM-DDTHH:MM:SS' to allow you to format the date correctly in the layout template.
To get this format Steve Meunch came to the rescue, thanks Steve.
Customizing the getter method of the view object's row class to return a Date with a custom implementation of the
getXMLContentNode() method, using whatever format you like for the date value. Will get you the correct date format.
For example, if you created an EmpView having Empno, Ename, and Hiredate attributes, your EmpViewRowImpl.java class could overide the getter method for the Hiredate attribute like this:
Change:
public Date getHiredate() {
return (Date)getAttributeInternal(HIREDATE);
}
To this:
public Date getHiredate() {
return new Date((Date)getAttributeInternal(HIREDATE)) {
public Node getXMLContentNode(Document xmlDoc) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
return xmlDoc.createTextNode(sdf.format(timestampValue()));
}
};
}
Doing so would coax writeXML() to change its output from:
<EmpView>
<EmpViewRow>
<Empno>7369</Empno>
<Ename>SMITH2</Ename>
<Hiredate>2006-07-21 10:50:32.0</Hiredate>
</EmpViewRow>
</EmpView>
To this:
<EmpView>
<EmpViewRow>
<Empno>7369</Empno>
<Ename>SMITH2</Ename>
<Hiredate>2006-07-21T10:50:32</Hiredate>
</EmpViewRow>
</EmpView>