Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,960
    Thanks
    120
    Thanked 76 Times in 76 Posts

    HTML validator problem, java code

    Code:
        
    <%    
        if (some condition that is false)
        {
           //so this does not gets executed
           out.println("Access denied, members only !");
           return ;
        }
    %>
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    .....

    1.if I look at page source: there is no text like "Access denied, members only !". As expected.
    2. validate:

    Validation Output: 3 Errors

    Error Line 21, Column 1: document instance must start with document element

    Access denied, members only !


    Error Line 21, Column 1: character data is not allowed here

    Access denied, members only !



    You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:
    putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>), or
    forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or
    using XHTML-style self-closing tags (such as <meta ... />) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML.
    Error Line 21, Column 30: no document element

    Access denied, members only !
    ?
    Last edited by BubikolRamios; 08-02-2011 at 11:20 AM.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Are you saying you viewed the source code in the validator (using the "Show Source" check box option) or are you saying you viewed the source from your browser when you visit your own page? If you're viewing from your own browser's view source then you should use the validator's Show Source option instead to get line numbers and see the actual source code being evaluated.

    Can you give us a link to the page you are testing?

    Anyway, for whatever reason the validator's visit to your page is not getting the "false" result from the check that you are expecting it to get in ASP. To fix the validation you would need to add proper doctype declaration and page structure (html tags, head, title, body, and paragraph or div to contain the text) to this portion of your script:

    Code:
    <%    
        if (some condition that is false)
        {
           //so this does not gets executed
           out.println("Access denied, members only !");
           return ;
        }
    %>
    But as for why your if statement is evaluating true rather than false, I can't even begin to guess without seeing your full ASP script.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • Users who have thanked Rowsdower! for this post:

    BubikolRamios (08-02-2011)

  • #3
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,960
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Quote Originally Posted by Rowsdower! View Post
    Are you saying you viewed the source code in the validator (using the "Show Source" check box option) .
    Ahh damn. Sure thing. When I see the page , I'm logged in, so it shows everything.
    When validator takes it, it is not logged in, so it gets entirely different contence.

    I have shortuct on my page to validator, and next to it my user name(as I',m logged in), so it was kind of dificult to figure out what is going wrong.

    Thanks.
    Last edited by BubikolRamios; 08-02-2011 at 01:36 PM.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •