Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with loadHTMLFragment() #59

Closed
dingsda87 opened this issue Sep 23, 2014 · 1 comment
Closed

Problem with loadHTMLFragment() #59

dingsda87 opened this issue Sep 23, 2014 · 1 comment

Comments

@dingsda87
Copy link

hello,

i just started using your html5-parser and i'm trying to load a fragment.

using the code shown in the wiki it's no problem:

 require "vendor/autoload.php";
use Masterminds\HTML5;
$html5 = new HTML5();

// An example HTML fragment:
$fragment = "<p>This is a test of the HTML5 parser.<p>";
$dom = $html5->loadHTMLFragment($fragment);

but when i try to parse other tags it's not working.
for example this code

 require "vendor/autoload.php";
use Masterminds\HTML5;
$html5 = new HTML5();

// An example HTML fragment:
$fragment = "<td>This is a test of the HTML5 parser.<td>";
$dom = $html5->loadHTMLFragment($fragment);

error shown:

Notice: Undefined property: DOMDocumentFragment::$tagName in C:\xampp\htdocs\html5\vendor\masterminds\html5\src\HTML5\Parser\TreeBuildingRules.php on line 138

stacktrace:

Function Location
1 {main}( ) ..\index.php:0
2 Masterminds\HTML5->loadHTMLFragment( ) ..\index.php:21
3 Masterminds\HTML5->parseFragment( ) ..\HTML5.php:128
4 Masterminds\HTML5\Parser\Tokenizer->parse( ) ..\HTML5.php:181
5 Masterminds\HTML5\Parser\Tokenizer->consumeData( ) ..\Tokenizer.php:83
6 Masterminds\HTML5\Parser\Tokenizer->tagOpen( ) ..\Tokenizer.php:126
7 Masterminds\HTML5\Parser\Tokenizer->tagName( ) ..\Tokenizer.php:269
8 Masterminds\HTML5\Parser\DOMTreeBuilder->startTag( ) ..\Tokenizer.php:371
9 Masterminds\HTML5\Parser\TreeBuildingRules->evaluate( ) ..\DOMTreeBuilder.php:398
10 Masterminds\HTML5\Parser\TreeBuildingRules->closeIfCurrentMatches( ) ..\TreeBuildingRules.php:90
@goetas
Copy link
Member

goetas commented Sep 23, 2014

Fixed with e1e579a

@goetas goetas closed this as completed Sep 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants