JuliaWeb/Gumbo.jl

What wrong ? ERROR: MethodError: `tag` has no method matching tag(::Gumbo.HTMLText) in anonymous at no file:2

paulanalyst opened this issue · 2 comments

What wrong ? I expect list of all tags...

| | || | | | (| | | Version 0.4.0-dev+3600 (2015-02-25 15:26 UTC)
/ |__'|||'_| | Commit f96c23c* (4 days old master)
|
/ | x86_64-w64-mingw32

julia> using HTTPClient.HTTPC

julia> using Gumbo

julia> r=HTTPC.post("http://requestb.in/api/v1/bins", "")
HTTP Code :200
RequestTime :14.804
Headers :
Connection : keep-alive
Via : 1.1 vegur
Content-Length : 84
Date : Mon, 02 Mar 2015 15:14:06 GMT
Content-Type : application/json
Access-Control-Allow-Origin : *
Server : gunicorn/18.0
Length of body : 84

julia> r.body
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=84, maxsize=Inf, ptr=85,
mark=-1)

julia> s=bytestring(r.body)
"{"color": [100, 140, 100], "name": "195qmnk1", "request_count": 0, "private": false}"

julia> doc=parsehtml(s)
HTML Document:

Gumbo.HTMLElement{:HTML}:

{"color": [100, 140, 100], "name": "195qmnk1", "request_count": 0, "private": false}

julia> for elem in preorder(doc.root)
println(tag(elem))
end
HTML
head
body
ERROR: MethodError: tag has no method matching tag(::Gumbo.HTMLText)
in anonymous at no file:2

julia>
Paul

Well first of all it looks like you're trying to parse JSON data as HTML? But in any case this probably shouldn't happen, I'll try to take a look soon.

errr actually, sorry, this looks correct. tag isn't a sensible method to implement on HTML text, so you can't just call it on any HTMLNode and expect it to work—it only works on HTMLElements.