Help with Style XML

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Help with Style XML

Postby scottaf » Mon Jan 14, 2008 4:39 am

Hello,

I'm writing some software in java to merge styles from one document to another however can't seem to get the import of styles to work at all. I have tried using the XDocumentHandler to import the style xml elements from office:document-styles on down but no luck. Here is how I setup the importers ( I tried XMLImporter and XMLStylesImporter). Do I need and external xsl to accomplish this?

Object xmlImporter = xRemoteServiceManager.createInstanceWithContext(
"com.sun.star.comp.Writer.XMLImporter", xRemoteContext);
Object xmlStylesImporter = xRemoteServiceManager.createInstanceWithContext(
"com.sun.star.comp.Writer.XMLStylesImporter", xRemoteContext);
// get the interface of xmlexportfilter service
XImporter xImporter = (XImporter)UnoRuntime.queryInterface(XImporter.class, xmlImporter);

//XDocumentHandler xDocumentHandler =
// (XDocumentHandler)UnoRuntime.queryInterface(XDocumentHandler.class, xmlImporter);

XDocumentHandler xStyleHandler =
(XDocumentHandler)UnoRuntime.queryInterface(XDocumentHandler.class, xmlStylesImporter);

xImporter.setTargetDocument(newDoc);

Any help would be appreciated?
scottaf
 
Posts: 3
Joined: Mon Jan 14, 2008 4:34 am

Re: Help with Style XML

Postby hol.sten » Mon Jan 14, 2008 7:15 pm

scottaf wrote:I'm writing some software in java to merge styles from one document to another

Sorry, but all I have is a question, because I never worked with XMLImporter or XMLStylesImporter in Java: Even if your merging of styles is possible, how will you handle styles that have the same name in both documents and don't have the same style settings? Wouldn't it be easier to use the well known style of one document and use them in both documents?
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: Help with Style XML

Postby scottaf » Tue Jan 15, 2008 12:00 am

Ill have some external rules for that... The issue is actually that I am using an XML parser for dealing with the document and when I go to create a OO set of objects to bring the document
back in, it fails to import the styles for some reason. Perhaps Im using the wrong set of apis. Basically I have the document as a single stream of XML including all the office:* sections. Its not zipped and separated
into several files as in odt. Is there a simple means for bringing a document in this way?

Thanks for your thoughts.
scottaf
 
Posts: 3
Joined: Mon Jan 14, 2008 4:34 am

Re: Help with Style XML

Postby hol.sten » Tue Jan 15, 2008 8:09 am

scottaf wrote:Is there a simple means for bringing a document in this way?

As far as I know, there is no such way.

If I had to deal with your problem, I would try to split the single stream of XML into separated files the way OOo does it, would zip them and open them the usual OOo loading documents way.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: Help with Style XML

Postby scottaf » Wed Jan 16, 2008 5:17 am

I did some more digging and it seems that the format I am looking to import is the Flat XML format. There used to be a Flat XML Filter but it is missing from its location in the dev project.
Has this been incorporated into the baseline now? Is there another way to import flat oasis XML?
scottaf
 
Posts: 3
Joined: Mon Jan 14, 2008 4:34 am

Re: Help with Style XML

Postby hol.sten » Wed Jan 16, 2008 11:57 pm

scottaf wrote:Has this been incorporated into the baseline now? Is there another way to import flat oasis XML?

As far as I know, the answer to both of your questions is no.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest