google / streamhtmlparser Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/streamhtmlparser
License: BSD 3-Clause "New" or "Revised" License
Automatically exported from code.google.com/p/streamhtmlparser
License: BSD 3-Clause "New" or "Revised" License
Copyright 2008 Google Inc. All Rights Reserved. This directory contains an implementation of an html context scanner with no lookahead. Its purpose is to scan an html stream and provide context information at any point within the input stream. An example of a user of this scanner would be an auto escaping templating system, which would require html context information at very specific points within the html stream. The implementation is based on a simplified state machine of HTML4.1.
What steps will reproduce the problem?
1. source code:
int main(void){
unsigned int getchar_ret;
htmlparser_ctx *parser = htmlparser_new();
int js_stat = 0;
while((getchar_ret = getchar()) != EOF){
char c = (char)getchar_ret;
htmlparser_parse_chr(parser, c);
if (parser->in_js == 1) {
putchar(c);
js_stat = htmlparser_js_state(parser);
printf("js stat is %d\n",js_stat);
}
else{
// putchar(c);
}
}
}
2. Input:
<script type="text/javascript">
document.write("<img src='www.example.com' border=0 width=0 height=0>");
</script>
3. The parser state of string"<img src='www.example.com' border=0 width=0
height=0>" is 2(JSPARSER_STATE_DQ).
What is the expected output? What do you see instead?
The parser state of string 'www.example.com' expect to be 1(JSPARSER_STATE_Q).
What version of the product are you using? On what operating system?
Version:0.1
OS: linux FC5
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 10 Jan 2011 at 10:15
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.