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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:21:26+00:00 2026-05-30T04:21:26+00:00

PHP DOM automatically decodes. Eg * is decoded when creating a DOMElement. Is there

  • 0

PHP DOM automatically decodes. Eg * is decoded when creating a DOMElement. Is there a way to prevent this. One solution is to preprocess the text and afterwords postprocess it but this seems more like a hack.

example code:

$domDoc = new \DOMDocument();
$domEl = $domDoc->createElement('foo', 'text with * in it');
$domDoc->appendChild($domEl);
echo $domDoc->saveXML();
  • 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-30T04:21:27+00:00Added an answer on May 30, 2026 at 4:21 am

    DOMDocument, or rather libxml, has a boolean flag substituteEntities:

    Proprietary. Whether or not to substitute entities. This attribute is not part of the DOM specification and is specific to libxml.

    However, this won’t work for your ASCII entities because they are predefined. There was a bug report asking for this for PHP 5.1.4, which is marked as “Not A Bug”, because

    Behavior is correct – These are pre-defined entities and substituteEntities has no effect on the behavior of them. See the specs for more info: http://www.w3.org/TR/2004/REC-xml-20040204/#sec-predefined-ent

    Also see http://xmlsoft.org/entities.html

    Note that at save time libxml2 enforces the conversion of the predefined entities where necessary to prevent well-formedness problems, and will also transparently replace those with chars (i.e. it will not generate entity reference elements in the DOM tree or call the reference() SAX callback when finding them in the input).

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

Sidebar

Related Questions

Been scratching my head at this one for way too long now... $dom =
Ho to make this simple xml with php using DOM? Full code will be
Can one use the php DOM class - http://php.net/manual/en/book.dom.php to generate form elements?.
I am trying to get the root node of a PHP DOM Document. This
I am trying to parse XML using PHP DOM and then insert this data
How does one change the element content with PHP DOM functions? In depth... I've
In PHP with DOM, I have a DomElement object which represents an <identity/> element.
I am using PHP's DOM object to create HTML pages for my website. This
Working with PHP DOM - HTML manipulation. Got 2 questions Recently read that, there
Working with PHP DOM - html manipulation. It's really very effective way to output

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.