JavaTM 2
Platform
Std.  Ed.  v1. 4.0

javax.swing.text.html.parser
Ŭ·¡½º Parser

java.lang.Object 
  |
  +--javax.swing.text.html.parser.Parser
¸ðµç ±¸Çö ÀÎÅÍÆäÀ̽º:
DTDConstants
Á÷°èÀÇ ±âÁ¸ÀÇ ¼­ºê Ŭ·¡½º:
DocumentParser

public class Parser
extends Object
implements DTDConstants

DTD ±¸µ¿ÇüÀÇ, ´Ü¼øÇÑ HTML ÆÄ¼­ÀÔ´Ï´Ù. ÆÄ¼­´Â InputStream ·ÎºÎÅÍ HTML ÆÄÀÏÀ» Àо, ű׳ª µ¥ÀÌÅ͸¦ °ËÃâÇϸé(ÀÚ), °¢Á¾ÀÇ ¸Þ¼Òµå (¼­ºê Ŭ·¡½º¿¡¼­ ¿À¹ö¶óÀ̵å(override) µÈ´Ù)¸¦ È£ÃâÇÕ´Ï´Ù.

À¯°¨½º·´°Ô, ¿Ã¹Ù¸£°Ô ±¸ÇöµÇ¾î ÀÖÁö ¾ÊÀº HTML ÆÄ¼­°¡ ¸¹ÀÌ ³ªµ¹°í ÀÖ½À´Ï´Ù. ±× °á°ú, ¼­½ÄÀÇ ¿Ã¹Ù¸£Áö ¾ÊÀº HTML ÆÄÀϵµ ´Ù¼ö Á¸ÀçÇÕ´Ï´Ù. ÀÌ ÆÄ¼­´Â ´ëºÎºÐÀÇ HTML ÆÄÀÏÀÇ ÇØ¼®À» ½ÃµµÇÕ´Ï´Ù. Áï, ÀÌ ±¸ÇöÀº HTML ¸¦ ¿ì¼±ÇØ, SGML ÀÇ »ç¾ç°ú´Â ´Ù¸¥ °æ¿ìµµ ÀÖ½À´Ï´Ù.

ÀÌ ÆÄ¼­´Â \r ¹× \r\n ¸¦ \n ·Î¼­ Ãë±ÞÇÕ´Ï´Ù. °³½Ã ű×ÀÇ µÚ, ¹× Á¾·á ű×ÀÇ ÀüÀÇ °³ÇàÀº SGML ³ª HTML ÀÇ »ç¾ç¿¡ µû¶ó ¹«½ÃµË´Ï´Ù.

HTML »ç¾ç¿¡¼­´Â °ø¹é ij¸¯ÅͰ¡ ¾î¶»°Ô ¿¬¼ÓÇұ ÀÓÇØ¼­ ¸íÈ®ÇÏ°Ô ÁöÁ¤µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. ƯÈ÷, ´ÙÀ½°ú °°Àº ½Ã³ª¸®¿À¿¡ ´ëÇØ¼­´Â ³íÀǵǰí ÀÖÁö ¾Ê½À´Ï´Ù (¿©±â¿¡¼­´Â °ø¹é ij¸¯Å͸¦ »ç¿ëÇØ¾ß ÇÏÁö¸¸, °ø¹é ij¸¯ÅÍÀÇ Ç¥½Ã¿¡ &nbsp ¸¦ »ç¿ëÇϰí ÀÖ´Ù).

¡¸<b>blah <i> <strike> foo¡¹´Â ¡¸<b>blah <i><strike>foo¡¹¿Í °°Àº °ÍÀ¸·Î¼­ ´Ù·ç¾îÁý´Ï´Ù.

°°ÀÌ ¡¸<p><a href="xx"> <em>Using</em></a></p>¡¹´Â ¡¸<p><a href="xx"><em>Using</em></a></p>¡¹¿Í °°Àº °ÍÀ¸·Î¼­ ´Ù·ç¾îÁý´Ï´Ù.

strict °¡ false ÀÇ °æ¿ì, Ç÷οì(flow)¸¦ ºê·¹ÀÌÅ©ÇÏ´Â ÅÂ±× (TagElement.breaksFlows)³ª ¸»¹Ì¿¡ °ø¹éÀÌ ¹ß°ßµÇ¸é(ÀÚ), °ø¹é ÀÌ¿ÜÀÇ Ä³¸¯ÅͰ¡ ¹ß°ßµÉ ¶§±îÁö °ø¹éÀº ¸ðµÎ ¹«½ÃµË´Ï´Ù. À̰Ϳ¡ ÀÇÇØ, ÀϹÝÀûÀÎ ºê¶ó¿ìÀú¿¡ µ¿ÀÛÀÌ °¡±î¿î ½ÃÀϳ»¿¡ µË´Ï´Ù.

°ü·Ã Ç׸ñ:
DTD , TagElement , SimpleAttributeSet

ÇʵåÀÇ °³¿ä
protected  DTD dtd
           
protected  boolean strict
          ÀÌ Ç÷¡±×´Â Parser °¡ SGML ¿ÍÀÇ È£È¯¼ºÀ» ¾ö¹ÐÇÏ°Ô Á¶»çÇÒÁö ¾î¶³Áö¸¦ °áÁ¤ÇÕ´Ï´Ù.
 
ÀÎÅÍÆäÀ̽º javax.swing.text.html.parser. DTDConstants ¿¡¼­ »ó¼Ó¹ÞÀº Çʵå
ANY , CDATA , CONREF , CURRENT , DEFAULT , EMPTY , ENDTAG , ENTITIES , ENTITY , FIXED , GENERAL , ID , IDREF , IDREFS , IMPLIED , MD , MODEL , MS , NAME , NAMES , NMTOKEN , NMTOKENS , NOTATION , NUMBER , NUMBERS , NUTOKEN , NUTOKENS , PARAMETER , PI , PUBLIC , RCDATA , REQUIRED , SDATA , STARTTAG , SYSTEM
 
»ý¼ºÀÚÀÇ °³¿ä
Parser (DTD  dtd)
           
 
¸Þ¼ÒµåÀÇ °³¿ä
protected  void endTag (boolean omitted)
          Á¾·á ű׸¦ ó¸®ÇÕ´Ï´Ù.
protected  void error (String  err)
           
protected  void error (String  err, String  arg1)
           
protected  void error (String  err, String  arg1, String  arg2)
           
protected  void error (String  err, String  arg1, String  arg2, String  arg3)
          ¿¡·¯ Çڵ鷯¸¦ È£ÃâÇÕ´Ï´Ù.
protected  void flushAttributes ()
           
protected  SimpleAttributeSet getAttributes ()
           
protected  int getCurrentLine ()
           
protected  int getCurrentPos ()
           
protected  void handleComment (char[] text)
          HTML ÀÇ ÄÚ¸àÆ®¸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.
protected  void handleEmptyTag (TagElement  tag)
          ÇÏ´ÃÀÇ Å±׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.
protected  void handleEndTag (TagElement  tag)
          Á¾·á ű׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.
protected  void handleEOFInComment ()
           
protected  void handleError (int ln, String  msg)
          ¿¡·¯°¡ ¹ß»ýÇÑ °ÍÀ» ³ªÅ¸³À´Ï´Ù.
protected  void handleStartTag (TagElement  tag)
          °³½Ã ű׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.
protected  void handleText (char[] text)
          PCDATA ¸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.
protected  void handleTitle (char[] text)
          HTML ÀÇ title ű׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.
protected  TagElement makeTag (Element  elem)
           
protected  TagElement makeTag (Element  elem, boolean fictional)
          TagElement ¸¦ ÀÛ¼ºÇÕ´Ï´Ù.
