Project

Profile

Help

Bug #4509 ยป Re_ [Saxon - Bug #4509] (In Progress) Saxon 10 DOM builder creates redundant namespace attributes - 2020-03-31T16_05_50Z.eml

Gerben Abbink, 2020-03-31 18:05

 
X-He-Spam-Score: -2.0
Return-Path: <gerben.abbink@gmail.com>
Delivered-To: dropbox@plan.io
Received: from m.launchco.com ([127.0.0.1])
by m.launchco.com with LMTP id eP4rDVJqg17WHQAAa1G0NA
for <dropbox@plan.io>; Tue, 31 Mar 2020 18:05:38 +0200
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on m.launchco.com
X-Spam-Level:
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,
RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED
autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Report:
* 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was
* blocked. See
* http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
* for more information.
* [URIs: plan.io]
* -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at
* https://www.dnswl.org/, no trust
* [209.85.210.41 listed in list.dnswl.org]
* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
* [score: 0.0000]
* 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
* provider (gerben.abbink[at]gmail.com)
* 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3)
* [209.85.210.41 listed in wl.mailspike.net]
* 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
* 0.0 HTML_MESSAGE BODY: HTML included in message
* 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
* valid
* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
* -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
* author's domain
* 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders
X-Spam-Score: -2.0
Envelope-to: inbox+saxonica+f38e+saxon@plan.io
Authentication-Results: m.launchco.com; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: m.launchco.com;
dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lsr6co6y";
dkim-atps=neutral
Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))
(No client certificate requested)
by m.launchco.com (Postfix) with ESMTPS id C934180526
for <inbox+saxonica+f38e+saxon@plan.io>; Tue, 31 Mar 2020 18:05:37 +0200 (CEST)
Received: by mail-ot1-f41.google.com with SMTP id t28so22566171ott.5
for <inbox+saxonica+f38e+saxon@plan.io>; Tue, 31 Mar 2020 09:05:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=yORVXq+NQgDkRzany1FD4qcgF6mX4nK2FVyMfVdayN8=;
b=lsr6co6yemiJm3AU48uKW//ELgWx0jVc6BKK0Sj4JnTLSkU40nz336o/Mxzg3lCcO2
I4azE1qVi9Q80YnGlT27HuyLza/MzVx9AMgLlLOFSh9JxdrDSXrXwqQ6m+IM4y1xEFmH
UXNGiGD/xGbsdTtp8BTkaMaM43umGYqwHqdJ0QIGBxv6w5ydWmZK3xRYN9SO64Hgm/md
nC0r/46G2L4WQfA0x4sUpcvAp/mkpg+SCeECOp1RFqD6mzZNuDv9KSdkYnSmUz9qO0pc
7RB923J21v/hX1p1x6m0nLqEglDokopLKxBkuCxUOOfO/n+Nom0QfQhIoq5V6np/6Ier
57vg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=yORVXq+NQgDkRzany1FD4qcgF6mX4nK2FVyMfVdayN8=;
b=tO+Au8dwWpArI2hwymctevRXoTTyGBCu3qLFaGYgQRgZSM+XrXPqn6dRAL6+HXtkeZ
bZ2FcLa9Y0RczAsO+4W37/F7SPbSfxnM9igMS4Zoz9OV6Aakm14x8DsoEj0wiBN/gs55
f7ueEHVLTnQp6BX3fnhLqiwz10Day03jHaPA6bNi9VSeCO4h6Pyco3/MiOdOrSLICrqI
F8r8t0jjYwHciKA5yhQnew2yv2PVtCo6dL6y4O0wyFXzOCn8Hq08ahAljfNoRM7v0jyP
kBaIVR666F+orGvWElu6eFE8fn5PeLFdvwzaN1B+NSVTMQiSTaR9cJcIQ3IVHKOZ8rGp
uICw==
X-Gm-Message-State: ANhLgQ3cgfUsWE+56aIsm0VVyybTLLTQ/XKOMVzPY+b+E4rnljvWupUI
mA0RGFxBEQkbxBQyABbADVxhV1A8Xs7pBfDUt4xeU4XfjNU=
X-Google-Smtp-Source: ADFU+vufeO1W5p5O0tGonOOoIPSXRzJCorm0+bYvJyKSOpJVaslQJRbxr/UXwm4OrYqEybFAS8MxEcZFaSOAPlEybPk=
X-Received: by 2002:a9d:364b:: with SMTP id w69mr13382682otb.332.1585670734767;
Tue, 31 Mar 2020 09:05:34 -0700 (PDT)
MIME-Version: 1.0
References: <redmine.issue-4509.20200331070026@plan.io> <redmine.journal-15192.20200331092507.015d67dedea34598@plan.io>
In-Reply-To: <redmine.journal-15192.20200331092507.015d67dedea34598@plan.io>
From: Gerben Abbink <gerben.abbink@gmail.com>
Date: Tue, 31 Mar 2020 18:05:23 +0200
Message-ID: <CALOFD2V++LWU7u9myj4XG11nQjQ4g4rFHGMpsM8UZwq2dVp-jw@mail.gmail.com>
Subject: Re: [Saxon - Bug #4509] (In Progress) Saxon 10 DOM builder creates
redundant namespace attributes
To: Saxonica Developer Community <inbox+saxonica+f38e+saxon@plan.io>
Content-Type: multipart/alternative; boundary="000000000000e06d8505a228bcb6"

--000000000000e06d8505a228bcb6
Content-Type: text/plain; charset="UTF-8"

In my code hasAttribute("xmlns") also returns false
but getAttributes().item(0).getNodeName() actually returns "xmlns".

On Tue, Mar 31, 2020 at 11:25 AM Saxonica Developer Community <
notifications@plan.io> wrote:

> --- In your reply, please do not write below this line ---
> Issue #4509 <https://saxonica.plan.io/issues/4509?pn=1#change-15192> has
> been updated by Michael Kay.
>
> - *Status* changed from *New* to *In Progress*
>
> I've written a JUnit test as follows, and it passes:
>
> public void testBug4509() {
> try {
> Processor proc = new Processor(false);
> net.sf.saxon.s9api.DocumentBuilder builder = proc.newDocumentBuilder();
> builder.setTreeModel(DOMObjectModel.getInstance());
> XdmNode tree = builder.build(new StreamSource(new StringReader("<root xmlns='namespace'><a/><b/></root>")));
> Document doc = (Document)((DOMNodeWrapper)tree.getUnderlyingNode()).getUnderlyingNode();
> Element root = doc.getDocumentElement();
> assertTrue(root.hasAttribute("xmlns"));
> Element a = (Element)root.getChildNodes().item(0);
> assertFalse(a.hasAttribute("xmlns"));
> Element b = (Element) root.getChildNodes().item(1);
> assertFalse(b.hasAttribute("xmlns"));
> } catch (SaxonApiException err) {
> fail(err.getMessage());
> }
> }
>
> Presumably you are doing something slightly different. Could you provide a
> repro please?
> ------------------------------
> Bug #4509: Saxon 10 DOM builder creates redundant namespace attributes
> <https://saxonica.plan.io/issues/4509?pn=1#change-15192>
>
> - Author: Gerben Abbink
> - Status: In Progress
> - Priority: Normal
> - Assignee: Michael Kay
> - Category: DOM Interface
> - Sprint/Milestone:
> - Legacy ID:
> - Applies to branch: 10
> - Fix Committed on Branch:
> - Fixed in Maintenance Release:
>
> I have this XML:
>
> <root xmlns="namespace">
> <element/>
> <element/>
> </root>
>
> I build a DOM using net.sf.saxon.s9api.DocumentBuilder.
>
> In the resulting DOM each "element" node has a "namespace" attribute.
>
> In version 9 this was not the case, only the root had a "namespace" atribute.
>
> Is this change by design or is it a bug?
>
> ------------------------------
>
> You have received this notification because you have either subscribed to
> or are involved in a project on Saxonica Developer Community site. To
> change your notification preferences, please click here:
> https://saxonica.plan.io/my/account?tour=mail_preferences
>
> This notification was cheerfully delivered by <https://plan.io/>
> [image: Planio] <https://plan.io/>
>

--000000000000e06d8505a228bcb6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">In my code hasAttribute(&quot;xmlns&quot;) also returns fa=
lse but=C2=A0getAttributes().item(0).getNodeName() actually returns &quot;x=
mlns&quot;.</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"g=
mail_attr">On Tue, Mar 31, 2020 at 11:25 AM Saxonica Developer Community &l=
t;<a href=3D"mailto:notifications@plan.io">notifications@plan.io</a>&gt; wr=
ote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>







<div style=3D"font-family:ProximaNova-Regular,Helvetica,Arial,sans-serif;fo=
nt-size:14px;line-height:1.4em;color:rgb(51,52,52)">
<table width=3D"100%" cellspacing=3D"0" cellpadding=3D"0" style=3D"border-s=
pacing:0px;border-collapse:collapse;width:100%">
<tbody><tr><td style=3D"text-align:center;width:100%;font-family:MarketWeb,=
Helvetica,Arial,sans-serif;font-size:0.8em;color:rgb(215,215,215)"><p>--- I=
n your reply, please do not write below this line ---</p></td></tr>
<tr><td>Issue <a href=3D"https://saxonica.plan.io/issues/4509?pn=3D1#change=
-15192" style=3D"color:rgb(0,136,183)" target=3D"_blank">#4509</a> has been=
updated by Michael Kay.

<ul>
<li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i>=
</li>
</ul>

<p>I&#39;ve written a JUnit test as follows, and it passes:</p>
<pre style=3D"font-family:Hack,Consolas,Menlo,&quot;Liberation Mono&quot;,C=
ourier,monospace;font-size:85%;background-color:rgb(236,236,236);margin:1em=
0px;padding:8px;border:none;border-radius:3px;width:auto;overflow:auto hid=
den"><code style=3D"font-family:Hack,Consolas,Menlo,&quot;Liberation Mono&q=
uot;,Courier,monospace;font-size:85%;background-color:rgb(236,236,236);bord=
er-radius:3px;margin:0px;padding:0px">public void testBug4509() {
try {
Processor proc =3D new Processor(false);
net.sf.saxon.s9api.DocumentBuilder builder =3D proc.newDocument=
Builder();
builder.setTreeModel(DOMObjectModel.getInstance());
XdmNode tree =3D builder.build(new StreamSource(new StringReade=
r(&quot;&lt;root xmlns=3D&#39;namespace&#39;&gt;&lt;a/&gt;&lt;b/&gt;&lt;/ro=
ot&gt;&quot;)));
Document doc =3D (Document)((DOMNodeWrapper)tree.getUnderlyingN=
ode()).getUnderlyingNode();
Element root =3D doc.getDocumentElement();
assertTrue(root.hasAttribute(&quot;xmlns&quot;));
Element a =3D (Element)root.getChildNodes().item(0);
assertFalse(a.hasAttribute(&quot;xmlns&quot;));
Element b =3D (Element) root.getChildNodes().item(1);
assertFalse(b.hasAttribute(&quot;xmlns&quot;));
} catch (SaxonApiException err) {
fail(err.getMessage());
}
}
</code></pre>
<p>Presumably you are doing something slightly different. Could you provide=
a repro please?</p>
<hr style=3D"width:100%;height:1px;background:rgb(204,204,204);border:0px;m=
argin:1.2em 0px">
<h1 style=3D"font-family:ProximaNova-Bold,Helvetica,Arial,sans-serif;font-w=
eight:normal;margin:0px;font-size:1.3em;line-height:1.4em"><a href=3D"https=
://saxonica.plan.io/issues/4509?pn=3D1#change-15192" style=3D"color:rgb(0,1=
36,183);text-decoration:none" target=3D"_blank">Bug #4509: Saxon 10 DOM bui=
lder creates redundant namespace attributes</a></h1>

