Skip to main content

Posts

Showing posts from January, 2014

Parsing An XML Data With DOM Parser In Apex

Parsing the XML data in Apex is always pain and there are already very good blogs and links that really help us to design the strategy for parsing XML data of various complexities .

http://www.tgerm.com/2011/01/apex-xmldom-to-fast-xmldom.html

The above blog from Abhinav one of our MVP of sfdc dev commmunity is informational and i suggest everyone to read this on how to use fast XML DOM.

There is a cookbook article as well on how to effectively achieve the parsing of XML using DOM parsers

http://developer.force.com/cookbook/recipe/parsing-xml-using-the-apex-dom-parser

One has to know two system classes a)Document Class b)XMLNode Class
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_xml_dom.htm

Now the question then ,why I am I writing this blog when already there are so much information on web as how to do it.The reason is even after reading all the documents in net ,i struggled to parse an XML as none of the blogs speak on how to parse when we have namespace in the XM…

Encrypting the XML response from External System In Custom Field Using AES 256 Algorithm

Encrypting the data via crypto classes in apex language is fun and below are the few articles links on developer force that really help us understand better.

http://wiki.developerforce.com/page/Apex_Crypto_Class

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_crypto.htm

Having read the above document one can easily be of opinion thats its too easy with few lines of code to encrypt data using AES 256 and also same can be stored in a field via an apex trigger .It is not so simple when it comes to storing this data into the custom field .

From the above code ,the problem arises when we start thinking on how to store the encrypted  blob data into the field of object .We dont have any field of data type blob in sfdc and thats were my problem  began and hence this blog for people looking for solution around how to store the blog in a Long Text Field and then how to decrypt the same .


The above code will trigger an exception as below



System.StringException: BLOB i…

MAXIMUM DEBUG LOG SIZE REACHED

*********** MAXIMUM DEBUG LOG SIZE REACHED ***********

Many Times i get frustrated when i want to log something and see the values in debug log and when i encounter an error saying MAXIMUM DEBUG LOG SIZE REACHED.

We all know the log levels in SFDC can be configured and hence setting filters as below in debug logs help to solve the problem

Database : NONEWorkflow : NONEValidation : NONECallouts : NONEApex Code : ERRORApex Profiling : NONEVisualforce : NONEhttp://salesforce.stackexchange.com/questions/11239/need-to-get-logfile-smaller
The above stackexchange link helps to identify how to solve the problems .
But when it comes to the TEST classes sometimes when there are too many test methods even filtering as shown above does not help much .How do we solve the problem then ?
One solution is to comment out all other test methods except the method that's giving trouble or suspected of cause of error .Hence we will be able to display logs for only the method and debug the result .