473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

XML Entity Functions

How come there isn't a xmlspecialchars(), and for that matter,
xml_entity_decode()? I would think someone would have thought of that by
now.
Jul 17 '05 #1
3 8837
"Chung Leong" <ch***********@hotmail.com> wrote in
news:Yt********************@comcast.com:
How come there isn't a xmlspecialchars(), and for that matter,
xml_entity_decode()? I would think someone would have thought of that by
now.


Probably because the only reserved characters (and the only ones with
predefined entities) in XML are the ones handled by htmlspecialchars().
Remember that unless a DTD defines further entities, the only character
entity names available in XML are &amp;, &lt;, &gt;, &quot;, and &apos;.
Jul 17 '05 #2
Eric Bohlman wrote:
"Chung Leong" <ch***********@hotmail.com> wrote in
news:Yt********************@comcast.com:
How come there isn't a xmlspecialchars(), and for that matter,
xml_entity_decode()?


Probably because the only reserved characters (and the only ones with
predefined entities) in XML are the ones handled by htmlspecialchars().


OK. But in the case of html_entity_decode, it obviously won't work
for &apos;, since no such entity reference exists in HTML. That
entity reference will be left unchanged. No great problem though.

--
Jock
Jul 17 '05 #3
htmlspecialchars() doesn't do &apros; though. It's easy enough to use
strtr(), but if the string is of multi-byte encoding, then it might not work
(the second byte of a 2-byte character would be <>&"', but shouldn't be
replaced).

Uzytkownik "Eric Bohlman" <eb******@earthlink.net> napisal w wiadomosci
news:Xn******************************@130.133.1.4. ..
"Chung Leong" <ch***********@hotmail.com> wrote in
news:Yt********************@comcast.com:
How come there isn't a xmlspecialchars(), and for that matter,
xml_entity_decode()? I would think someone would have thought of that by
now.


Probably because the only reserved characters (and the only ones with
predefined entities) in XML are the ones handled by htmlspecialchars().
Remember that unless a DTD defines further entities, the only character
entity names available in XML are &amp;, &lt;, &gt;, &quot;, and &apos;.

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Vincent Lefevre | last post by:
I would like to know if the base URI considered to resolve an unparsed entity defined by a relative URI should be the URI before or after its rewriting due to a possible catalog. Let's take an...
2
by: Ed Dennison | last post by:
I'm starting to look at DocBook-XML (not SGML) for producing a large documentation set. The hierarchy of DocBook elements for organizing the content is (more or less); set book part chapter...
11
by: Douglas Reith | last post by:
Hi There, Can someone please tell me why the XML spec states that an attribute value with an external entity is forbidden? Or point me to the appropriate document? Or better still, perhaps you...
1
by: Razvan | last post by:
Hi What is the difference between an internal and an external entity ? The first one is defined in the internal subset (not in a separate DTD file, but in the XML file itself - in...
4
by: terry | last post by:
could someone tell me how to add or remove entity to a xml file when i dim xmlentity as new xmlentity it's say it's sube new is private thks
11
by: Arsen Vladimirskiy | last post by:
Hello, If I have a few simple classes to represent Entities such as Customers and Orders. What is the proper way to pass information to the Data Access Layer? 1) Pass the actual ENTITY to...
6
by: Tuomas Rannikko | last post by:
Hello, I'm currently writing a XML processor for the fun of it. There is something I don't understand in the spec though. I'm obviously missing something important. The spec states that both...
2
by: | last post by:
I implement a lot of "send to friend" functionalities as well as utilizing a lot of content that's been scraped from other places on the web.I built these tools using Classic ASP. Some classes...
1
by: markla | last post by:
Hi, I have an Entity data model built in Entity Framework, which sources data primarily from an MS SQL 2008 database, and sources some static (data dictionary) values from code-based objects. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.