<ul><li>Author: Gerben Abbink</li>
<li>Status: In Progress</li>
<li>Priority: Normal</li>
<li>Assignee: Michael Kay</li>
<li>Category: DOM Interface</li>
<li>Sprint/Milestone: </li>
<li>Legacy ID: </li>
<li>Applies to branch: 10</li>
<li>Fix Committed on Branch: </li>
<li>Fixed in Maintenance Release: </li></ul>

<pre style=3D"font-family:Hack,Consolas,Menlo,&quot;Liberation Mono&quot;,C=
ourier,monospace;font-size:85%;background-color:rgb(236,236,236);margin:1em=
0px;padding:8px;border:none;border-radius:3px;width:auto;overflow:auto hid=
den"><code style=3D"font-family:Hack,Consolas,Menlo,&quot;Liberation Mono&q=
uot;,Courier,monospace;font-size:85%;background-color:rgb(236,236,236);bord=
er-radius:3px;margin:0px;padding:0px">I have this XML:

&lt;root xmlns=3D&quot;namespace&quot;&gt;
&lt;element/&gt;
&lt;element/&gt;
&lt;/root&gt;

I build a DOM using net.sf.saxon.s9api.DocumentBuilder.

In the resulting DOM each &quot;element&quot; node has a &quot;namespace&qu=
ot; attribute.

