Quote:
Originally Posted by KevinH
FWIW, pure xml allows any tags and attributes anyone would want. The problem is that two or more xml projects/language variants could use the same name for different tags that mean different things. And worse yet these names could needed to be used in the same xml file. So xml adopted the use of namespaces and these namespaces had to be unique so they decided to use a url/uri to represent them since no two different websites could have the same url. (These urls need not point to functional web pages but sometimes do).
The idea was to prefix each tag with its associated project namespace (url).. However that is too cumbersome in practice and shorter namespace prefixes were used instead. Things like opf: and dc: and even ns0: are examples of these shorter namespace prefixes.
Each prefix needs to be defined by using an xmlns attribute hopefully in the root tag and where else needed by using the xmlns attribute.
So the attribute: xmlns  pf="http://www.idpf.org/2007/opf" is often seen in opf files to define the namespace associated with the opf: prefix.
To make notation even shorter a tag can define a default namespace that tells you that all tags without prefixes are using this namespace. For example:
xmlns="http://www.idpf.org/2007/opf" means that the tags in the opf namespace do not need a prefix at all.
Your epub opf defined an uncommon prefix (ns0  for tags in the opf namespace and then needed to prefix all tags with ns0: as a result.
This made the opf much more cumbersome than usual.
Sigil's code knows the urls associated with epub namespaces and now properly simplifies (cleans) them down to the most compact (typical) form so that they can be more easily be read, written, and parsed.
Hope something here helps.
|
Thank you.
That is one more step on my journey to learn about the OPF file and ePubs.
I bet just when I think I have learned all that is necessary it all changes.