Fun With XML

This section is for anyone with the tiniest inner geek or curiosity about how your files are constructed .

Unzipping Your Files' Inner XML

The reason OpenOffice.org files are so small is that they're stored in XML, not binary format. You can also just unzip any file to see the XML files that make it up. Each regular document file has separate XML files that make it up, such as one containing the content, one containing the formatting, and so on.

When you use a ZIP program to unzip a document, you'll get the following files.

  • The plain text content content.xml . You can view this file with a standard text editor such as TextPad; it's shown in Figure 5-51.

    Figure 5-51. Content.xml file

    graphics/05fig51.jpg

    content.xml is stored without indents so it's not that easy to read, but takes up less space. You can make it more readable by choosing Tools > Options > Load/Save > General and deselecting the Size Optimization for XML Format option.

  • meta.xml contains the information about the document displayed under File > Properties.

    If you save a document with security, only meta.xml is not secured.

  • settings.xml contains further information like printer settings and data sources.

  • styles.xml contains the styles defined for the document.

  • The meta-inf/manifest.xml file describes the structure of the XML file.

Information about graphics is contained in additional subdirectories.

The DTD (document type descriptor) files are at office\share\dtd . You can get more information about the DTD and associated licenses at www.openoffice.org.

Doing Incredibly Dangerous Things With XML Configuration Files

We're not going to show you how to shoot yourself in the foot , but we'll tell you where the gun is if you really want to know.

The following directories are chock full of configuration files. Some of them contain settings you specify in the Tools > Options windows ; some you can't get to except through editing the files directly.

graphics/triangle.gif

Make a full backup or two before you go anywhere near these files.

As noted in Showing More than Four Recent Documents in the File List on page 145, editing the Common.xml file lets you open a near infinite number of old documents by selecting them from the file menu. However, you really should know your way around XML to even think about touching these files.

Figure 5-52 shows the directories; Figure 5-53 shows examples of the Writer.xml and DataAccess.xml files.

Figure 5-52. Locations of XML configuration files

graphics/05fig52.jpg

Figure 5-53. The DataAccess.xml and Writer.xml files

graphics/05fig53.jpg

As you can see, files like Writer.xml contain some relatively innocuous information like business card data; if you just change your address here, not much bad will happen (probably). If you start messing around with field definitions, that's a little more serious. Also keep in mind that any data stored here might also be stored elsewhere and conflicts could cause uncalled for whackiness in your documents.



OpenOffice. org 1.0 Resource Kit
OpenOffice.Org 1.0 Resource Kit
ISBN: 0131407457
EAN: 2147483647
Year: 2005
Pages: 407

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net