In version 9 this was not the case, only the root had a &quot;namespace&quo=
t; atribute.

Is this change by design or is it a bug?
</code></pre>


<div><div></div></div>

</td></tr>
<tr><td style=3D"font-size:0.8em;width:100%"><hr style=3D"width:100%;height=
:1px;background:rgb(204,204,204);border:0px;margin:1.2em 0px"><p>You have r=
eceived this notification because you have either subscribed to or are invo=
lved in a project on Saxonica Developer Community site.
To change your notification preferences, please click here: <a href=3D"http=
s://saxonica.plan.io/my/account?tour=3Dmail_preferences" style=3D"color:rgb=
(0,136,183)" target=3D"_blank">https://saxonica.plan.io/my/account?tour=3Dm=
ail_preferences</a></p></td><td></td></tr>
<tr><td style=3D"text-align:center;width:100%;font-family:MarketWeb,Helveti=
ca,Arial,sans-serif;font-size:1.2em;color:rgb(215,215,215)"><br><div><a hre=
f=3D"https://plan.io/" style=3D"color:rgb(215,215,215);text-decoration:none=
" target=3D"_blank">This notification was cheerfully delivered by</a></div>=
</td><td></td></tr>
<tr><td style=3D"text-align:center;width:100%"><a href=3D"https://plan.io/"=
title=3D"Planio" style=3D"color:rgb(0,136,183)" target=3D"_blank"><img src=
=3D"https://assets.plan.io/images/planio_logo_gray_204x50.png" height=3D"25=
" width=3D"102" border=3D"0" alt=3D"Planio" style=3D"vertical-align: middle=
; border: none;"></a></td></tr>
</tbody></table>
</div>

</blockquote></div>

--000000000000e06d8505a228bcb6--
    (1-1/1)