Validating Html

I'm attempting to validate HTML from a dom Document Node.
However, I can't even get to that step, because I can't build a Validator correctly, from the W3C official DTD. Why does my SchemaFactory think W3C's DTD is invalid? (Special thanks to Eliott Rusty Harold of IBM, for the original structure of this code)
public static boolean isHtml(org.w3c.dom.Document doc) throws SAXException, IOException {
          // 1. Lookup a factory for the W3C XML Schema language
          SchemaFactory factory = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
        // 2. Compile the schema.
         URL schemaLocation = new URL("http://www.w3.org/TR/html401/loose.dtd");
         // TODO this next line is dying on me! It throws this Exception:
         //     "org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed."
         Schema schema = factory.newSchema(schemaLocation);
         // 3. Get a validator from the schema.
         Validator validator = schema.newValidator();
         // 4. Parse the document you want to check.
         Source source = new javax.xml.transform.dom.DOMSource(doc);
         // 5. Check the document
         try {
            validator.validate(source);                                                                 // SAXException if the document is not valid HTML
                                                                                                           // IOExeption for whatever reason...
            return true;                                                                                // the parser was working, and the document is valid HTML
        } catch (SAXException ex) {
             return false;
}

That's a DTD, not a schema. So telling the parser it's a schema is sure to cause problems.

Similar Messages

  • [CS3] Publish problem with no valid HTML templates

    Hi,
    I have a project file which I have publish numerous times
    before without problems. It has come to finally publishing it for
    the last time and when I go to publish an error messages comes up
    saying...
    "no valid HTML templates are avaliable to complete this
    operation".
    I have reinstalled the app again but still getting the
    problem.
    Any ideas...

    I get to the point where you select Publish Settings in the
    file menu but then it comes up with the error message...

  • Import error: File is not a valid HTML DB export file

    Hi,
    This is driving me a bit nuts: I have made a change to a page and want to move it to another HTMLDB environment. I have 3 environments, DEV, TEST and PROD, they are all version 1.6.0.00.87. I export the page from DEV, then when I try and import it into TEST I get an error "File is not a valid HTML DB export file". The file looks OK to me, I have regenerated it several times, I have tried both DOS and UNIX formats, same result. How can I find out the root cause of this issue, I've been able to export/import individual pages without any problems up to now.
    Thanks,
    Steve

    This was tripping me up for a while too. Make sure that the workspace id (1236351 or some such large number) is the same across all environments. You can ensure this by taking a export of the DEV workspace itself from the Admin interface (login to workspace internal) and importing it into TEST and PROD.
    Once the workspace id is the same, you can export/import pages between them without a problem.
    Thanks

  • CS5 issues - No Valid HTML Templates are available to complete this operation

    Why does test movie open a new window in the IDE instead of compiling?
    And when I try Publish Settings I get
    'No Valid HTML Templates are available to complete this operation'

    It sounds like the user configuration is bad.  Please try removing the user configuration folder.  Please note that after deleting the user configuration, there are user  settings, such as panel position and saved jsapi commands, will be removed or reset so you might want to save the important files you want to reserve in user configuration before removing the  user configuration folder.
    1. Quit Flash.
    2. Delete the following folder:
    Win 7 and Vista: HD:\Users\<username>\AppData\Local\Adobe\Flash CS5
    Win XP: HD:\Documents and Settings\<username>\Local Settings\Application  Data\Adobe\Flash CS5
    Mac: HD:/Users/<username>/Library/Application Support/\Adobe\Flash CS5
    3. Relaunch Flash and see if it fixes the problem.
    Thanks,
    San

  • No valid HTML templates error on publish

    Hello,
    I've been using flash8 on my computer without any problems since I've purchased it, until now. Suddenly I'm getting this error message when trying to publish. (it won't let me get to the publish settings)
    "No Valid HTML Templates are available to complete this operation"
    I've already reinstalled without any success, and have scoured the internet for a solution. It seems others have had this problem in the past but no one has a logic answer on how to fix this. So I come to you, I know my version is dated and not an actual Adobe product, but it was working fine. What could be causing this sudden problem?
    Please help, thanks.

    Here's the solutions (thanks to San), just incase anyone else come across this problem. - cheers!
    It sounds like the user  configuration is bad.  Please try removing the user configuration  folder.  Please note that after deleting the user configuration, there  are user  settings, such as panel position and saved jsapi commands,  will be removed or reset so you might want to save the important files  you want to reserve in user configuration before removing the  user  configuration folder.
    1. Quit Flash.
    2. Delete the following  folder:
    Win 7 and Vista:  HD:\Users\<username>\AppData\Local\Adobe\Flash CS5
    Win XP:  HD:\Documents and Settings\<username>\Local  Settings\Application  Data\Adobe\Flash CS5
    Mac:  HD:/Users/<username>/Library/Application Support/\Adobe\Flash CS5
    3.  Relaunch Flash and see if it fixes the problem.
    Thanks,
    San

  • No Valid HTML Templates

    I have installed CS3 Web Premium on a system running Windows
    Vista. When I try to access the publish settings or publish a Flash
    project, I get the following error: 'No valid HTML templates are
    available to complete this operation'.
    I called tech support and they said remove CS3 Web Premium
    and then reinstall it. I'm trying to avoid that long process. Has
    anyone else experience this problem and found a solution?

    I too am having the same problem with the "no valid html
    templates" message....I have fully uninstalled Flash CS3 and
    reinstalled it and still cannot publish without the above error
    message. Also when I try loading a new "slide" or "form" from the
    welcome screen I get the following error message:
    "The default screen types FORM and SLIDE are missing from the
    configuration. Please restore them by reinstalling."
    I get this even after a fresh install...I have tried
    uninstalling and reinstalling twice now( each time takes over an
    hour to complete)
    so any help in this matter would be much
    appreciated...

  • Not Valid HTML or XHTML

    Hi,
    I am baffled because ever since some updates were done to Adobe InContext, I haven't been able to edit certain pages on my websites. I get the error:
    "You cannot save this page."
    "The page does not appear to be valid HTML or XHTML."
    I can't find any problems with it, and I've been able to save my profile pages before with inContext in the past. This happens with both I.E. 8 and Firefox 3.
    The affected pages are:
    http://www.aliyamustafina.com/includes/ice/ide.html#page=chinese%2Fprofile.php
    http://www.anna-pavlova.net/includes/ice/ide.html#page=spanish%2Fprofile.php
    Can anyone tell me which code is causing the pages to fail to publish? I removed the PHP code once to see if this would correct it (the PHP code is in a table field that is not set to be editable by InContext), but the error remained.
    Thanks!
    Alan

    Hi Alan,
    On a quick inspection I've found several tags which are not closed properly:
    in the first page, the map tag is closed twice, and on the bottom of the page there's a tr and td which are never closed. These kind of problems are the most probable cause for which you receive these error messages. Please try to correct the page structure so that it is XHTML valid (you can use a validator to check all the issues) and let me know if you still have the same problem.
    Thank you,
    Florin

  • Validating HTML form generated by servlet

    Hi, folks. I have a dynamic html form generated by a servlet class. Once user fills up the form and submits it, i have another servlet does the form validation. My question is how can i reload the generated html form with error messages when user's inputs failed validation?
    I am not able to use JavaScript pop-up windows for doing validation cause the page will be displayed on PDA and cell phone as well. Any help is greatly appreciated.

    Could you combine the servlets.
    I'm not sure but then you may be able to have the generator servlet in the doGet method and the validator in the doPost method. (don't quote me on this)
    If you combine the servlets you have access to the original data (the form), that way if any validation errors occur you can repost the form with their entered data and an error message.

  • Validating HTML with an XML feed

    I'm having difficulty getting my home page to validate with
    its XML
    feed. Here's the w3 validator's erros:
    http://tinyurl.com/39kmg2
    Basically the validation errors I get are:
    there is no attribute "xmlns:dc".
    there is no attribute "xmlns:content".
    there is no attribute "xmlns:wfw".
    This is from the beginning of my XSL file:
    <xsl:stylesheet version="1.0"
    xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform"
    xmlns:wfw="
    http://wellformedweb.org/CommentAPI/"
    xmlns:content="
    http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="
    http://purl.org/dc/elements/1.1/">
    I tried taking out those three links but then my page
    displays a
    MM_XSLTransform error.
    How can I get my page to validate?

    ryansebiz wrote:
    > I'm having difficulty getting my home page to validate
    with its XML
    > feed. Here's the w3 validator's erros:
    http://tinyurl.com/39kmg2
    >
    > Basically the validation errors I get are:
    >
    > there is no attribute "xmlns:dc".
    > there is no attribute "xmlns:content".
    > there is no attribute "xmlns:wfw".
    >
    > This is from the beginning of my XSL file:
    >
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform"
    > xmlns:wfw="
    http://wellformedweb.org/CommentAPI/"
    > xmlns:content="
    http://purl.org/rss/1.0/modules/content/"
    > xmlns:dc="
    http://purl.org/dc/elements/1.1/">
    >
    > I tried taking out those three links but then my page
    displays a
    > MM_XSLTransform error.
    >
    > How can I get my page to validate?
    Anybody?

  • HTML validation

    It doesn't appear that HTML validation has gotten much attention here on the Apex forum. I did a search here and in the OTN forums at large and found no threads with the phrase "HTML validation" in them. In any case I'm trying to go down that path, meaning that I'm trying to create an Apex application wherein the HTML produced passes validation using the W3C validation tool.
    Interestingly enough, I always thought Apex did a great job of producing valid HTML. Turns out it's not so good when you check it using the W3C validator. There are all sorts of quirks that show up that don't make a huge difference in display or function but they don't pass muster in terms of standards based HTML or XHTML.
    One of the things I found that's quite pervasive, and probably a relatively easy fix, is that when ampersands are inserted into URLs (using things like the #WORKSPACE_IMAGES# substitution string) that those ampersands are not properly escaped and this causes a bunch of cascading errors as a result.
    So my question is this: is anyone out there from the Apex development team at Oracle looking at this? Or is it not even on the radar?
    As far as I'm concerned, it would be really nice to be able to run an Apex app through the W3C validator and have it pass with flying colors. Does any one else care about this? Or is this thread just going to die a quick, quiet and painless death?
    Where do you stand on HTML validation? Is it a moot point if your application looks/behaves the way you want it to?
    In case you want to try this out for yourself take a look here: http://validator.w3.org/
    Earl
    Edited by: EarlL on Dec 9, 2009 3:15 PM

    Earl
    It doesn't appear that HTML validation has gotten much attention here on the Apex forum. I did a search here and in the OTN forums at large and found no threads with the phrase "HTML validation" in them.[You did not find the right incantation|http://forums.oracle.com/forums/search.jspa?threadID=&q=html+AND+%28validator+OR+standards+OR+compliant%29&objID=f137&dateRange=all&userID=&numResults=15&rankBy=10001]&mdash;there have been more than a few, [going back quite a while|http://forums.oracle.com/forums/thread.jspa?messageID=951069] and [right up to today|http://forums.oracle.com/forums/thread.jspa?messageID=3956045].
    One of the things I found that's quite pervasive, and probably a relatively easy fix, is that when ampersands are inserted into URLs (using things like the #WORKSPACE_IMAGES# substitution string) that those ampersands are not properly escaped and this causes a bunch of cascading errors as a result.[I pointed this out long ago|http://forums.oracle.com/forums/thread.jspa?messageID=1244310] for exactly the same reasons. If this was fixed it would be a lot easier to identify more significant problems.
    So my question is this: is anyone out there from the Apex development team at Oracle looking at this? Or is it not even on the radar?Although the ampersand issue has not been fully resolved, there has been resolution or improvement of a lot of the areas that caused validation errors at the time of that post. However (to the indignation of the majority I suspect) I would have preferred more progress in this dull and invisible area than on more obvious enhancements, on the grounds that getting the basics sorted would provide a better platform to develop these new features on, with less possibility of [introducing further non-compliance in those features|http://forums.oracle.com/forums/thread.jspa?messageID=3228587&#3228587].
    Does any one else care about this?Yes. See links above. I was trying to find the time to jump into that current thread.
    Where do you stand on HTML validation?Coincidentally, I came across a link to this earlier tonight, which as it turns out is close to my own thoughts on XHTML and validation. Browsers are more forgiving than compilers (as a programmer I wish that they weren't), so (X)HTML and CSS validation plays the same role in my XHTML/CSS workflow as the first pass through the PL/SQL compiler does with database code, or lint-type tools do in other languages: it generates errors and warnings that inform me that there is something wrong with that code. If I can fix it I do, but if it comes out of the APEX engine rather than a template...
    Is it a moot point if your application looks/behaves the way you want it to?Looking at the way HTML and CSS are used in the built-in templates, the solutions provided in this forum, and some of the projects I've worked on, that seems to be the majority view. Little or no thought is given to using semantic HTML to provide structure, or CSS that uses anything other than basic class selectors (even [&lt;font&gt; elements usually put in a Forum appearance every month or two|http://forums.oracle.com/forums/thread.jspa?threadID=998662]), and standards-based development in APEX has suffered because of it. Arguments have been made that it was/is necessary either due to lack of (cross-) browser support, and/or to reduce the learning curve for those starting with web technologies. The former is (thankfully) becoming less of an issue, and I have disagreed with the latter point since it was first put forward: that was the recipe for [tag soup|http://en.wikipedia.org/wiki/Tag_soup] in the first place.
    It would be preferable to be in the position where the level of standards compliance in our applications was completely in our own hands through having control of all the outputs generated by APEX, either through some kind of exposure of the engine, or a move to entirely template-based output. Those who have a preference or need for standards compliance would be able to make the necessary efforts and the rest could ignore it. I'd like to have that option.

  • Can't Edit Valid CSS/HTML page with DW

    I have a page that contains valid HTML and CSS but it is VERY
    hard to edit with DW-CS3. The formatting in design view looks
    nothing like the page when displayed in a browser. I can always
    edit the code directly via the code view but I have users that want
    to update the site using the design view. Maybe I don't have DW set
    up properly . Can someone take a look and let me know if this page
    can be edited? Will it require CSS changes ? Thanks in advance for
    any help.
    Here's a link to the page: www.nysga.org/indexnew.html

    Sure they do.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "josie1one" <[email protected]> wrote in message
    news:fqk3pk$b8s$[email protected]..
    >> Here's some links to screenshots - in the top gif
    you'll notice that the
    >> LOGO doesn't even display.
    > To the best of my knowledge a background image will not
    display in design
    > view. Mine certainly don't.
    >
    > --
    > Jo
    >
    >
    >
    >
    > "tobgolflink" <[email protected]> wrote
    in message
    > news:fqk386$akv$[email protected]..
    >> Maybe I wasn't clear with my original message. The
    problem is that the
    >> design
    >> view doesn't format properly. I'll add some links to
    screenshots of what
    >> DW
    >> looks like when I try to edit the page. You can try
    it yourself. Save the
    >> page
    >> and the CSS locally and see what it looks like in
    DW.
    >> Here's some links to screenshots - in the top gif
    you'll notice that the
    >> LOGO
    >> doesn't even display.
    >> In the bottom gif you'll see the the right side
    navigation is on the
    >> left.
    >>
    http://www.nysga.org/top.gif
    >>
    http://www.nysga.org/bottom.gif
    >>
    >
    >

  • HTML 5 and Spry.. Making custom attributes valid

    The HTML 5 spec is still a "Editors Draft" but doesn't mean browser haven't started intergating it. While i was reading through the specification i noticed that HTML allows you to specify custom attributes on elements (see: http://dev.w3.org/html5/spec/Overview.html#embedding-custom-non-visible-data ). We all know Spry also uses custom attributes for the Spry dataset. These are typically prefixed with spry:action_here=""
    At this point its not valid HTML even though, when serving your page as xhtml it should be valid.. as xml allows you to specify custom attributes as well. But that aside, with the release of HTML5 getting closer and closer we could make Spry attibutes valid if we started prefixing all custom attributes with data-
    For example:
    spry:region="ds1"     =>     data-spry:region="ds1"
    spry:if="0 == false"  =>     data-spry:if="0 == false"
    A switch to the data- prefix would require very little editing of the existing spry files. The only thing users would have to do, is switch to the HTML5 doc type declaring to make it valid. As this doc type has backwards compatiblity and do not force IE6 in quirksmode i feel this is better alternative to externalizing the custom attributes or waiting for browser to support extended doctypes.
    So i wonder what you opinions are on this . Is Spry ready for HTML5 and is HTML5 ready for Spry ?

    Am I excited about the upcoming HTML5? YES!  But not because it validates our Spry attributes.
    Spry, if used properly, already works well and the fact that it is not validated by W3C can be regarded as a curious fact. Sort of like a driver of mine that has not been validated by Microsoft; without the driver my hardware does not work. So what do I do?
    Well for some people its not a problem that the pages do not validate. But there companies and clients who value validation. Its understandable because people are overhyping it. In this case, it would allow to validate out of the box, without any changes to your code. Making it easier for starting developers and create a W3C valid document.
    I am excited about the new HTML5 elements that will be introduced, hopefully making life easier.
    Well doesn't really make a life easier. I'm currently creating my online resume in HTML and its harder... Normally you would just use divs for almost every layout wrapper now you got to choose between aside, section, article, details, hgroup, header etc. So much elements to choose from, but using them wisely is the hard part.
    I am not excited about the fact that HTML5, being backward compatible, will come with the deficiencies of its predecesors
    I am confused about the near simultaneous release of XHTML2. Where is the logic? Cannot the regulators and validators agree on a standard? I guess not. Even the browser-producers cannot agree on a standard. Remember the confusion with audio and video tapes?
    All of this confusion only adds weight to my argument, who cares about W3C validation or Microsoft validation? if it works it works!
    Some people like it strict some people don't, for performance reasons i actually choose for the loose version. It allows me to build a more compressed file .
    Video codec wars are fun to.. Ogg  vs MPEG. Using flash as fallback or silver light for unsupported browsers, or just generate multiple formats.. Hard to choose.. I personally hope h.264 codec will be used because its quality wise its much better. But we will see what the browser vendors will decide. 

  • Does WebLogic's generated HTML pass W3C HTML/xHTML validation?

    A client needs to use WebLogic AND make sure that the final code is valid HTML
    4.01 or XHTML 1.0 transitional code. What tools exist in the IDE to insure that
    syntactically correct client code is generated?

    Yes, there is a W3C utility, but can only be used "after the fact", after the finished
    web page has been generated and sent on to the browser. Is there a way from within
    the BEA environment to insure that code created is valid HTML/XHTML?
    "Mark Griffith" <[email protected]> wrote:
    I am pretty sure there is nothing in the IDE to check this. Doesnt WC3
    have
    a utility to do this for you?
    cheers
    mbg
    "Chris Spurgeon" <[email protected]> wrote in message
    news:[email protected]..
    A client needs to use WebLogic AND make sure that the final code isvalid
    HTML
    4.01 or XHTML 1.0 transitional code. What tools exist in the IDE toinsure that
    syntactically correct client code is generated?

  • How to use the validation.xml in struts validation?

    Can any one please help me, how to use the validation.xml in struts validation? possible please give me simple example.
    Edited by: SathishkumarAyyavoo on Jan 31, 2009 12:03 PM

    These 2 are the good articles for the beginners to do validation things in Struts. you can follow any one of them.
    1. [http://viralpatel.net/blogs/2009/01/struts-validation-framework-tutorial-example-validator-struts-validation-form-validation.html]
    2. [http://www.vaannila.com/struts/struts-example/struts-custom-validation-example-1.html]
    All the best.

  • How do I convert an html design web site to CSS template and layout?

    Good Morning, All!
    How can I convert, apply, or change, efficiently, my html web pages into a CSS template so I don’t have to change each page every time I add something to the main page…also, I currently have two tables (I know, old-fashioned) one which holds my list of contents and links to the different sections (page) with information from the community on the website. The other table holds my text and pictures which I want to update daily. How can I change the format to a 2 column, liquid layout with a masthead area on top for logo and text with a box around it. Time was not available for me to learn all the details of my new Dreamweaver program so I did what I knew and uploaded it with all the boo-boos, inactive links and non-existant pages.
    Now I have the time to focus and want to get it done better so that it is easy to update with new text and features daily. (I am converting my printed newspaper to an online version after 17 plus years and trying to learn the new Adobe Premium Design Suite CS5 programs. What a trip this is at 61-years-old!
    My community and readership are looking forward to the web site according to a survey I took. They are very tolerant about my boo-boos while I learn the new software for the web design. I’ve let them know, through my newspaper and personally (I am very active in the community), that online is where I am going and all that I’ve spoken to, or who have sent emails, are very supportive and look forward to getting their news from my web site newspaper.)
    I am seeking some guidance...I know a little about a lot, but not a lot about anything...even though I've been working with computers since 1983.
    I thank you all in advance for whatever help you can give.
    Donna

    That's a good start.  You will want to fix these things -
    * change this -
    Don Lawton. Used with permission. <div></p>
    to this -
    Don Lawton. Used with permission.</p>
    * change this -
    </center>
    </P>
    <div align="center"><a href="mailto:
    to this -
    </center>
    <div align="center"><a href="mailto:
    * change this -
    <p>
      <center>
        <b><font size="+1">Webmistress: Donna Lee Hanlon<br />
          c/o www.Nahant.com &middot; PO Box 88 &middot; Nahant, MA 01908<br />
          Copyright 2002-12</font></b>
      </center>
    </p>
    to this -
    <p style="text-align:center;">
        <b><font size="+1">Webmistress: Donna Lee Hanlon<br />
          c/o www.Nahant.com &middot; PO Box 88 &middot; Nahant, MA 01908<br />
          Copyright 2002-12</font></b>
    </p>
    And now you will have a page that contains completely valid HTML.

Maybe you are looking for