[Home] [Overview] [Developer] [Manual]

XML Explained

Open Contacts uses XML intensively upon different operations. The encoding is UTF-8. The following will explain the root element of each type of XML files. Please be advised, Open Contacts validates an XML file through only the root element, without using schema validation. When editing any XML file, please evaluate the respective schema files.

It is safer to edit the XML files with schema validation. Advanced XML editors like Visual Studio and Microsoft XML Notepad are recommanded.

XML Files

Import from MS Outlook, MS Outlook Express, Eudora and vCard

The root elements is "OpenContactsStandardImport". The XML files are respectively "ImportOutlook.xml", "ImportOutlookExpress.xml", "ImportEudora.xml" and "ImportVCard.xml".

The content describes the mapping between Open Contacts' dynamic fields and the source fields. The naming conventions of source fields follow the conventions of MS Outlook contact data. The value of a field element represent a source field. Please note, "FirstName", "LastName", "MiddleName", "Title" and "Notes" are not in such XML files, because Open Contacts will decide how to map these fields.

While importing 100% data fields from sources of other vendors is almost impossible in practice, the templates coming with Open Contacts had maximize the efficiency of importing. When you are modifying a template file, mostly you just need to adjust the combinations of sections and fields.

Import contacts from Mozilla/LDIF

The root elements is "OpenContactsLDIFImport". This XML defines the mapping between Open Contacts' fields and LDIF fields. For importing Mozilla's LDIF of address book, "ImportNetscapeMozillaThunderbird.xml" in folder Templates is used.



If attribute for FullName does not exist, dn will be used.

Import contacts from Vista

Because the persistent storage of Windows Vista Contacts is XML file, it is straightforward to transform Vista Contact XML files into Open Contacts XML using style sheet file "ImportVista.xsl".

Export contacts to XML

The content exported by OC could include either individuals or organizations, as well as categories and relationships. The dynamic structures of Open Contacts' data fields could be natively represented by XML. In addition, categories, linked contacts and settings etc. can also be exported.

Import contacts from CSV

The root elements is "OpenContactsCSVImport". As almost all existing address book programs employ fixed numbers of data fields, XML plays important part in mapping these data fields with dynamic fields of Open Contacts.

Export contacts to CSV/Excel

The root elements is "OpenContactsExport". Generally the file is generated through command [Main menu -> Output -> Export to CSV/Excel -> Add Export Template].

Alternatively, you may use XSLT to transform Open Contacts XML into CSV.

Custom print

The root elements is "OpenContactsCustomPrint".  This file is generally created by Open Contacts for custom print.

Export Contacts with XSLT Transformation

"OpenContactsXSLTRegister.xml" defines custom sub menu items. By default, this XML file registers the following XSLT files:

Open Contacts uses this XML to render sub menu items under [Tools -> Export Contacts with XSLT Transformation].

XSLT Style Sheets

Open Contacts uses xsl files ("default.xsl" and "defaultAdvanced.xsl" in folder Templates) for rendering Quick View of HTML. During the process of quick view, Open Contacts will create XML stream of the clicked contact, and merge the stream with an XSL stream loaded from any of the XSL file.

The schema of the XML stream is similar to the schema of the XML files exported, but with more typing info, so XSLT can act on field name, field type and field action.

You may designed your own style sheets, and save them. For normal quick view, the file name should be "default.xsl", and for advanced quick view, the name should be "defaultAdvanced.xsl".

There are other XSL style sheet files in the Templates folder, for exporting selected contacts into HTML file or Internet Explorer. The features of exporting to HTML is handy for both printing on paper and publishing contact info on Web.

File Name Application
Default.xsl Render Open Contacts' Quick View window with simple text output.
DefaultAdvanced.xsl Render Open Contacts' Quick View window with hyper links of actions, as well as categories and linked contacts.
ImportVista.xsl Importing from Windows Vista Contact files will use this.
XmlToMozillaLDIF.xsl Demo. Transform Open Contacts XML to LDIF of Mozilla format.
VistaToOCXML.xsl Demo. Transform a Windows Vista Contact file to Open Contacts XML. This file can be used for testing ImportVista.xsl.
ViewImportTemplate.xsl Demo. Transform an XML template file of importing to HTML in order to have a quick view on the mapping.
iCalendarDescription.xsl Function at [Main menu -> Tools -> Export to Birthday Reminder] uses this.