Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Representing Null vs. EmptyString in XML

Reply
Thread Tools

Representing Null vs. EmptyString in XML

 
 
James
Guest
Posts: n/a
 
      04-25-2004
In certain applications, it is necessary to distinguish between an
emptyString vs. a null value. What is the appropriate way to make
this distinction in XML?

<elementName></elementName>
looks like a zero-length string (emptyString) but will evaluate to
null.

The data element in question may have its own datatype (string, title,
name, etc.) but also need to hold an emptyString value.
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      04-25-2004
In article <(E-Mail Removed) >,
James <(E-Mail Removed)> wrote:

>In certain applications, it is necessary to distinguish between an
>emptyString vs. a null value. What is the appropriate way to make
>this distinction in XML?


There isn't a way to do this defined in plain XML, but you can make up
your own way of doing it. A natural way is to use an attribute, and
if you're using XML Schema then it provides one: xsi:nil="true" (where
xsi is bound to the schema instance namespace). Nothing stops you
from using this even when you're not using XML Schema, though you will
have to interpret it yourself in the application.

-- Richard
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
representing a directory structure in XML James Owens XML 8 11-24-2005 09:23 PM
Representing BNF grammer using XML Venky XML 0 06-27-2005 05:15 PM
Representing Meta Data using an XML Schema Hans Oesterholt-Dijkema XML 0 04-13-2005 08:29 PM
XML DTD or schema for representing entities and relationships (SQL)? Simon Brooke XML 0 10-12-2003 02:05 PM



Advertisments