OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Newbie: Question regarding XML usage

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
pmalekza
Newbie
Newbie


Joined: 06 Aug 2003
Posts: 2

PostPosted: Wed Aug 06, 2003 6:57 am    Post subject: Newbie: Question regarding XML usage Reply with quote

Hello I have not used OpenOffice before so please excuse my ignorance since I am a complete newbie at this.
However I know that since OpenOffice saves the file in XML format there should be
a way to convert an RTF file into XML via XSLT and back to RTF. The XML file is based on a schema that I have.
Has anyone tried this yet and is it something that can be done or am I wasting time?
thank you for your help. Smile
Back to top
View user's profile Send private message
fedetxf
OOo Enthusiast
OOo Enthusiast


Joined: 29 May 2003
Posts: 119
Location: La Plata, Argentina

PostPosted: Wed Aug 06, 2003 8:40 am    Post subject: Re: Newbie: Question regarding XML usage Reply with quote

pmalekza wrote:
Hello I have not used OpenOffice before so please excuse my ignorance since I am a complete newbie at this.
However I know that since OpenOffice saves the file in XML format there should be
a way to convert an RTF file into XML via XSLT and back to RTF. The XML file is based on a schema that I have.
Has anyone tried this yet and is it something that can be done or am I wasting time?

thank you for your help. Smile


RTF is not XML and I think XSLT can only go from XML to XML, so maybe thst is not possible.
Maybe you need to use Formatting Objects (FO) which is how some people fo from XML to PDF (another non XML format) using XSLT
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Aug 06, 2003 9:50 am    Post subject: Re: Newbie: Question regarding XML usage Reply with quote

fedetxf wrote:
pmalekza wrote:
Hello I have not used OpenOffice before so please excuse my ignorance since I am a complete newbie at this.
However I know that since OpenOffice saves the file in XML format there should be
a way to convert an RTF file into XML via XSLT and back to RTF. The XML file is based on a schema that I have.
Has anyone tried this yet and is it something that can be done or am I wasting time?

thank you for your help. Smile


RTF is not XML and I think XSLT can only go from XML to XML, so maybe thst is not possible.
Maybe you need to use Formatting Objects (FO) which is how some people fo from XML to PDF (another non XML format) using XSLT


Thank you for responding.

I do understand this, but I may not have been clear in my question. Since OpenOffice does save it's files in XML format, as I have read this, and it has support for MSWORD/RTF files, I was thinking that I can use OpenOffice to help generate RTF files via it's "engine" if you wanna call it that. Sort of like example below:
MyXML->OOXML(via XSLT)->RTF(via OpenOfiice).
Could this not be done? or am I thinking too far ahead?
I also know about XML FO but that is way too premature for what I need.
The apache FOP project has yet to provide RTF support, so I can't waste time with that.
I hope my question became more clear.
thank you again. Very Happy
Back to top
fedetxf
OOo Enthusiast
OOo Enthusiast


Joined: 29 May 2003
Posts: 119
Location: La Plata, Argentina

PostPosted: Wed Aug 06, 2003 10:34 am    Post subject: Re: Newbie: Question regarding XML usage Reply with quote

Anonymous wrote:

I do understand this, but I may not have been clear in my question. Since OpenOffice does save it's files in XML format, as I have read this, and it has support for MSWORD/RTF files, I was thinking that I can use OpenOffice to help generate RTF files via it's "engine" if you wanna call it that. Sort of like example below:
MyXML->OOXML(via XSLT)->RTF(via OpenOfiice).
Could this not be done? or am I thinking too far ahead?
I also know about XML FO but that is way too premature for what I need.
The apache FOP project has yet to provide RTF support, so I can't waste time with that.
I hope my question became more clear.
thank you again. Very Happy


OO does not have RTF conversion (afaik). I think maybe there's some RTF export filter in the works.
The step from your xml to oo.org xml is doable if you know your dtd and the oo dtd and you can find the convertion you need.
The OO.org -> RTF can be done exporting to DOC using oo and then saving the doc as RTF with word or some other program that reads DOC and saves RTF.
Automating that process may be a bit hard.
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Aug 06, 2003 11:53 am    Post subject: Reply with quote