protected  void markFirstTime (Element  elem)
          ¹®¼­³»¿¡¼­ ÃÖÃÊ·Î ¹ß°ßµÈ ű׿¡ ¸¶Å©¸¦ ºÙÀÔ´Ï´Ù.
 void parse (Reader  in)
          DTD °¡ ÁöÁ¤µÇ°í ÀÖ´Â °æ¿ì¿¡, HTML ½ºÆ®¸²À» ÇØ¼®ÇÕ´Ï´Ù.
 String parseDTDMarkup ()
          ¹®¼­Çü Á¤ÀÇ (DTD - Document Type Declaration)ÀÇ ¸¶Å© ¾÷ ¼±¾ðÀ» ÇØ¼®ÇÕ´Ï´Ù.
protected  boolean parseMarkupDeclarations (StringBuffer  strBuff)
          ¸¶Å© ¾÷ ¼±¾ðÀ» ÇØ¼®ÇÕ´Ï´Ù.
protected  void startTag (TagElement  tag)
          °³½Ã ű׸¦ ó¸®ÇÕ´Ï´Ù.
 
Ŭ·¡½º java.lang. Object ¿¡¼­ »ó¼Ó¹ÞÀº ¸Þ¼Òµå
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

ÇʵåÀÇ »ó¼¼

dtd

protected DTD  dtd

strict

protected boolean strict
ÀÌ Ç÷¡±×´Â Parser °¡ SGML ¿ÍÀÇ È£È¯¼ºÀ» ¾ö¹ÐÇÏ°Ô Á¶»çÇÒÁö ¾î¶³Áö¸¦ °áÁ¤ÇÕ´Ï´Ù. false ÀÇ °æ¿ì, Parser ´Â ºÎÁ¤ÇÑ HTML ¿ø°¡¿ä¼Ò·ÎºÎÅÍ µÇ´Â ƯÁ¤ÀÇ °øÅë Ŭ·¡½º¿¡ ´ëÇØ¼­´Â ³Ê±×·Î¿î ÇØ¼®À» ½Ç½ÃÇÕ´Ï´Ù. ¾ö¹ÐÇÑ °æ¿ìµµ ±×·¸Áö ¾ÊÀº °æ¿ìµµ, ¿¡·¯´Â ±â·ÏµË´Ï´Ù.

»ý¼ºÀÚÀÇ »ó¼¼

Parser

public Parser(DTD  dtd)
¸Þ¼ÒµåÀÇ »ó¼¼

getCurrentLine

protected int getCurrentLine()
¹Ýȯ°ª:
ÇöÀç ÇØ¼®ÁßÀÇ ÇàÀÇ Çà ¹øÈ£

makeTag

protected TagElement  makeTag(Element  elem,
                             boolean fictional)
TagElement ¸¦ ÀÛ¼ºÇÕ´Ï´Ù.


makeTag

protected TagElement  makeTag(Element  elem)

getAttributes

protected SimpleAttributeSet  getAttributes()

flushAttributes

protected void flushAttributes()

handleText

protected void handleText(char[] text)
PCDATA ¸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.


handleTitle

protected void handleTitle(char[] text)
HTML ÀÇ title ű׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.


handleComment

protected void handleComment(char[] text)
HTML ÀÇ ÄÚ¸àÆ®¸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.


handleEOFInComment

protected void handleEOFInComment()

handleEmptyTag

protected void handleEmptyTag(TagElement  tag)
                       throws ChangedCharSetException 
ÇÏ´ÃÀÇ Å±׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.

ChangedCharSetException

handleStartTag

protected void handleStartTag(TagElement  tag)
°³½Ã ű׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.


handleEndTag

protected void handleEndTag(TagElement  tag)
Á¾·á ű׸¦ °ËÃâÇßÀ» ¶§¿¡ ºÒ·Á °©´Ï´Ù.


handleError

protected void handleError(int ln,
                           String  msg)
¿¡·¯°¡ ¹ß»ýÇÑ °ÍÀ» ³ªÅ¸³À´Ï´Ù.


error

protected void error(String  err,
                     String  arg1,
                     String  arg2,
                     String  arg3)
¿¡·¯ Çڵ鷯¸¦ È£ÃâÇÕ´Ï´Ù.


error

protected void error(String  err,
                     String  arg1,
                     String  arg2)

error

protected void error(String  err,
                     String  arg1)

error

protected void error(String  err)

startTag

protected void startTag(TagElement  tag)
                 throws ChangedCharSetException 
°³½Ã ű׸¦ ó¸®ÇÕ´Ï´Ù. »õ·Î¿î űװ¡, ű×ÀÇ ½ºÅÿ¡ Ǫ½¬ µË´Ï´Ù. ¼Ó¼º ¸®½ºÆ®¸¦ Á¶»çÇØ, ÇÊ¿äÇÑ ¼Ó¼ºÀ» ã½À´Ï´Ù.

ChangedCharSetException

endTag

protected void endTag(boolean omitted)
Á¾·á ű׸¦ ó¸®ÇÕ´Ï´Ù. Á¾·á ű״ Å±×ÀÇ ½ºÅÃÀ¸·ÎºÎÅÍ ÆË µË´Ï´Ù.


markFirstTime

protected void markFirstTime(Element  elem)
¹®¼­³»¿¡¼­ ÃÖÃÊ·Î ¹ß°ßµÈ ű׿¡ ¸¶Å©¸¦ ºÙÀÔ´Ï´Ù.


parseDTDMarkup

public String  parseDTDMarkup()
                      throws IOException 
¹®¼­Çü Á¤ÀÇ (DTD - Document Type Declaration)ÀÇ ¸¶Å© ¾÷ ¼±¾ðÀ» ÇØ¼®ÇÕ´Ï´Ù. ÇöÀç´Â À̰ÍÀ» ¹«½ÃÇÕ´Ï´Ù.

IOException

parseMarkupDeclarations

protected boolean parseMarkupDeclarations(StringBuffer  strBuff)
                                   throws IOException 
¸¶Å© ¾÷ ¼±¾ðÀ» ÇØ¼®ÇÕ´Ï´Ù. ÇöÀç´Â ¹®¼­Çü Á¤ÀÇ (DTD - Document Type Declaration)¿¡ ÀÇÇÑ ¸¶Å© ¾÷¸¸À» ó¸®ÇÕ´Ï´Ù. ¸¶Å© ¾÷ ¼±¾ðÀÇ °æ¿ì´Â true ¸¦ µ¹·ÁÁÖ¾î, ±×·¸Áö ¾ÊÀº °æ¿ì´Â false ¸¦ µ¹·ÁÁÝ´Ï´Ù.

IOException

parse

public void parse(Reader  in)
           throws IOException 
DTD °¡ ÁöÁ¤µÇ°í ÀÖ´Â °æ¿ì¿¡, HTML ½ºÆ®¸²À» ÇØ¼®ÇÕ´Ï´Ù.

IOException

getCurrentPos

protected int getCurrentPos()

JavaTM 2
Platform
Std.  Ed.  v1. 4.0

¹ö±×ÀÇ º¸°í¿Í ±â´ÉÀÇ ¸®Äù½ºÆ®
ÀÌ¿ÜÀÇ API ·¹ÆÛ·±½º ¹× °³¹ßÀÚ¿ë ¹®¼­¿¡ ´ëÇØ¼­´Â Java 2 SDK SE °³¹ßÀÚ¿ë ¹®¼­¸¦ ÂüÁ¶ÇØ ÁÖ¼¼¿ä. °³¹ßÀÚÀü¿ëÀÇ »ó¼¼ÇÑ ÇØ¼³, °³³äÀÇ °³¿ä, ¿ë¾îÀÇ Á¤ÀÇ, ¹ö±×ÀÇ È¸ÇÇÃ¥, ¹× ÄÚµå ½Ç·Ê°¡ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù.

Java, Java 2 D, ¹× JDBC ´Â ¹Ì±¹ ¹× ±× ¿ÜÀÇ ³ª¶ó¿¡ À־ÀÇ ¹Ì±¹ Sun Microsystems, Inc. ÀÇ »óÇ¥ ȤÀº µî·Ï»óÇ¥ÀÔ´Ï´Ù.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.