-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefix breaks in version 0.3.20 #152
Comments
Thank you @Novtopro for the report. This was exactly why I was worried about the fix for #150 because inner elements were not tested. @HassanAkbar @suleman-uzair can we fix this ASAP with additional specs as mentioned in #151 ? |
@ronaldtse Sure, I'm on it. |
@HassanAkbar ok I am a bit confused with namespace behavior. This is the XML Namespaces specification. The "fully namespaced name" of an element name or an attribute, which contains a "namespace name" and a "local name" is called the "expanded name". Look at 6.2, the "larger example": <?xml version="1.0"?>
<!-- initially, the default namespace is "books" -->
<book xmlns='urn:loc.gov:books'
xmlns:isbn='urn:ISBN:0-395-36341-6'>
<title>Cheaper by the Dozen</title>
<isbn:number>1568491379</isbn:number>
<notes>
<!-- make HTML the default namespace for some commentary -->
<p xmlns='http://www.w3.org/1999/xhtml'>
This is a <i>funny</i> book!
</p>
</notes>
</book> If a "default namespace" is defined at a parent element, all unprefixed child elements are supposed to be of the same namespace.
If a "default namespace" is defined on an element inside a tree that has a "default namespace" already defined, only the closest "default namespace" is used.
In the next example: <?xml version='1.0'?>
<Beers>
<!-- the default namespace inside tables is that of HTML -->
<table xmlns='http://www.w3.org/1999/xhtml'>
<th><td>Name</td><td>Origin</td><td>Description</td></th>
<tr>
<!-- no default namespace inside table cells -->
<td><brandName xmlns="">Huntsman</brandName></td>
<td><origin xmlns="">Bath, UK</origin></td>
<td>
<details xmlns=""><class>Bitter</class><hop>Fuggles</hop>
<pro>Wonderful hop, light alcohol, good summer beer</pro>
<con>Fragile; excessive variance pub to pub</con>
</details>
</td>
</tr>
</table>
</Beers> When a namespace is set to the empty string "", then the applicable default namespace is cleared (no namespace).
According to 6.3, "default namespace does not apply to attribute names": <!-- http://www.w3.org is bound to n1 and is the default -->
<x xmlns:n1="http://www.w3.org"
xmlns="http://www.w3.org" >
<good a="1" b="2" />
<good a="1" n1:a="2" />
</x> Therefore
We should obviously use these examples as specs. |
@Novtopro I believe this problem has been resolved in 0.3.24. Could you help check? Thanks! |
Thanks @Novtopro ! |
In version 0.3.19, the spec below works as expected
but in 0.3.20 and above, it does not
The prefix is gone.
FYI @ronaldtse @HassanAkbar
Can be reproduced in metanorma/niso-jats#19 by updating the gem version.
The text was updated successfully, but these errors were encountered: