sethu
sethu

Reputation: 1721

empty content in XML

I just have a basic question with xml. I want to know whether it is valid to have an empty text content field ?

e.g

<Document></Document> 

Thank you !

Upvotes: 2

Views: 269

Answers (3)

Sergio
Sergio

Reputation: 8259

That XML is ok.

You can use http://www.w3schools.com/xml/xml_validator.asp to test xml format.

Upvotes: 0

Quentin
Quentin

Reputation: 943099

Nothing in XML itself prevents you having an empty element (otherwise the <img> and <br> would break XHTML).

A specific XML application might require that an element has content though. You haven't stated where <Document> comes from, so we can't say for this particular case.

Upvotes: 1

Jan Vorcak
Jan Vorcak

Reputation: 19989

yes, it is, in XML, if your xml has XMLSchema (or any other schema), it depends on the schema

Upvotes: 0

Related Questions