+ Start a Discussion
Aruna06Aruna06 

Error: Compile Error: Entity is not org-accessible at line 1 column 8

can anyone explain why this erroe pop'sup

Best Answer chosen by Admin (Salesforce Developers) 
AditiSFDCAditiSFDC

And in your case :

 

Replace this line of code:

ImageUrl=String.valueOf(socialnetwork);

with this :

ImageUrl=String.valueOf(socialnetwork.name);

All Answers

AditiSFDCAditiSFDC

May be the problem is due to spelling mistake of Entity Name or if it is a custom object and you are not appending __c to it.

As earlier, I too got this error due to some typing mistake.

Aruna06Aruna06

public class XmlStreamReaderDemo1 {

    public String image1 { get; set; }

   public class Image    {      String name;         }

   Image[] parsesocialnetwork(XmlStreamReader reader) {     

Image[] socialnetwork= new Image[1];     

while(reader.hasNext()) {

         if (reader.getEventType() == XmlTag.START_ELEMENT) {          

   if ('Image' == reader.getLocalName()) {

                Image image1= parseImages(reader);               

  socialnetwork.add(image1);                           

  }         

 }      

   reader.next();   

   }    

return socialnetwork;  

  }

   Image parseImages(XmlStreamReader reader) {    

  Image image1= new Image();        

while(reader.hasNext()) {        

 if (reader.getEventType() == XmlTag.END_ELEMENT) {      

      break;        

 }

 else if (reader.getEventType() == XmlTag.CHARACTERS) {           

 image1.name = reader.getText();      

   }        

reader.next();     

 }     

return image1;           

  }   

 public string ImageUrl{get;set;}  

  public void action()

  {    

 XmlStreamReaderDemo1 demo = new XmlStreamReaderDemo1();      

 String str = '<socialnetwork><Image>https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e</Image><socialnetwork>';        XmlStreamReader reader2 = new XmlStreamReader(str);    

  Image socialnetwork = demo.parseImages(reader2);    

  System.debug(socialnetwork);      

 ImageUrl=string.valueof(socialnetwork);  

  }             

 }

 

 

and my VF page is

<apex:page controller="XmlStreamReaderDemo1">  

 <Apex:form >   

  <apex:pageBlock >      

<apex:commandButton value="Action" action="{!action}" reRender="ImageDisplay"/>      

 <apex:pageBlockSection >      

<apex:outputPanel id="ImageDisplay">       

  <apex:outputtext value="{!ImageUrl}" />    

    </apex:outputPanel>      

</apex:pageBlockSection>    

</apex:pageBlock>

  </Apex:form>

 </apex:page>

 

This is my code.....Whenever I call the action command output is

Image:[name=https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e]

 

So in this my problem is that I dnt want system to get Image and Name values.......Any idea of getting out of this would be very helpful

AditiSFDCAditiSFDC

If you simply want to display an Image on Button click then here is the solution :

 

In Apex Page :

Replace this

<apex:outputtext value="{!ImageUrl}" /> 

with this 

<apex:image value="{!ImageUrl}" /> 

 

And in Apex Class :

Assign the URL directly to variable ImageUrl like this :

ImageUrl='https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcR6N8xoTIVjKPjpdpvLZjzwrDEAIodzZTpD1ybS-XHZskxE1F0e'; 

 

AditiSFDCAditiSFDC

And in your case :

 

Replace this line of code:

ImageUrl=String.valueOf(socialnetwork);

with this :

ImageUrl=String.valueOf(socialnetwork.name);

This was selected as the best answer
Aruna06Aruna06

THANKS A LOT ADITI.......It worked very well.....U helped me alot. thank you sooooooooo much

sandeep@Salesforcesandeep@Salesforce

Thanks Aditi ..