Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML tagname starting with number is not working

Tags:

xml

I want to update the component 870Jars atrribute values using Jenkins build. When i open the xml file in IE, I am getting the below error

Error:- The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

A name was started with an invalid character. Error processing resource 'https://svn.retailerinfo.com/svn/Stores/Po...

<870Jars> ---^

XML file:-

<?xml version="1.0" encoding="UTF-8"?><Application> 
<app-name>Regist</app-name>
<baseline-version>Regist_R11.6.0.51</baseline-version>
<app-version>v11.6.0.51</app-version>
<defversion>1.0.0</defversion>
<component>
    <870Jars>
    <filename>v10.3.0-870Jars.zip</filename> 
    <targetfilename/> 
    <version>v10.3.0</version> 
    </870Jars>
</component>
</Application>

Is there any way where i can start a tag name with a number ?

I used &lt;/870Jars&gt; in place of <870Jars> but it is just printing the value rather than working as tag

like image 613
user2935276 Avatar asked Oct 30 '13 08:10

user2935276


People also ask

Can XML tag start with number?

Tag names can't start with the letters xml, a number, or punctuation, except for the underscore character (_). The letters XML are used in various commands and can't start your tag name. Numbers and punctuation also aren't allowed in the beginning of the tag name.

Can XML elements have numbers?

Element names must start with a letter or underscore. 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.

What is start tag in XML?

XML data is a serial stream. The start tag informs the receiving software that all the incoming data will belong to this element until the matching end tag is encountered. Very often, more start tags are encountered before the end tag.


1 Answers

An XML element whose name starts with a number is illegal XML. You should not start with numbers.

XML elements must follow these naming rules:

  • Names can contain letters, numbers, and other characters
  • Names cannot start with a number or punctuation character
  • Names cannot start with the letters xml (or XML, or Xml, etc)
  • Names cannot contain spaces

Any name can be used, no words are reserved.

http://www.w3schools.com/xml/xml_elements.asp

Specification Details.

like image 58
Gusdor Avatar answered Sep 30 '22 18:09

Gusdor