morning all,

i'm currenty working on a system (php5), which handles xml data and generates forms. the xml-specification alllows to use html elements in particular xml-elements. the problem is, that all has the same namespace, so i can't differ with that.

i have to realize two different tasks: view-mode (forms are generated out of the xml) and edit-mode (user has the abilty to change the xml). in the first task, i use a sax, which only processes predifined tagnames, all other stuff is beeing dumped out or just ignored. important is, that nested html-elemnts are dumped as they are inside the xml.

my problem: i wrote some dom stuff, to find the right node if i have the validated form-data, which consists changes to the xml. but i become desperate with merging the html-elements back to the xml.

one solution would be, to handle all nodes (also the html-nodes) with dom. in my opinion, this seems much too costly. another point is, that we start with a part of elements to use. if i would try to handle all elements with dom, i would have to process the whole specification.

the second solution - the one i've chosen - integrates this partly sax-parser, to get all plaintext *and* html-elements as simple textblocks. all other elements i get as dom-node. it wouldn't be a big deal, to dump all that stuff back together, but i would like to have some possiblity to compare the original xml with the new ones. as a result i could 'update' my nodes and wouldn't have to rewrite all again and again.

my form data looks like that:
PHP Code:
[0
    [
TYPETEXT
    
[VALUE] <p>Read this postcard from your English pen-friendSam.<div><object type="image/png" data="images/postcard.png" ><blockquote class="postcard" ><p>Here is a postcard of my townPlease send me<bra postcard from your town.
                        
What size is your<brtownWhat is the nicest part of your town?<br>
                        
Where do you go in the evenings?<brSam.
[
1
    [
TYPENODE
    
[VALUE
    .    [
NAMEextendedTextInteraction
    
.    [ATTR
    .    .    [
idpostcardWriting
    
.    .    [responseIdentifierRESPONSE
    
.    .    [expectedLength200 
some part of the xml is that:

PHP Code:
<itemBody>
    <
p>Read this postcard from your English pen-friendSam.</p>
    <
div>
        <
object type="image/png" data="images/postcard.png">
            <
blockquote class="postcard">
                <
p>Here is a postcard of my townPlease send me<br/> a postcard from your town.
                    
What size is your<br/> townWhat is the nicest part of your town?<br/>
                    
Where do you go in the evenings?<br/> Sam.</p>
            </
blockquote>
        </
object>
    </
div>
    <
extendedTextInteraction id="postcardWriting" responseIdentifier="RESPONSE" expectedLength="200">
        <
prompt>Write Sam a postcardAnswer the questionsWrite 25-35 words.</prompt>
    </
extendedTextInteraction>
</
itemBody
it would be great, if somebody could give me some inspiration or suggestion, because i'm completely on my own with that stuff and also not very familiar yet.

best regeards,,
andi