Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:24:20+00:00 2026-06-03T00:24:20+00:00

I have been getting this error when trying to parse HTML with a script

  • 0

I have been getting this error when trying to parse HTML with a script tag using PHP’s DOMDocument class.

Warning: DOMDocument::loadHTML(): Unexpected end tag : style in Entity, line: 71 in /var/www/signage-dev/dynaml/includes/page.php on line 95

I have even tried CDATA tags but it has resulted in the same error

My script tag is

<script type="text/javascript">
//<![CDATA[
document.write('<style type="text/css"> .printBTN { display: inline; } </style>');
//]]>   
</script>

This snippet is supposed to show a print button when JavaScript is enabled. I don’t believe this is the most effective way of doing this (the previous developers created this), but even so, I wish to find a solution to this problem since I may run into this problem again in the future and it may not be as easy to fix as this is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:24:22+00:00Added an answer on June 3, 2026 at 12:24 am

    This question seems to have the solution Why split the tag when writing it with document.write()?

    I guess php DOM is more strict than most browsers. The solution I have seen sometimes is the one posted in a comment below the linked answer, escaping it with <\/script>, or in this case <\/style>, but I thought it was only necessary with script tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error and i have been trying everything for about a
we've been getting this error lately and have no idea why, we are not
I have been getting this error message when I step into some methods Do
I have been getting this error for quite some time now and Google has
I have been getting this error in Ruby 1.9, Rails 3.0, ActiveRecord 3.0: incompatible
I have been getting a very odd error when trying to print freeform text
Thus far you guys have been wildly helpful with me getting this little ditty
I have been getting an error in VB .Net object reference not set to
I am getting this 'HTTPS hostname wrong:' error when trying to connect to a
I'm getting this error when trying to insert data from a form into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.