NameSpace

 

BioXML Wiki   

Namespaces are essential to xml and to BioXML. Namespaces prevent nameclashes of common tags, like database. Essentially, they are quite simple. If you have a set of xml tags that you would like to have a namespace, you simply give them a prefix:tagname . So, in our case, database becomes bx-dbxref:database . The only thing you need now is a universal id to connect your prefix to. This is just a url specified by the xmlns attribute.

<bx-dbxref:database xmlns:bx-dbxref="http://www.bioxml.org/dtds/current/bx-dbxref">

Note that the namespace url is not expected to point to anything. IT IS ONLY A UNIQUE IDENTIFIER, NOT A DOCUMENT REFERENCE. This is one of the most common misconceptions about namespaces.

A problem of namespaces is that they were hacked on top of the xml 1.0 recomendation, so the integration between xml 1.0 and namespaces leaves something to be desired. The suggestion for getting your documents to parse, as suggested by the excellent xml namespaces FAQ is to use fully qualified names and explicit xmlns attributes in both your xml documents and your dtds is the one we have followed.


Related pages: Unclassified?
This page last edited on 12 Oct 2000
< Version:1.6
     
 
 
  • Search Wiki for: