Page 1 of 1

"db:" prefix does not show in autocomplete in version 14

Posted: Mon Apr 15, 2013 2:52 pm
by george0abitbol
Hello everybody
I'm new to Docbook and Oxygen 14. So far, I was using Oxygen 12 and Docbook 5.
In Oxygen 12, every element that was suggested by the autocomplete list showed with the "db:" prefix (e.g. "db:para"). Since I upgraded to Oxygen 14, autocomplete only shows the element name and not the "db" prefix (e.g "para").
As a conclusion, my DocBook files now mix both prefixed and non-prefixed elements.
Do you know how to solve that issue ?

Thank you

George

Re: "db:" prefix does not show in autocomplete in version 14

Posted: Mon Apr 15, 2013 4:14 pm
by adrian
Hello,

What specific versions of Oxygen are you comparing (e.g. v12.2 vs 14.2)?
Have you verified this on the same file and in the same context in both versions of Oxygen?
Are you looking at this in Author mode or Text mode?

I've compared v12.2 with v14.2 in Author mode and I don't see a difference between them in this regard. When you attempt to enter a new element, if the parent element has the 'db' prefix, the content completion (CC) will propose the elements with that prefix. So if you're editing inside an element with no prefix but still in the DocBook namespace, the CC will show the list without the 'db' prefix.

Note that the specialized DocBook actions (Emphasis Bold, Emphasis Italic, etc) from the toolbar/menu always insert the elements with no prefix (they specify the default namespace instead: xmlns="http://docbook.org/ns/docbook"). This is the same in v12.2 and v14.2 from what I've tested. This may be the actual cause for the inconsistency you have observed.

Unless you need the 'db' prefix for a specific reason (e.g. various namespaces in the same document), the simplest solution is to remove the prefix and set the DocBook namespace as the default namespace on the root element. This can be easily accomplished in Text mode: right click on the root element and from the contextual menu choose Refactoring > Rename Prefix. In the displayed dialog leave the New prefix name field empty and select Rename current prefix in all document. This will remove all 'db' prefixes from the document and also correctly set the default namespace.
You may still have to manually remove some of the redundant default namespace declarations xmlns="http://docbook.org/ns/docbook". If there are no other namespaces used as default namespaces in your document, you can use the Find/Replace (Replace All) tool to remove them.

Regards,
Adrian

Re: "db:" prefix does not show in autocomplete in version 14

Posted: Mon Apr 15, 2013 5:45 pm
by george0abitbol
Thanks for your quick response. I used Oxygen 12.2 and moved to version 14.2. I'm currently editing the same file on two machines, one with version 12.2 installed and the other one with version 14.2. FYI, I'm using the Author mode.

The file I'm editing on both versions has a structure of this type :
<db:chapter version="5.0" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"
xml:id="my_id">
<db:title>........</db:title>
<db:para>.........</db:para>
</db:chapter>


When I hit "Enter" inside the <db:para> element, autocomplete shows the following elements depending on the version of my editor :
=> Oxygen 14.2
*Split db:para
*abbrev
*accel
*acronym
*address
*and so on....

=>Oxygen 12.2
*Split db:para
*db:abbrev
*db:accel
*db:acronym
*db:address
*and so on...

You say:
When you attempt to enter a new element, if the parent element has the 'db' prefix, the content completion (CC) will propose the elements with that prefix.
=> But this is not the case in Oxygen 14.2. Only the current element is showed with the db: prefix.

Anyway. Thanks to your explanation I understand why I got this db: prefix in my files. Actually, I've never created my files from scratch. I used to rename existing files. These files were actually using the db: prefix. I used to think that this prefix was required for DocBook 5 files, which is not true, isnt' it ?

If this is true, I'd better refactor my whole files and remove the db: prefix ?

Thanks
George

Re: "db:" prefix does not show in autocomplete in version 14

Posted: Mon Apr 15, 2013 5:59 pm
by adrian
Hi,

I see what's happening. You've already declared the DocBook namespace as the default namespace on the root element:
xmlns="http://docbook.org/ns/docbook"
v14 checks for the default namespace and uses that if available, v12 prefers the one from the prefix in context.

You can go either way:
Remove the DocBook namespace as the default namespace from the root element.
Or remove the prefixes and leave the default namespace (preferred).

Regards,
Adrian

Re: "db:" prefix does not show in autocomplete in version 14

Posted: Mon Apr 15, 2013 6:11 pm
by george0abitbol
Thanks a lot Adrian
I'm going to remove any db: occurence and use the default namespace.
Thanks again
George