0

Whether XML element attribute name can be empty:

<?xml version="1.0" encoding="utf-8"?>
<test>
  <tables>
    <gg qqq="">
      <ss ""=""/>
      <mm ""=""/>
    </gg>
  </tables>
</test>

I am getting an exception I cant to load this. Is this possible?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Aravind Srinivas
  • 251
  • 3
  • 8
  • 15

3 Answers3

1

No, this will produce invalid XML. Attribute must have both name and value. How do you image opposite?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
  • 1
    Sir, this is more useful as comment not an answer. – 1Mayur Apr 02 '13 at 04:58
  • @Mayur: Why? OP asks is it possible. I answer that it is not. How to answer it more proper way?) – abatishchev Apr 02 '13 at 04:59
  • I see two options: answer as I did or downvote meaning this is a silly question. I choose first. I think there are not silly questions, there are people being lazy to google, and silly answers. – abatishchev Apr 02 '13 at 05:02
0

No this can not be done.

XML has empty element concept[If you are trying to implement that].

In that whole element is kept empty and said to be null as follow>>

<abc></abc>
<DefaultTaxPrice></DefaultTaxPrice>
Freelancer
  • 9,008
  • 7
  • 42
  • 81
0

Short answer, no. If you want to add value but not know what is the name of the value in XML, insert in into the body instead.

<ss>value</ss>

This way, your ss will be treated as a value

Fendy
  • 4,565
  • 1
  • 20
  • 25