modified: src/entitymap.go
This commit is contained in:
parent
4857865daf
commit
0cc509e738
259
src/entitymap.go
259
src/entitymap.go
|
@ -7,263 +7,8 @@ package xmlx
|
||||||
ISO 8879, provided this notice is included in all copies.
|
ISO 8879, provided this notice is included in all copies.
|
||||||
*/
|
*/
|
||||||
func entitymap_load(em *map[string]string) {
|
func entitymap_load(em *map[string]string) {
|
||||||
// Generic entities
|
// Generic entities string([]uint8{160});
|
||||||
(*em)["nbsp"] = " ";
|
|
||||||
(*em)["iexcl"] = "¡";
|
|
||||||
(*em)["cent"] = "¢";
|
|
||||||
(*em)["pound"] = "£";
|
|
||||||
(*em)["curren"] = "¤";
|
|
||||||
(*em)["yen"] = "¥";
|
|
||||||
(*em)["brvbar"] = "¦";
|
|
||||||
(*em)["sect"] = "§";
|
|
||||||
(*em)["uml"] = "¨";
|
|
||||||
(*em)["copy"] = "©";
|
|
||||||
(*em)["ordf"] = "ª";
|
|
||||||
(*em)["laquo"] = "«";
|
|
||||||
(*em)["not"] = "¬";
|
|
||||||
(*em)["shy"] = "­";
|
|
||||||
(*em)["reg"] = "®";
|
|
||||||
(*em)["macr"] = "¯";
|
|
||||||
(*em)["deg"] = "°";
|
|
||||||
(*em)["plusmn"] = "±";
|
|
||||||
(*em)["sup2"] = "²";
|
|
||||||
(*em)["sup3"] = "³";
|
|
||||||
(*em)["acute"] = "´";
|
|
||||||
(*em)["micro"] = "µ";
|
|
||||||
(*em)["para"] = "¶";
|
|
||||||
(*em)["middot"] = "·";
|
|
||||||
(*em)["cedil"] = "¸";
|
|
||||||
(*em)["sup1"] = "¹";
|
|
||||||
(*em)["ordm"] = "º";
|
|
||||||
(*em)["raquo"] = "»";
|
|
||||||
(*em)["frac14"] = "¼";
|
|
||||||
(*em)["frac12"] = "½";
|
|
||||||
(*em)["frac34"] = "¾";
|
|
||||||
(*em)["iquest"] = "¿";
|
|
||||||
(*em)["Agrave"] = "À";
|
|
||||||
(*em)["Aacute"] = "Á";
|
|
||||||
(*em)["Acirc"] = "Â";
|
|
||||||
(*em)["Atilde"] = "Ã";
|
|
||||||
(*em)["Auml"] = "Ä";
|
|
||||||
(*em)["Aring"] = "Å";
|
|
||||||
(*em)["AElig"] = "Æ";
|
|
||||||
(*em)["Ccedil"] = "Ç";
|
|
||||||
(*em)["Egrave"] = "È";
|
|
||||||
(*em)["Eacute"] = "É";
|
|
||||||
(*em)["Ecirc"] = "Ê";
|
|
||||||
(*em)["Euml"] = "Ë";
|
|
||||||
(*em)["Igrave"] = "Ì";
|
|
||||||
(*em)["Iacute"] = "Í";
|
|
||||||
(*em)["Icirc"] = "Î";
|
|
||||||
(*em)["Iuml"] = "Ï";
|
|
||||||
(*em)["ETH"] = "Ð";
|
|
||||||
(*em)["Ntilde"] = "Ñ";
|
|
||||||
(*em)["Ograve"] = "Ò";
|
|
||||||
(*em)["Oacute"] = "Ó";
|
|
||||||
(*em)["Ocirc"] = "Ô";
|
|
||||||
(*em)["Otilde"] = "Õ";
|
|
||||||
(*em)["Ouml"] = "Ö";
|
|
||||||
(*em)["times"] = "×";
|
|
||||||
(*em)["Oslash"] = "Ø";
|
|
||||||
(*em)["Ugrave"] = "Ù";
|
|
||||||
(*em)["Uacute"] = "Ú";
|
|
||||||
(*em)["Ucirc"] = "Û";
|
|
||||||
(*em)["Uuml"] = "Ü";
|
|
||||||
(*em)["Yacute"] = "Ý";
|
|
||||||
(*em)["THORN"] = "Þ";
|
|
||||||
(*em)["szlig"] = "ß";
|
|
||||||
(*em)["agrave"] = "à";
|
|
||||||
(*em)["aacute"] = "á";
|
|
||||||
(*em)["acirc"] = "â";
|
|
||||||
(*em)["atilde"] = "ã";
|
|
||||||
(*em)["auml"] = "ä";
|
|
||||||
(*em)["aring"] = "å";
|
|
||||||
(*em)["aelig"] = "æ";
|
|
||||||
(*em)["ccedil"] = "ç";
|
|
||||||
(*em)["egrave"] = "è";
|
|
||||||
(*em)["eacute"] = "é";
|
|
||||||
(*em)["ecirc"] = "ê";
|
|
||||||
(*em)["euml"] = "ë";
|
|
||||||
(*em)["igrave"] = "ì";
|
|
||||||
(*em)["iacute"] = "í";
|
|
||||||
(*em)["icirc"] = "î";
|
|
||||||
(*em)["iuml"] = "ï";
|
|
||||||
(*em)["eth"] = "ð";
|
|
||||||
(*em)["ntilde"] = "ñ";
|
|
||||||
(*em)["ograve"] = "ò";
|
|
||||||
(*em)["oacute"] = "ó";
|
|
||||||
(*em)["ocirc"] = "ô";
|
|
||||||
(*em)["otilde"] = "õ";
|
|
||||||
(*em)["ouml"] = "ö";
|
|
||||||
(*em)["divide"] = "÷";
|
|
||||||
(*em)["oslash"] = "ø";
|
|
||||||
(*em)["ugrave"] = "ù";
|
|
||||||
(*em)["uacute"] = "ú";
|
|
||||||
(*em)["ucirc"] = "û";
|
|
||||||
(*em)["uuml"] = "ü";
|
|
||||||
(*em)["yacute"] = "ý";
|
|
||||||
(*em)["thorn"] = "þ";
|
|
||||||
(*em)["yuml"] = "ÿ";
|
|
||||||
|
|
||||||
// Mathematical, Greek and Symbolic characters for HTML
|
|
||||||
(*em)["fnof"] = "ƒ";
|
|
||||||
(*em)["Alpha"] = "Α";
|
|
||||||
(*em)["Beta"] = "Β";
|
|
||||||
(*em)["Gamma"] = "Γ";
|
|
||||||
(*em)["Delta"] = "Δ";
|
|
||||||
(*em)["Epsilon"] = "Ε";
|
|
||||||
(*em)["Zeta"] = "Ζ";
|
|
||||||
(*em)["Eta"] = "Η";
|
|
||||||
(*em)["Theta"] = "Θ";
|
|
||||||
(*em)["Iota"] = "Ι";
|
|
||||||
(*em)["Kappa"] = "Κ";
|
|
||||||
(*em)["Lambda"] = "Λ";
|
|
||||||
(*em)["Mu"] = "Μ";
|
|
||||||
(*em)["Nu"] = "Ν";
|
|
||||||
(*em)["Xi"] = "Ξ";
|
|
||||||
(*em)["Omicron"] = "Ο";
|
|
||||||
(*em)["Pi"] = "Π";
|
|
||||||
(*em)["Rho"] = "Ρ";
|
|
||||||
(*em)["Sigma"] = "Σ";
|
|
||||||
(*em)["Tau"] = "Τ";
|
|
||||||
(*em)["Upsilon"] = "Υ";
|
|
||||||
(*em)["Phi"] = "Φ";
|
|
||||||
(*em)["Chi"] = "Χ";
|
|
||||||
(*em)["Psi"] = "Ψ";
|
|
||||||
(*em)["Omega"] = "Ω";
|
|
||||||
(*em)["alpha"] = "α";
|
|
||||||
(*em)["beta"] = "β";
|
|
||||||
(*em)["gamma"] = "γ";
|
|
||||||
(*em)["delta"] = "δ";
|
|
||||||
(*em)["epsilon"] = "ε";
|
|
||||||
(*em)["zeta"] = "ζ";
|
|
||||||
(*em)["eta"] = "η";
|
|
||||||
(*em)["theta"] = "θ";
|
|
||||||
(*em)["iota"] = "ι";
|
|
||||||
(*em)["kappa"] = "κ";
|
|
||||||
(*em)["lambda"] = "λ";
|
|
||||||
(*em)["mu"] = "μ";
|
|
||||||
(*em)["nu"] = "ν";
|
|
||||||
(*em)["xi"] = "ξ";
|
|
||||||
(*em)["omicron"] = "ο";
|
|
||||||
(*em)["pi"] = "π";
|
|
||||||
(*em)["rho"] = "ρ";
|
|
||||||
(*em)["sigmaf"] = "ς";
|
|
||||||
(*em)["sigma"] = "σ";
|
|
||||||
(*em)["tau"] = "τ";
|
|
||||||
(*em)["upsilon"] = "υ";
|
|
||||||
(*em)["phi"] = "φ";
|
|
||||||
(*em)["chi"] = "χ";
|
|
||||||
(*em)["psi"] = "ψ";
|
|
||||||
(*em)["omega"] = "ω";
|
|
||||||
(*em)["thetasym"] = "ϑ";
|
|
||||||
(*em)["upsih"] = "ϒ";
|
|
||||||
(*em)["piv"] = "ϖ";
|
|
||||||
(*em)["bull"] = "•";
|
|
||||||
(*em)["hellip"] = "…";
|
|
||||||
(*em)["prime"] = "′";
|
|
||||||
(*em)["Prime"] = "″";
|
|
||||||
(*em)["oline"] = "‾";
|
|
||||||
(*em)["frasl"] = "⁄";
|
|
||||||
(*em)["weierp"] = "℘";
|
|
||||||
(*em)["image"] = "ℑ";
|
|
||||||
(*em)["real"] = "ℜ";
|
|
||||||
(*em)["trade"] = "™";
|
|
||||||
(*em)["alefsym"] = "ℵ";
|
|
||||||
(*em)["larr"] = "←";
|
|
||||||
(*em)["uarr"] = "↑";
|
|
||||||
(*em)["rarr"] = "→";
|
|
||||||
(*em)["darr"] = "↓";
|
|
||||||
(*em)["harr"] = "↔";
|
|
||||||
(*em)["crarr"] = "↵";
|
|
||||||
(*em)["lArr"] = "⇐";
|
|
||||||
(*em)["uArr"] = "⇑";
|
|
||||||
(*em)["rArr"] = "⇒";
|
|
||||||
(*em)["dArr"] = "⇓";
|
|
||||||
(*em)["hArr"] = "⇔";
|
|
||||||
(*em)["forall"] = "∀";
|
|
||||||
(*em)["part"] = "∂";
|
|
||||||
(*em)["exist"] = "∃";
|
|
||||||
(*em)["empty"] = "∅";
|
|
||||||
(*em)["nabla"] = "∇";
|
|
||||||
(*em)["isin"] = "∈";
|
|
||||||
(*em)["notin"] = "∉";
|
|
||||||
(*em)["ni"] = "∋";
|
|
||||||
(*em)["prod"] = "∏";
|
|
||||||
(*em)["sum"] = "∑";
|
|
||||||
(*em)["minus"] = "−";
|
|
||||||
(*em)["lowast"] = "∗";
|
|
||||||
(*em)["radic"] = "√";
|
|
||||||
(*em)["prop"] = "∝";
|
|
||||||
(*em)["infin"] = "∞";
|
|
||||||
(*em)["ang"] = "∠";
|
|
||||||
(*em)["and"] = "∧";
|
|
||||||
(*em)["or"] = "∨";
|
|
||||||
(*em)["cap"] = "∩";
|
|
||||||
(*em)["cup"] = "∪";
|
|
||||||
(*em)["int"] = "∫";
|
|
||||||
(*em)["there4"] = "∴";
|
|
||||||
(*em)["sim"] = "∼";
|
|
||||||
(*em)["cong"] = "≅";
|
|
||||||
(*em)["asymp"] = "≈";
|
|
||||||
(*em)["ne"] = "≠";
|
|
||||||
(*em)["equiv"] = "≡";
|
|
||||||
(*em)["le"] = "≤";
|
|
||||||
(*em)["ge"] = "≥";
|
|
||||||
(*em)["sub"] = "⊂";
|
|
||||||
(*em)["sup"] = "⊃";
|
|
||||||
(*em)["nsub"] = "⊄";
|
|
||||||
(*em)["sube"] = "⊆";
|
|
||||||
(*em)["supe"] = "⊇";
|
|
||||||
(*em)["oplus"] = "⊕";
|
|
||||||
(*em)["otimes"] = "⊗";
|
|
||||||
(*em)["perp"] = "⊥";
|
|
||||||
(*em)["sdot"] = "⋅";
|
|
||||||
(*em)["lceil"] = "⌈";
|
|
||||||
(*em)["rceil"] = "⌉";
|
|
||||||
(*em)["lfloor"] = "⌊";
|
|
||||||
(*em)["rfloor"] = "⌋";
|
|
||||||
(*em)["lang"] = "〈";
|
|
||||||
(*em)["rang"] = "〉";
|
|
||||||
(*em)["loz"] = "◊";
|
|
||||||
(*em)["spades"] = "♠";
|
|
||||||
(*em)["clubs"] = "♣";
|
|
||||||
(*em)["hearts"] = "♥";
|
|
||||||
(*em)["diams"] = "♦";
|
|
||||||
|
|
||||||
// Special characters for HTML
|
|
||||||
(*em)["quot"] = """;
|
|
||||||
(*em)["amp"] = "&";
|
|
||||||
(*em)["lt"] = "<";
|
|
||||||
(*em)["gt"] = ">";
|
|
||||||
(*em)["OElig"] = "Œ";
|
|
||||||
(*em)["oelig"] = "œ";
|
|
||||||
(*em)["Scaron"] = "Š";
|
|
||||||
(*em)["scaron"] = "š";
|
|
||||||
(*em)["Yuml"] = "Ÿ";
|
|
||||||
(*em)["circ"] = "ˆ";
|
|
||||||
(*em)["tilde"] = "˜";
|
|
||||||
(*em)["ensp"] = " ";
|
|
||||||
(*em)["emsp"] = " ";
|
|
||||||
(*em)["thinsp"] = " ";
|
|
||||||
(*em)["zwnj"] = "‌";
|
|
||||||
(*em)["zwj"] = "‍";
|
|
||||||
(*em)["lrm"] = "‎";
|
|
||||||
(*em)["rlm"] = "‏";
|
|
||||||
(*em)["ndash"] = "–";
|
|
||||||
(*em)["mdash"] = "—";
|
|
||||||
(*em)["lsquo"] = "‘";
|
|
||||||
(*em)["rsquo"] = "’";
|
|
||||||
(*em)["sbquo"] = "‚";
|
|
||||||
(*em)["ldquo"] = "“";
|
|
||||||
(*em)["rdquo"] = "”";
|
|
||||||
(*em)["bdquo"] = "„";
|
|
||||||
(*em)["dagger"] = "†";
|
|
||||||
(*em)["Dagger"] = "‡";
|
|
||||||
(*em)["permil"] = "‰";
|
|
||||||
(*em)["lsaquo"] = "‹";
|
|
||||||
(*em)["rsaquo"] = "›";
|
|
||||||
(*em)["euro"] = "€";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package xmlx
|
package xmlx
|
||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
func TestDoc(t *testing.T) {
|
func TestDoc(t *testing.T) {
|
||||||
doc := New();
|
doc := New();
|
||||||
|
@ -55,3 +56,12 @@ func TestNodeSearch(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func TestEnt(t *testing.T) {
|
||||||
|
doc := New();
|
||||||
|
doc.LoadExtendedEntityMap();
|
||||||
|
for k, v := range doc.Entity {
|
||||||
|
fmt.Printf(" %s = %s\n", k, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue