Re: [netmod] XPath node type tests

Ladislav Lhotka <lhotka@nic.cz> Fri, 20 October 2017 15:26 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BFAB613219C for <netmod@ietfa.amsl.com>; Fri, 20 Oct 2017 08:26:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Gv86pVCJHLS for <netmod@ietfa.amsl.com>; Fri, 20 Oct 2017 08:26:37 -0700 (PDT)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 87C00133343 for <netmod@ietf.org>; Fri, 20 Oct 2017 08:26:36 -0700 (PDT)
Received: by trail.lhotka.name (Postfix, from userid 109) id 1E5C11820F78; Fri, 20 Oct 2017 17:26:23 +0200 (CEST)
Received: from localhost (unknown [195.113.220.121]) by trail.lhotka.name (Postfix) with ESMTPSA id 8ED2E1820E6E; Fri, 20 Oct 2017 17:26:20 +0200 (CEST)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Robert Wilton <rwilton@cisco.com>, "netmod\@ietf.org" <netmod@ietf.org>
In-Reply-To: <aba8fca4-4cc7-ee66-6adf-baac5485b12a@cisco.com>
References: <aba8fca4-4cc7-ee66-6adf-baac5485b12a@cisco.com>
Mail-Followup-To: Robert Wilton <rwilton@cisco.com>, "netmod\@ietf.org" <netmod@ietf.org>
Date: Fri, 20 Oct 2017 17:27:27 +0200
Message-ID: <87h8utg7q8.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/MfwwSCfsoO4Om2Wd3iFM-Q94CA4>
Subject: Re: [netmod] XPath node type tests
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Oct 2017 15:26:40 -0000

Hi Rob,

Robert Wilton <rwilton@cisco.com> writes:

> Hi,
>
> XPATH 1.0 defines the following three node-type tests:
>
> 1) comment()
> 2) processing-instruction(<opt arg>)
> 3) text()

For completeness, node() is the fourth one.

>
> My assumption is that a YANG tree doesn't contain any nodes of type 
> 'comment' or 'processing-instruction' and hence these filters would 
> never match any nodes.

Yes. FWIW, Yangson library raises NotSupported exception upon
encountering these.

>
> However, it wasn't clear to me from reading 7950 or rfc6087bis-14 
> whether text() matches anything.  In particular, does a YANG leaf node 
> (except of type empty) always parent a text node that holds its value?

I believe this is how it should be interpreted. According to XPath 1.0
spec, comparisons like

    xyz = 'foo'

use string-value of xyz node, which is defined as the concatenation of
the string-values of all text node descendants of xyz.

Lada

>
> Thanks,
> Rob
>
>
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67