XPath uses XML schema lexical formats for
all simple types. The XML Schema lexical format for an integer does not
allow a hexadecimal option.
The standard solution is to create a
pair of custom XPath functions that convert between hex and decimal lexical
formats. But that's not a viable solution for a DFDL modeller because they
cannot define custom XPath functions.
regards,
Tim Kimber, DFDL Team,
Hursley, UK
Internet: kimbert@uk.ibm.com
Tel. 01962-816742
Internal tel. 37246742
From:
Steve Hanson/UK/IBM@IBMGB
To:
Mike Beckerle <mbeckerle.dfdl@gmail.com>,
Cc:
dfdl-wg@ogf.org, dfdl-wg-bounces@ogf.org
Date:
13/06/2013 10:39
Subject:
Re: [DFDL-WG]
DFDL Expressions and hex literal constants
Sent by:
dfdl-wg-bounces@ogf.org
Mike
I think there might be a wider problem in specifying any hex in XPath expressions.
Tim's been looking into this as part of an IBM DFDL defect.
Regards
Steve Hanson
Architect, IBM Data Format Description Language (DFDL)
Co-Chair, OGF
DFDL Working Group
IBM SWG, Hursley, UK
smh@uk.ibm.com
tel:+44-1962-815848
From: Mike
Beckerle <mbeckerle.dfdl@gmail.com>
To: dfdl-wg@ogf.org,
Date: 13/06/2013
00:24
Subject: [DFDL-WG]
DFDL Expressions and hex literal constants
Sent by: dfdl-wg-bounces@ogf.org
I haven't found a way in XPath to specify a hexadecimal integer number.
E.g., I want to write expressions like
{ if (../magicNum eq 0xa1b2c3d4) then 'bigEndian'
else if (.../magicNum eq 0xd4c3b2a1) then 'littleEndian'
else error()
}
But it rejects the 0x notation. Do I really have to write decimal everywhere?
When dealing with binary data this is a bit of a nightmare.
I think the above code is clear to anyone, but if I convert those numbers
to decimal it becomes completely obscure.
...mike
--
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com
--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU