Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-05

fpc-xml: SAX_HTML parsing "script" tags

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

dmitry boyarintsev

Hello

Is there any known way to parse html files with:
<script>
some script with tricky symbols , like "< >" that ruins the parsing </script> tag?

I've not found any better option but to re-implement THTMLReader (copy-paste + modify) and run a custom parser to skip the content of the script tag, and then go-on parsing html file.

Also, is there any reason for f parameter to be "var"?

procedure ReadHTMLFile(var ADoc: THTMLDocument; var f: TStream);
procedure ReadHTMLFragment(AParentNode: TDOMNode; var f: TStream);

thanks,
Dmitry

Reply by email

Lee Jenkins
to dmitry boyarintsev
dmitry boyarintsev wrote 7 lines
Hello Is there any known way to parse html files with: <script> some script with tricky symbols , like "< >" that ruins the parsing </script> tag?

What about using CDATA section?

<script>
<![CDATA[

]]>
</script>

Warm Regards, Lee

Reply by email

dmitry boyarintsev
to Lee Jenkins
Lee Jenkins wrote
What about using CDATA section?

There's no support for CDATA in the HTML parser.
I'm trying to read arbitrary html files, so there's almost no "<![CDATA" usage.

thanks,
dmitry

Reply by email