• vinodr
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Is there a way in Apex to take a given XML file and verify that it is valid according to any XSD schemas that it uses? Will any of the various Apex XML parsing classes (i.e. XMLStreamReader, Dom.Document, Ron Hess' XMLDom, or Abhinav Gupta's Fast XML DOM) provide any sort of "validation" that a given XML string that gets loaded into a DOM representation actually conforms to any of its referenced Schemas? Or are there web services for XML validation that any devs know of that I could do a callout to?

 

Thanks!

 

Zach McElrath 

Preface :

I really liked this <apex:inlineEditSupport> tag providing the functionality of inline edit for custom controllers.

 

I need to apply <apex:inlineEditSupport> for a table which shows matching objects. I am using Wrapper Class for getting the list of such matching objects.

 

And then showing it in the table through visualforce, Also I am rerendering the table with an ajax call.

 

Problem:

When the page loads and I double click on any item and it changes for editing according to the field type, I rerender the table and again doubleclick on any field and it again changes for editing as desired.

 

Now suppose the page is loaded and I rerender the table (without doubleclicking on any picklist field). When the table is rendered All other field works fine but picklist does not open for editing on double clicking.

 

So in short inlinEditSupport works for rerendered picklist only when any picklist field was doubleclicked when the page was loaded for the first time, Otherwise it don't.

 

Example Code :

 

Apex Class

Public class inlineEditTestController{
Public string AccSoql{get;set;}
Public integer AccCount{get;set;}
Public List<cContact> AccountVal {get;set;}
public class cContact {
  
          public Contact con {get; set;}
          public Opportunity opp {get; set;}
   
          public cContact(Contact c, Opportunity o) {
              con = c;
              opp = o;
          }
          
      }
Public pagereference inlineEditTestController(){
AccountVal = new List<cContact>();
AccSoql = 'select id, name, StageName, (select opportunitycontactrole.contact.id, opportunitycontactrole.contact.firstname, opportunitycontactrole.contact.lastname, opportunitycontactrole.contact.account.name, opportunitycontactrole.contact.Birthday__c from Opportunity.opportunitycontactroles) from opportunity order by LastModifiedDate desc';
AccCount = 10;
runQuery();
return null;
}

Public void runQuery(){
AccountVal.clear();
sObject[] newrows = Database.query(AccSoql+' LIMIT '+AccCount);
        Contact c = new Contact();
        Opportunity o = new Opportunity();
              for (SObject row : newrows){
         SObject[] childocr = row.getSObjects('OpportunityContactRoles');
      c = null;
     o = (opportunity)row;
     if(childocr != null){
     for (SObject con : childocr){
   OpportunityContactRole tempOcr = (OpportunityContactRole)con;
     c = (contact)tempOcr.contact;
     AccountVal.add(new cContact(c,o));
     }}
          }
system.debug(AccountVal.size()+'----'+AccountVal);
integer j = AccountVal.size();
if(j > 10)
{
   for(integer i=0; i<(j - 10); i++)
   {system.debug(i);
   try{
    AccountVal.remove(0);}
    catch (Exception e){}
    }
}
system.debug(AccountVal.size()+'----'+AccountVal);
}
Public pagereference moreRec(){
AccCount += 10;
runQuery();
return null;
}
Public pagereference lessRec(){
if(AccCount >= 10)
AccCount -= 10;
runQuery();
return null;
}
}

 

 

Visualforce Page

 

<apex:page controller="inlineEditTestController" action="{!inlineEditTestController}">
<apex:form >
<apex:pageBlock id="tableContainer">
<apex:pageBlockTable value="{!AccountVal}" var="Acc">
<apex:column ><apex:outputField value="{!Acc.con.LastName}"/></apex:column>
<apex:column ><apex:outputField value="{!Acc.opp.Name}"/></apex:column>
<apex:column ><apex:outputField value="{!Acc.opp.StageName}"/></apex:column>     // or any other picklist field from contact or opportunity
</apex:pageBlockTable>
</apex:pageBlock>
<apex:inlineEditSupport disabled="false" event="ondblclick"/>
<apex:commandLink action="{!moreRec}" reRender="tableContainer">More</apex:commandLink>&nbsp;&nbsp;<apex:commandLink action="{!lessRec}" reRender="tableContainer">Less</apex:commandLink>
</apex:form>
</apex:page>

 

 

Note : I am not using dependent picklist anywhere , the code provided was checked for error, without wrapperclass(i.e. for single objects) I didn't get any error and this is my first post so excuse me if I was not clear enough. Do ask me if you need some clarification.

 

Question: Is it a possible bug??

 

Anticipating quick response, Thank you.

 

Sam

  • April 21, 2011
  • Like
  • 0