Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.
javax.swing.text.html.parser

Class Parser

  • All Implemented Interfaces:
    DTDConstants
    Direct Known Subclasses:
    DocumentParser

    public class Parser
    extends Object
    implements DTDConstants
    A simple DTD-driven HTML parser. The parser reads an HTML file from an InputStream and calls various methods (which should be overridden in a subclass) when tags and data are encountered.

    Unfortunately there are many badly implemented HTML parsers out there, and as a result there are many badly formatted HTML files. This parser attempts to parse most HTML files. This means that the implementation sometimes deviates from the SGML specification in favor of HTML.

    The parser treats \r and \r\n as \n. Newlines after starttags and before end tags are ignored just as specified in the SGML/HTML specification.

    The html spec does not specify how spaces are to be coalesced very well. Specifically, the following scenarios are not discussed (note that a space should be used here, but I am using &nbsp to force the space to be displayed):

    '<b>blah <i> <strike> foo' which can be treated as: '<b>blah <i><strike>foo'

    as well as: '<p><a href="https://www.gaudry.be/nl/java-api-rf-javax/swing/text/html/parser/xx"> <em>Using</em></a></p>' which appears to be treated as: '<p><a href="https://www.gaudry.be/nl/java-api-rf-javax/swing/text/html/parser/xx"><em>Using</em></a></p>'

    If strict is false, when a tag that breaks flow, (TagElement.breaksFlows) or trailing whitespace is encountered, all whitespace will be ignored until a non whitespace character is encountered. This appears to give behavior closer to the popular browsers.

    See Also:
    DTD, TagElement, SimpleAttributeSet
    • Field Detail

      • dtd

        protected DTD dtd
      • strict

        protected boolean strict
        This flag determines whether or not the Parser will be strict in enforcing SGML compatibility. If false, it will be lenient with certain common classes of erroneous HTML constructs. Strict or not, in either case an error will be recorded.
    • Constructor Detail

      • Parser

        public Parser(DTD dtd)
    • Method Detail

      • getCurrentLine

        protected int getCurrentLine()
        Returns:
        the line number of the line currently being parsed
      • makeTag

        protected TagElement makeTag(Element elem,
                         boolean fictional)
        Makes a TagElement.
      • flushAttributes

        protected void flushAttributes()
      • handleText

        protected void handleText(char[] text)
        Called when PCDATA is encountered.
      • handleTitle

        protected void handleTitle(char[] text)
        Called when an HTML title tag is encountered.
      • handleComment

        protected void handleComment(char[] text)
        Called when an HTML comment is encountered.
      • handleEOFInComment

        protected void handleEOFInComment()
      • handleStartTag

        protected void handleStartTag(TagElement tag)
        Called when a start tag is encountered.
      • handleEndTag

        protected void handleEndTag(TagElement tag)
        Called when an end tag is encountered.
      • handleError

        protected void handleError(int ln,
                       String msg)
        An error has occurred.
      • error

        protected void error(String err)
      • endTag

        protected void endTag(boolean omitted)
        Handle an end tag. The end tag is popped from the tag stack.
      • markFirstTime

        protected void markFirstTime(Element elem)
        Marks the first time a tag has been seen in a document
      • parseDTDMarkup

        public String parseDTDMarkup()
                              throws IOException
        Parses th Document Declaration Type markup declaration. Currently ignores it.
        Throws:
        IOException
      • parseMarkupDeclarations

        protected boolean parseMarkupDeclarations(StringBuffer strBuff)
                                           throws IOException
        Parse markup declarations. Currently only handles the Document Type Declaration markup. Returns true if it is a markup declaration false otherwise.
        Throws:
        IOException
      • getCurrentPos

        protected int getCurrentPos()

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/text/html/parser/parser.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut