Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Represent space and tab in XML tag?

How can space and tab be represented in an XML tag?

Are there any special characters that can represent them?

like image 221
balaweblog Avatar asked Feb 05 '09 05:02

balaweblog


People also ask

Can you have spaces in XML tags?

XML Naming Rules Element names cannot start with the letters xml (or XML, or Xml, etc) Element names can contain letters, digits, hyphens, underscores, and periods. Element names cannot contain spaces.

How do you handle a space in XML?

XML ignores the first sequence of white space immediately after the opening tag and the last sequence of white space immediately before the closing tag. XML translates non-space characters (tab and new-line) into a space character and consolidates all multiple space characters into a single space.

Should XML have tabs or spaces?

No, the XML spec define whitespace like this: In editing XML documents, it is often convenient to use "white space" (spaces, tabs, and blank lines) to set apart the markup for greater readability. Such white space is typically not intended for inclusion in the delivered version of the document.


2 Answers

I think you could use an actual space or tab directly in XML document, but if you are looking for special characters to represent them so that text processors can't mess them up, then it's:

space =   tab   = 	 
like image 78
galets Avatar answered Sep 19 '22 14:09

galets


Works for me

\n = 
 \r = 
 \t = 	 space =   

Here is an example on how to use them in XML

<KeyWord name="hello&#x9;" /> 
like image 32
Wasim A. Avatar answered Sep 18 '22 14:09

Wasim A.