|
XML Home
XML Tutorial About XML XML Viewers XML Editors XML Documents XML Syntax XML Elements XML Attributes XML with CSS XML with XSL XML Namespace XML Local Namespace XML Default Namespace XML Entities XML Creating Entities XML CDATA DTDDTD IntroductionDTD DOCTYPE DTD Internal DTD External DTD Combined DTD FPI DTD Elements DTD Element Operators DTD Attributes DTD Attribute Default Values DTD Attribute Types DTD General Entities DTD Parameter Entities DTD Embedded Images XSLTXSLT IntroductionXSLT Example XSLT Syntax XSLT <template> XSLT <apply-templates> XSLT <value-of> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <choose> XPathXPath IntroductionXPath Location Path XPath Location Path - Absolute XPath Location Path - Relative XPath Attributes XPath Axis XPath Node Test XPath Predicate XPath Node Set XPath Comparison Operators XPath Boolean Operators XPath Number Operators XPath String Functions Tutorial Summary XHTML Tutorial AJAX Tutorial |
XML EntitiesXML entities allow you to use text to refer to a data item, instead of using the data item itself. You can use entities to represent:
Problematic CharactersSome characters have a special meaning in XML. For example, the less than sign (<) marks the beginning of a tag. And, of course, the greater than sign (>) marks the end of the tag. When the XML processor parses the document, it looks for these characters (and others) to determine how to interpret the document. This is fine, as long as your data doesn't contain any of these characters. But what if it does? What if your data contains say, a less than sign? Imagine you had the following text within an element: 10 < 5. When the XML processor encounters the <, it will assume it's the start of an opening tag. Problem is, it's not. In order to include characters such as < and & etc, you need to use their entity reference instead of the character itself. Entity SyntaxYou start an entity reference using the Example:
The above entity reference represents the following character:
Predefined Entity ReferencesThere are 5 predefined entity references in XML. These are:
|
Need Website Content?
Get unique, quality digital content for your website.
|