Thank you again. Very Happy
I thought it would require something like that. Probably need to create some macro along with it to export it from the OO file format to RTF/DOC. I guess I have to get in "knees deep".
I will post my findings when they are absolute.

thank you, gracias, merci, danke schön, arigato, obrigado! Laughing
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Wed Aug 06, 2003 12:24 pm    Post subject: Reply with quote

OOo 1.1 RC can Save As... into RTF. Seems to even do a passable job.

Your basic premise of

YourXML ---> OOoXML -----> Any format savable by OOo

is sound. The biggest question, I believe, is whether OOo's RTF export is suitable for your purposes.

Here are some pointers to get you started.

OOo's document format is actually a ZIP file containing XML. To create a valid Writer file, all you actually need is a file named Content.xml to be zipped into a ZIP file, and then named something that ends with ".sxw" instead of ".zip".

So how can you learn what is in the Content.xml? Well, you can study the docs. The SDK contains documentation on the XML format of all OOo document types.

A tool that might help you is my OOoDocExplorer. This is a java program. Available from OOoMacros.org here...

http://www.ooomacros.org/dev.php#92225

The way this works is thus. Launch the JAR file. A dialog box appears prompting you for a file. Select any OOo document. A new window appears that shows you the internal structure of the file as a tree of unfoldable nodes. When you click on a node, it's attributes and contents are shown. The nodes start with the top level files in the ZIP file. So first click on Content.xml to see the XML nodes within the Content.xml file.

You will have to build your XSLT to transform YourXML into Content.xml. Then you will need to ZIP this, and name it Something.sxw. Then you will need to open it in OOo. Then you will need to SaveAs into an RTF format. You could automate the SaveAs by using a Macro.

You could even embed the SaveAs macro into your document. (No reason why it is not theoretically possible.) You would have to learn just how a macro is stored within an OOo document. I've seen the Basic macro code in my documents while using my Java OOoDocExplorer program to snoop around inside my own files. You could even make your document such the "Open" event of the document triggers the macro, which then saves the document, and then closes it. (This would make it impossible to open the document, unless you turn off the ability to run macros.) But it would highly automate your conversion to RTF process.

I also have a Maze Builder program in Java available at OOoMacros.

I edited this message on 2004-03-30 to update the URL links to better locations.
_________________
Want to make OOo Drawings like the colored flower design to the left?


Last edited by DannyB on Tue Mar 30, 2004 7:35 am; edited 1 time in total
Back to top
View user's profile Send private message
pmalekza
Newbie
Newbie


Joined: 06 Aug 2003
Posts: 2

PostPosted: Wed Aug 06, 2003 6:11 pm    Post subject: Reply with quote

Thank you very much Danny, you have been very helpful.
I sincerely appreciate it! Smile

regards,
peyman m.
Back to top
View user's profile Send private message
alex
Guest





PostPosted: Thu Sep 18, 2003 12:10 am    Post subject: rtf->xml->rtf Reply with quote

Hello!

I think that if you want "to convert an RTF file into XML via XSLT and back to RTF" you can take a look at the next chain:

RTF-(RTF2FO)->XML (XSL FO)-(JFOR)->RTF.

Here you wil you RTF2FO converter and jFOR converter then.

Alex
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Thu Sep 18, 2003 6:17 am    Post subject: Reply with quote

Guest wrote:
I do understand this, but I may not have been clear in my question. Since OpenOffice does save it's files in XML format, as I have read this, and it has support for MSWORD/RTF files, I was thinking that I can use OpenOffice to help generate RTF files via it's "engine" if you wanna call it that. Sort of like example below:
MyXML->OOXML(via XSLT)->RTF(via OpenOfiice).
Could this not be done? or am I thinking too far ahead?


I recently answered a question in this thread

http://www.oooforum.org/forum/viewtopic.php?t=2668

where I give some code examples of using OOo to convert from one document format to another, including RTF.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Mar 29, 2004 4:50 pm    Post subject: Reply with quote

Anonymous wrote:
Thank you again. Very Happy
I thought it would require something like that. Probably need to create some macro along with it to export it from the OO file format to RTF/DOC. I guess I have to get in "knees deep".
I will post my findings when they are absolute.

thank you, gracias, merci, danke schön, arigato, obrigado! Laughing
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group