OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XML with embedded docs?

[ Lists Home | Date Index | Thread Index ]
  • From: "Simon Wilson" <Simon.Wilson@crealogix.com>
  • To: "David C. Mason" <dcm@redhat.com>, xml-dev@xml.org
  • Date: Wed, 5 Apr 2000 10:06:42 +0200



>We are building a slide presentation application for Linux. I have
>been suggesting that we use XML for the file format of saved
>presentations. This has obvious benefits but it has one major drawback
>in our case:
>
>We are creating this app with a component system (Bonobo) which allows
>the user to, for example, save a spreadsheet *within* their
>presentation slide. So here we have another file format(not XML) that
>needs to be embedded into an xml file. As far as my knowledge takes
>me, XML is a bit too "flat" for this - or is it? How can this be
>handled in such a way that we still end up with a valid XML document?
>Can it?

XML certainly isn't too 'flat' for what you need. Assuming that Bonobo (which I
am not familiar with) allows you to serialize the state of embedded objects into
a stream, there is nothing stopping you from writing out this binary data
formatted as ASCII hex characters as the CDATA of an XML element. Disadvantage:
it might be a little verbose ;-)

Here's an example (using terminology from Microsoft's OLE as a parallel to
Bonobo):

<?xml version="1.0"?>
<doc>
     <object CLSID="{7F340832-FBE9-11D3-9211-0050DA33CC7B}">
          <position left="100" top="150"/>
          <dimensions width="400" height="300"/>
          <state>0A60f23920192394ff83945000000000001012f27712</state>
     </object>
</doc>

This provides you with enough information to re-create the object (based on its
CLSID) and place it in the correct position with the correct dimensions You can
then create an IStream object on the contents of the <state> element and use it
to initialize the object's state.

Alternatively, you could serialize the binary data in the <state> tag into a
seperate file and then reference that external file by name. i.e.

<?xml version="1.0"?>
<doc>
     <object CLSID="{7F340832-FBE9-11D3-9211-0050DA33CC7B}"
state_ref=".\7F340832-FBE9-11D3-9211-0050DA33CC7B.000405.124536.1.bin">
          <position left="100" top="150"/>
          <dimensions width="400" height="300"/>
     </object>
</doc>

This might be less verbose but you'll probably run into loads of potential
problems trying to keep the bin files together with the mail XML document. You
also have to guarantee that the file name specified as the state_ref value will
be unique when the file is created _and_ after any form of file
transmission/duplication. This presents a potential nightmare. Personally, I
wouldn't bother with this solution.

Hope this helps,

Simon



***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS