function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kevin Caballes 10Kevin Caballes 10 

VF Page Error: XML document structures must start and end within the same entity

Hi Everyone,

I am trying to add a VF page to pull in my opportunity products onto caess records and I have attempted the following but keep getting the error "Error: Case_Opportunity_Product_List line 31, column 13: XML document structures must start and end within the same entity"

It looks like I am starting and endings with <apex:page> and </apex:page>, so not sure of the problem
 
<apex:page>
Controller-------
public class OpportunityProductList{
    public List<OpportunityLineItem> listOpptyProduct{get;set;}
    public OpportunityProductList(ApexPages.StandardController con){ 
        Case cs = [Select Opportunity__c from Case where Id=:con.getid()];
        listOpptyProduct = new List<OpportunityLineItem>([Select Id, Product2.Name, ServiceDate, UnitPrice from OpportunityLineItem
                    Where OpportunityId=:cs.Opportunity__c]);    
    }
}

Page-------
<apex:page standardController="Case" extensions="OpportunityProductList">
<apex:form >
<apex:pageBlock >
<apex:PageBlockTable var="oli" value="{!listOpptyProduct}">
<apex:Column headerValue="Product Name">
<apex:outputLink value="/{!oli.id}" target="_blank">{!oli.Product2.Name}</apex:outputLink>
</apex:Column>
<apex:Column headerValue="Sales Price">
<apex:outputLabel value="{!oli.UnitPrice}"/>
</apex:Column>
<apex:Column headerValue="Service Date">
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!oli.ServiceDate}" />
</apex:outputText>
</apex:Column>
</apex:PageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 
Best Answer chosen by Kevin Caballes 10
David Zhu 🔥David Zhu 🔥
It is caused by slash in the following two lines.

<apex:outputLink value="/{!oli.id}" ta....

<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">