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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:07:49+00:00 2026-05-29T18:07:49+00:00

Iv discovered that it is impossible to write any content (text or another elements)

  • 0

Iv discovered that it is impossible to write any content (text or another elements) into head element, for example

$XML = new XMLWriter();
$XML->openMemory();
$XML->startElement("head");
$XML->writeAttribute("id","head");
$XML->text("lable");
$XML->endElement();
$XML->startElement("div");
$XML->text("div");
$XML->endElement();
echo $XML->outputMemory();

will output elements in body, not in head, but it makes correct attributes:

<html>
<head id="head">
</head>
<body>
lable
<div>
div
</div>
</body>
</html>

Why i cannot write any content into head?

  • 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-29T18:07:52+00:00Added an answer on May 29, 2026 at 6:07 pm

    HTML does not support the presence of text or content-related elements in its <head>. From the W3C recommendation:

    The HEAD element contains information about the current document, such as its title, keywords that may be useful to search engines, and other data that is not considered document content.

    Typically, the main elements you would want to write to the HTML head are the <title> element and any <meta> elements. I presume that the following would work:

    $XML = new XMLWriter();
    $XML->openMemory();
    $XML->startElement("head");
    $XML->writeAttribute("id","head");
    $XML->startElement("title");
    $XML->text("My HTML page");
    $XML->endElement();
    $XML->endElement();
    $XML->startElement("div");
    $XML->text("div");
    $XML->endElement();
    echo $XML->outputMemory();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've discovered that any time I do the following: echo '<a href=http:// title=bla>huzzah</a>'; I
I've discovered that cElementTree is about 30 times faster than xml.dom.minidom and I'm rewriting
UPDATE : I discovered that I was calling the permalink from another table, with
I discovered that the dojox.charting.action2d.Tooltip takes a custom function to provide the text for
I recently discovered that it is possible to write windows applications in php. Can
I discovered that one of the tables of a legacy db I'm working on
I discovered that it is possible to extract the hard-coded strings from a binary.
We recently discovered that the Google Maps API does not play nicely with SSL.
Today I discovered that my fresh installation of Apache HTTP Server is able to
I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as

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.