Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion It seems that XPath does not distinguish between an inexistent path and a null string?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Peter Flynn  
View profile  
 More options Jun 27 2012, 3:54 pm
Newsgroups: comp.text.xml
From: Peter Flynn <pe...@silmaril.ie>
Date: Wed, 27 Jun 2012 20:54:50 +0100
Local: Wed, Jun 27 2012 3:54 pm
Subject: Re: It seems that XPath does not distinguish between an inexistent path and a null string?
On 14/06/12 11:04, Alain Ketterlin wrote:

> "japisoft" <cont...@japisoft.com> writes:

>> When your document is parsed, the final result has no difference. But
>> from the schema/DTD view, there's a
>> difference because

>> <!ELEMENT somework EMPTY>

>> and

>> <!ELEMENT somework (#PCDATA)>

>> are not equal, so write :

>> <someword></someword>

>> is equal to

>> <someword/>

>> is only true if the content type is (#PCDATA) or

> Do you have a source for this claim?

It's been a long time, but I think you'll find the discussion in the
archives of the XML SIG at the time. I seem to remember we did it to
death and the consensus was that XML should not distinguish between the
two forms.

> I think it's wrong. (Not the fact
> that #PCDATA and EMPTY are different, the fact that there is a
> difference between the two forms of empty elements.)

Officially there is no difference. In practice, if your parser has
access to a DTD or Schema, it would be possible for it to detect if
content was allowed or not.

> The XML recommandation says: "If an element is empty, it must be
> represented either by a start-tag immediately followed by an end-tag or
> by an empty-element tag." (Section 3.1)

> The only difference I know of is mentioned in the next paragraph: "For
> interoperability, the empty-element tag must be used, and can only be
> used, for elements which are declared EMPTY." And "For interoperability"
> is defined earlier as non-binding.

It is still regarded as good practice in the publishing field, where the
semantics of potential mixed content can be important. It also serves as
a reminder to those who examine the markup that the element type cannot
have any content, rather than the current element just being empty by
chance.

///Peter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.