html in rich-text field --> to XML --> to Flash

C

chadedge

Excuse me if I'm repeating a few different posts (I've spent the last 6
hours reading newsgroups and creating snippets that may help).

Here's my issue: I am using infoPath to create a form that developers
will use to generate XML 'script' files (Module, Chapter, Step -> step
text, step name, step instruction). I need to insert simple HTML (bold,
paragraph break, font color) for use by Flash MX 2004. The Flash app
consumes our XML and displays fields, nodes, and attributes.

I've solved the "my:" issue (rebuilding based off my own XML file);
however, I need to allow a developer (while using infoPath) to add
basic HTML that will be consumed by Flash at a later time.

Currently, if I use a Rich-Text field, I get XHTML as a result (sorry,
Flash can't consume <div> and <strong> tags). If a developer pastes
HTML (<b> and <p> tags), those are converted to &lt; b &lt; (of course
it does; nice touch).

Not being able to save out the XML exactly as we need is a
deal-breaker; Once a form is saved as XML, it will not be reopened in
infoPath (this is a one-time event in 99% of cases; if we have to
reopen, I'll have to come up with some other solution).

Beyond writing an entirely new app that takes the XML and converts the
XHTML to HTML, is there a way to do this from within infoPath?

I'm a basic ActionScript, PHP, (web languages) programmer (giving you
an idea of my skill level), so xpath stuff and digging into vbscript is
uphill for me, but I'm not above following along.
 
H

Henning Krause [MVP - Exhange]

Hello,

you could use a custom OnSave Eventhandler and do a transform of the DOM,
removing the div tags. Then save the data manually. This will of course
require a full trusted form.

Another try would be to set the transformed xml back into the DOM and call
the default save method.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)
 
C

chadedge

The conversion was something I was thinking of, the problem I have with
that is converting DIV to P, STRONG to B, and STYLE tags to FONT is
that if the developer re-opens the XML file in infoPath (quite possible
since they may have corrections, additions, edits), the XML would no
longer be well-formed.

What about a button that states "Save XML for Flash" that, when
pressed, runs that conversion function and saves a secondary XML file
into a builds directory (retaining the original, well-formed, XHTML
data in the original)?

I've got some infoPath developers stopping by today; I'll post results.
 
H

Henning Krause [MVP - Exhange]

Hello,

I don't see why transforming div tags to other html tags will result in a
not well-formed xml.

But the other solution of yours should also work. I've created a form with a
similar approach: The formular is saved to a local directory. A second
button exists which sends the xml to a webservice where it will be
transformed.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)
 
C

chadedge

So I still haven't gotten anywhere with converting the XHTML to HTML
(for use w/ flash), but I'm now working on just stripping the basic
?mso tags (there's 2) and the xmlns tag so I have clean XML for Flash
(it accepts very very basic xml).

I'm looking for some information on how to add a button that outputs a
second XML file (possibly called 'module[n]-clean.xml').

Any thoughts?
 
C

chadedge

Getting so darned close with this solution. I have a final XML layout,
have made my forms (which output nearly what I need);

My final goals:

1. "Export to Flash" button that exports a 'clean' XML file (not using
XHTML rich-text anymore; only strings)
2. Clear out extra namespace definitions.

The current problem I'm having right now: I've got a sample XML file
created by a producer that has nodes like <stepinstruction>this is some
<b>bold</b> as well as normal text.</stepinstruction>... The problem
is: InfoPath doesn't like the <b> tags "Element 'b' is unexpected
according to content model of parent element 'stepinstruction'.

I'm guessing that's because the xsd for this file has 'stepinstruction'
set as string ( <xsd:element name="stepinstruction"
type="xsd:string"/>)?

Sigh. I hate having to get this done. I haven't even dug into the
Visual Studio end of things since I don't understand that codebase (I
found a good couple of chapters in Introducing Microsoft Office
InfoPath 2003 (MS Press)).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top