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 6603047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:57:17+00:00 2026-05-25T18:57:17+00:00

I have a problem with class DOMDocument. I use this php class to edit

  • 0

I have a problem with class DOMDocument. I use this php class to edit a html template. I have in this template this meta tag:

<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>

But after editing, although I was not editing this tag, it escapes the end char “/” and it doesn’t work.
This is the script:

$textValue = $company.'<br />'.$firstName.' '.$lastName.'<br />'.$adress;

$values = array($company, $firstName.' '.$lastName, $adress);

$document = new DOMDocument;

$document->loadHTMLFile($dir.'temp/OEBPS/signature.html');

$dom = $document->getElementById('body');
for ($i = 0; $i < count($values); $i++) {
$dom->appendChild($document->createElement('p', $values[$i]));
}


$document->saveHTMLFile($dir.'temp/OEBPS/signature.html');
echo 'signature added <br />';
  • 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-05-25T18:57:18+00:00Added an answer on May 25, 2026 at 6:57 pm

    Please see the answer provided by this question: Why doesn’t PHP DOM include slash on self closing tags?

    In short, DOMDocument->saveHTMLFile() outputs its internal structure as regular old HTML instead of XHTML. If you absolutely need XHTML, you can use DOMDocument->saveXMLFile() which will use self-closing tags. The only problem with this method is some HTML tags cannot use self-closing tags like <script> and <style> so you have to put a space in their content so that they don’t use self-closing tags.

    I would recommend just ignoring the issue unless it is mandatory that you fix it. Self-closing tags are a relic of XHTML and are unused in HTML5.

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

Sidebar

Related Questions

The problem: I have a class which contains a template method execute which calls
I have the following problem using template instantiation [*]. file foo.h class Foo {
I have the following problem: //A.h class A { //... // this is the
I have a problem applying the DebuggerDisplay attribute on a generic class: [DebuggerDisplay(--foo--)] class
I have a class that i want to push_back into a deque. The problem
Ok I have two modules, each containing a class, the problem is their classes
I've got a philosophical programming problem. Let's say I have a class named Employees.
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I want to mach (in real case I use DomDocument php) a link inside:
Somewhere in my code I have: class aclass { ... function amethod() { $this->dom

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.