loppu
ei toimi...
ei toimi...
HtmlFixer.java siistii ja korjaa syötteenä annetun HTML-fragmentin. Korjatun HTML-fragmentin ympärille lisätään <div>-elementti. Jos siistiminen ei onnistu, ohjelma ei palauta mitään.
Ohjelma käyttää siistimiseen JTidy-ohjelmaa. Ulostulo on useimmissa tilanteissa validia HTML 1.0 Strict -koodia, mutta JTidy ei takaa tuloksen validiutta. Siistimiseen menevä aika on pienillä (<100
Validator.java demonstroi HTML-dokumentin osan tai minkä tahansa XML-dokumentin validointia. Validointi on toteutettu SAX-parserina, joka ei käsittele koodia mitenkään, mutta heittää poikkeuksen ensimmäisestä löytämästään virheestä.
Koodi perustuu pääosin Sunin sivuilla olevaan tutoriaaliin XML:n käsittelystä Javalla: Working with XML.
Yksinkertaiset virheet saa poistettua koodista esikäsittelemällä tiedotHTML Tidy -ohjelmalla. Käyttöesimerkki: (linux, julkaisupäivä 1.2.2002)
Esimerkin asetustiedostolla Tidy muuntaa lähtötiedoston striktiin XHTML 1.0 -muotoon.
Miika Nurminen
22.10.2003
The uploaded file was checked and found to be valid XHTML 1.0 Strict. This means that the resource in question identified itself as “XHTML 1.0 Strict” and that we successfully performed a formal validation using an SGML or XML Parser (depending on the markup language used).
To show your readers that you have taken the care to create an interoperable Web page, you may display this icon on any page that validates. Here is the HTML you could use to add this icon to your Web page:
<p> <a href="http://validator.w3.org/check/referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a> </p>
If you like, you can download a copy of this image (in PNG or GIF format) to keep in your local web directory, and change the HTML fragment above to reference your local image rather than the one on this server.
Copyright © 1994-2003 W3C ® ( MIT , ERCIM , Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.