Well, this fails:
"<body><br></body>" string>xml
But these both succeed:
"<body><br/></body>" string>xml
"<body><br></br></body>" string>xml
Looks like it's not proper XHTML?
If it helps we have HTML5 parsers in html.parser, and words to work with it
in html.parser.analyzer:
"<body><br></body>" parse-html
"http://factorcode.org" http-get nip parse-html find-hrefs
For what its worth, Python seems to have similar error too:
>>> from xml.dom import minidom
>>> xmldoc = minidom.parseString("<body><br></body>")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/minidom.py",
line 1928, in parseString
return expatbuilder.parseString(string)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py",
line 940, in parseString
return builder.parseString(string)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py",
line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 1, column 12
On Tue, Mar 3, 2015 at 5:11 AM, CW Alston <cwalsto...@gmail.com> wrote:
> Greetings, folks -
> In an idle moment, I pasted this snippet of example code
> from the factorcode.org page, just for fun:
>
> USING: io kernel sequences
> http.client xml xml.data xml.traversal ;
>
> "http://factorcode.org" http-get nip string>xml
> "a" deep-tags-named
> [ "href" attr ] map
> [ print ] each
>
> ! this breaks in string>xml w/ the error:
>
> mismatched
> line 105
> column 0
> open T{ name f "" "br" "http://www.w3.org/1999/xhtml" }
> close T{ name f "" "body" "http://www.w3.org/1999/xhtml" }
> Mismatched tags
> Opening tag: <br>
> Closing tag: </body>
>
> ! but closing <br> w/ </br> (as per XHTML ??):
>
> USING: io kernel sequences
> http.client xml xml.data xml.traversal
> splitting ;
>
> "http://factorcode.org" http-get nip
> "<br>" "<br> </br>" replace string>xml
> "a" deep-tags-named
> [ "href" attr ] map
> [ print ] each
>
> ! ...succeeds
>
> The entry for <br> in w3schools 'tags' reference
> <http://www.w3schools.com/tags/tag_br.asp> reads:
>
> "Definition and Usage
>
> The <br> tag inserts a single line break.
>
> The <br> tag is an empty tag which means that it has no end tag.
>
> Differences Between HTML 4.01 and HTML5
> NONE.
>
> Differences Between HTML and XHTML
>
> In HTML, the <br> tag has no end tag.
>
> In XHTML, the <br> tag must be properly closed, like this: <br />."
>
> However, inserting
> "<br>" "<br> < />" replace string>xml
> or
> "<br>" "<br> </>" replace string>xml
> still breaks in string>xml, but inserting
> "<br>" "<br> </br>" replace string>xml
> works fine for me.
>
> Is this just a consequence of the Factor code running on my ancient
> OS X 10.6.8 system (Snow Leopard lives!), or differences between
> XHTML, HTML 4.01, and HTML5, or a wacky description at w3schools?
> Can anyone enlighten me on this, regarding the usage of string>xml?
>
> Much grass,
> ~cw
>
>
> --
> *~ Memento Amori*
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk