import "code.google.com/p/go.net/html/atom"
atom包提供了经常出现的HTML字符串(标签名和属性名,如"p"和"id")的整数码(也被成为atom)。
在提取HTML的token和解析时,所有共用同一个标签的元素可以共享一个atom名,可以实现更少的字符串申请。整数的比较一般也比字符串的比较更快。
atom的具体码值;不保证在本包不同版本保持一致;不保证atom的码值顺序;不保证码值连续分布。只保证例如"div"对应atom.Div,调用atom.Div.String会返回"div",且atom.Div != 0。
func String(s []byte) string
String返回一个字符串,其内容和s相同。本函数等价于 string(s)但更有效率。
type Atom uint32
Atom是字符串的整数码,零值代表""。
const ( A Atom = 0x1 Abbr Atom = 0x4 Accept Atom = 0x2106 AcceptCharset Atom = 0x210e Accesskey Atom = 0x3309 Action Atom = 0x21b06 Address Atom = 0x5d507 Align Atom = 0x1105 Alt Atom = 0x4503 Annotation Atom = 0x18d0a AnnotationXml Atom = 0x18d0e Applet Atom = 0x2d106 Area Atom = 0x31804 Article Atom = 0x39907 Aside Atom = 0x4f05 Async Atom = 0x9305 Audio Atom = 0xaf05 Autocomplete Atom = 0xd50c Autofocus Atom = 0xe109 Autoplay Atom = 0x10c08 B Atom = 0x101 Base Atom = 0x11404 Basefont Atom = 0x11408 Bdi Atom = 0x1a03 Bdo Atom = 0x12503 Bgsound Atom = 0x13807 Big Atom = 0x14403 Blink Atom = 0x14705 Blockquote Atom = 0x14c0a Body Atom = 0x2f04 Border Atom = 0x15606 Br Atom = 0x202 Button Atom = 0x15c06 Canvas Atom = 0x4b06 Caption Atom = 0x1e007 Center Atom = 0x2df06 Challenge Atom = 0x23e09 Charset Atom = 0x2807 Checked Atom = 0x33f07 Cite Atom = 0x9704 Class Atom = 0x3d905 Code Atom = 0x16f04 Col Atom = 0x17603 Colgroup Atom = 0x17608 Color Atom = 0x18305 Cols Atom = 0x18804 Colspan Atom = 0x18807 Command Atom = 0x19b07 Content Atom = 0x42c07 Contenteditable Atom = 0x42c0f Atom = 0x3480b Controls Atom = 0x1ae08 Coords Atom = 0x1ba06 Crossorigin Atom = 0x1c40b Data Atom = 0x44304 Datalist Atom = 0x44308 Datetime Atom = 0x25b08 Dd Atom = 0x28802 Default Atom = 0x5207 Defer Atom = 0x17105 Del Atom = 0x4d603 Desc Atom = 0x4804 Details Atom = 0x6507 Dfn Atom = 0x8303 Dialog Atom = 0x1b06 Dir Atom = 0x9d03 Dirname Atom = 0x9d07 Disabled Atom = 0x10008 Div Atom = 0x10703 Dl Atom = 0x13e02 Download Atom = 0x40908 Draggable Atom = 0x1a109 Dropzone Atom = 0x3a208 Dt Atom = 0x4e402 Em Atom = 0x7f02 Embed Atom = 0x7f05 Enctype Atom = 0x23007 Face Atom = 0x2dd04 Fieldset Atom = 0x1d508 Atom = 0x1dd0a Figure Atom = 0x1f106 Font Atom = 0x11804 Atom = 0x5906 For Atom = 0x1fd03 ForeignObject Atom = 0x1fd0d Foreignobject Atom = 0x20a0d Form Atom = 0x21704 Formaction Atom = 0x2170a Formenctype Atom = 0x22c0b Formmethod Atom = 0x2470a Formnovalidate Atom = 0x2510e Formtarget Atom = 0x2660a Frame Atom = 0x8705 Frameset Atom = 0x8708 H1 Atom = 0x13602 H2 Atom = 0x29602 H3 Atom = 0x2c502 H4 Atom = 0x30e02 H5 Atom = 0x4e602 H6 Atom = 0x27002 Head Atom = 0x2fa04 Header Atom = 0x2fa06 Headers Atom = 0x2fa07 Height Atom = 0x27206 Hgroup Atom = 0x27a06 Hidden Atom = 0x28606 High Atom = 0x29304 Hr Atom = 0x13102 Href Atom = 0x29804 Hreflang Atom = 0x29808 Html Atom = 0x27604 HttpEquiv Atom = 0x2a00a I Atom = 0x601 Icon Atom = 0x42b04 Id Atom = 0x5102 Iframe Atom = 0x2b406 Image Atom = 0x2ba05 Img Atom = 0x2bf03 Inert Atom = 0x4c105 Input Atom = 0x3f605 Ins Atom = 0x1cd03 Isindex Atom = 0x2c707 Ismap Atom = 0x2ce05 Itemid Atom = 0x9806 Itemprop Atom = 0x57e08 Itemref Atom = 0x2d707 Itemscope Atom = 0x2e509 Itemtype Atom = 0x2ef08 Kbd Atom = 0x1903 Keygen Atom = 0x3906 Keytype Atom = 0x51207 Kind Atom = 0xfd04 Label Atom = 0xba05 Lang Atom = 0x29c04 Legend Atom = 0x1a806 Li Atom = 0x1202 Link Atom = 0x14804 List Atom = 0x44704 Listing Atom = 0x44707 Loop Atom = 0xbe04 Low Atom = 0x13f03 Malignmark Atom = 0x100a Manifest Atom = 0x5b608 Map Atom = 0x2d003 Mark Atom = 0x1604 Marquee Atom = 0x5f207 Math Atom = 0x2f704 Max Atom = 0x30603 Maxlength Atom = 0x30609 Media Atom = 0xa205 Mediagroup Atom = 0xa20a Menu Atom = 0x34f04 Meta Atom = 0x45604 Meter Atom = 0x26105 Method Atom = 0x24b06 Mglyph Atom = 0x2c006 Mi Atom = 0x9b02 Min Atom = 0x31003 Mn Atom = 0x25402 Mo Atom = 0x47a02 Ms Atom = 0x2e802 Mtext Atom = 0x31305 Multiple Atom = 0x32108 Muted Atom = 0x32905 Name Atom = 0xa004 Atom = 0x3e03 Nobr Atom = 0x7404 Noembed Atom = 0x7d07 Noframes Atom = 0x8508 Noscript Atom = 0x28b08 Novalidate Atom = 0x2550a Object Atom = 0x21106 Ol Atom = 0xcd02 Onabort Atom = 0x16007 Onafterprint Atom = 0x1e50c Onbeforeprint Atom = 0x21f0d Onbeforeunload Atom = 0x5c90e Onblur Atom = 0x3e206 Oncancel Atom = 0xb308 Oncanplay Atom = 0x12709 Oncanplaythrough Atom = 0x12710 Onchange Atom = 0x3b808 Onclick Atom = 0x2ad07 Onclose Atom = 0x32e07 Atom = 0x3460d Oncuechange Atom = 0x3530b Ondblclick Atom = 0x35e0a Ondrag Atom = 0x36806 Ondragend Atom = 0x36809 Ondragenter Atom = 0x3710b Ondragleave Atom = 0x37c0b Ondragover Atom = 0x3870a Ondragstart Atom = 0x3910b Ondrop Atom = 0x3a006 Ondurationchange Atom = 0x3b010 Onemptied Atom = 0x3a709 Onended Atom = 0x3c007 Onerror Atom = 0x3c707 Onfocus Atom = 0x3ce07 Onhashchange Atom = 0x3e80c Oninput Atom = 0x3f407 Oninvalid Atom = 0x3fb09 Onkeydown Atom = 0x40409 Onkeypress Atom = 0x4110a Onkeyup Atom = 0x42107 Onload Atom = 0x43b06 Onloadeddata Atom = 0x43b0c Onloadedmetadata Atom = 0x44e10 Onloadstart Atom = 0x4640b Onmessage Atom = 0x46f09 Onmousedown Atom = 0x4780b Onmousemove Atom = 0x4830b Onmouseout Atom = 0x48e0a Onmouseover Atom = 0x49b0b Onmouseup Atom = 0x4a609 Onmousewheel Atom = 0x4af0c Onoffline Atom = 0x4bb09 Ononline Atom = 0x4c608 Onpagehide Atom = 0x4ce0a Onpageshow Atom = 0x4d90a Onpause Atom = 0x4e807 Onplay Atom = 0x4f206 Onplaying Atom = 0x4f209 Onpopstate Atom = 0x4fb0a Onprogress Atom = 0x5050a Onratechange Atom = 0x5190c Onreset Atom = 0x52507 Onresize Atom = 0x52c08 Onscroll Atom = 0x53a08 Onseeked Atom = 0x54208 Onseeking Atom = 0x54a09 Onselect Atom = 0x55308 Onshow Atom = 0x55d06 Onstalled Atom = 0x56609 Onstorage Atom = 0x56f09 Onsubmit Atom = 0x57808 Onsuspend Atom = 0x58809 Ontimeupdate Atom = 0x1190c Onunload Atom = 0x59108 Onvolumechange Atom = 0x5990e Onwaiting Atom = 0x5a709 Open Atom = 0x58404 Optgroup Atom = 0xc008 Optimum Atom = 0x5b007 Option Atom = 0x5c506 Output Atom = 0x49506 P Atom = 0xc01 Param Atom = 0xc05 Pattern Atom = 0x6e07 Ping Atom = 0xab04 Placeholder Atom = 0xc70b Plaintext Atom = 0xf109 Poster Atom = 0x17d06 Pre Atom = 0x27f03 Preload Atom = 0x27f07 Progress Atom = 0x50708 Prompt Atom = 0x5bf06 Public Atom = 0x42706 Q Atom = 0x15101 Radiogroup Atom = 0x30a Readonly Atom = 0x31908 Rel Atom = 0x28003 Required Atom = 0x1f508 Reversed Atom = 0x5e08 Rows Atom = 0x7704 Rowspan Atom = 0x7707 Rp Atom = 0x1eb02 Rt Atom = 0x16502 Ruby Atom = 0xd104 S Atom = 0x2c01 Samp Atom = 0x6b04 Sandbox Atom = 0xe907 Scope Atom = 0x2e905 Scoped Atom = 0x2e906 Script Atom = 0x28d06 Seamless Atom = 0x33308 Section Atom = 0x3dd07 Select Atom = 0x55506 Selected Atom = 0x55508 Shape Atom = 0x1b505 Size Atom = 0x53004 Sizes Atom = 0x53005 Small Atom = 0x1bf05 Source Atom = 0x1cf06 Spacer Atom = 0x30006 Span Atom = 0x7a04 Spellcheck Atom = 0x33a0a Src Atom = 0x3d403 Srcdoc Atom = 0x3d406 Srclang Atom = 0x41a07 Start Atom = 0x39705 Step Atom = 0x5bc04 Strike Atom = 0x50e06 Strong Atom = 0x53406 Style Atom = 0x5db05 Sub Atom = 0x57a03 Summary Atom = 0x5e007 Sup Atom = 0x5e703 Svg Atom = 0x5ea03 System Atom = 0x5ed06 Tabindex Atom = 0x45c08 Table Atom = 0x43605 Target Atom = 0x26a06 Tbody Atom = 0x2e05 Td Atom = 0x4702 Textarea Atom = 0x31408 Tfoot Atom = 0x5805 Th Atom = 0x13002 Thead Atom = 0x2f905 Time Atom = 0x11b04 Title Atom = 0x8e05 Tr Atom = 0xf902 Track Atom = 0xf905 Translate Atom = 0x16609 Tt Atom = 0x7002 Type Atom = 0x23304 Typemustmatch Atom = 0x2330d U Atom = 0xb01 Ul Atom = 0x5602 Usemap Atom = 0x4ec06 Value Atom = 0x4005 Var Atom = 0x10903 Video Atom = 0x2a905 Wbr Atom = 0x14103 Width Atom = 0x4e205 Wrap Atom = 0x56204 Xmp Atom = 0xef03 )
func Lookup(s []byte) Atom
Lookup返回名为s的Atom。如果不存在该Atom会返回零值。本函数是大小写敏感的。
func (a Atom) String() string
String返回Atom的名称。