Jump to content

XML - Problem with using entities in attributes


Recommended Posts

Hello all,I have a slight problem with validating my XML file with XML DOM validator on this website. Basically I'm trying to use an entity as the value of attribute. Line that causes the problem is:<tvl:category cat="&W;" />Entity is of course listed in .dtd file as follows:<!ENTITY W "Weather"> How come such trivial thing could give me the following error? XML Parsing Error: not well-formedLocation: http://www.w3schools.com/dom/dom_validate.aspLine Number 11, Column 25: <tvl:category cat="&W;" />---------------------------------------------^ I tried using both internal or external .dtd file as well as getting rid of quotation marks, etc. and nothing seems to help :Sad: I'd very much appreciate any help! Thanks

Link to post
Share on other sites

Unfortunately, Firefox doesn't work with custom entities. It's not just inside attributes but anywhere in the document.

Link to post
Share on other sites

Entities always end with a semi-colon. It is incorrect not to do that, whether or not they're inside attributes. I don't know about Internet Explorer's support for entities but I can't remember seeing any complaints about it before.

Link to post
Share on other sites
Entities always end with a semi-colon. It is incorrect not to do that, whether or not they're inside attributes. I don't know about Internet Explorer's support for entities but I can't remember seeing any complaints about it before.
Last question: Is it correct to include them within quotation marks? Thanks for your answers so far!
Link to post
Share on other sites

The quotation marks will be considered ordinary character data, unless they're the delimiters for an attribute.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...