Usually we get this error when ever we are writing some text outside of <apex:page> and </apex:page> tags.
For example :
<apex:page>
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<!-- End Default Content REMOVE THIS -->
</apex:page>Testing
In the above code sample, "Testing" is written outside of <apex:page> tag.So we got that error.
To avoid this type of error, make sure your code is written with in <apex:page> and </apex:page> tags.
For example :
<apex:page>
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<!-- End Default Content REMOVE THIS -->
</apex:page>Testing
In the above code sample, "Testing" is written outside of <apex:page> tag.So we got that error.
To avoid this type of error, make sure your code is written with in <apex:page> and </apex:page> tags.