Merging xml - expert advice needed

compiled repost

hi,

I was wondering if anyone has had experience appending a field to an xml exported form or subform? the separately exported field is defined like so:

!-- Document PDA

<font

size=‘8pt’ color=‘fuchsia’/>

<formula

“1”

@If (@IsDocBeingSaved; @DeleteField; FLD_PDA_Update)

<run

!-- Determine if doc

<run

ws updated thru the PDA or WAP device

<run

i need to somehow get that field into the xml of an exported subform, and then reimport the whole thing back into a database.

any suggestions? is my question clear?

i looked a couple of the samples in designer help, and i can see i need to use the domParser.Document.DocumentElement.appendchild() method. i am just not sure how to get in the right place, underneather another node. in my situation, under a node.

can i open the xml pasted above into another stream and then clone it as a node (clonedFieldNode), with all it’s children… then subformDocElement.appendChild(clonedFieldNode)?

tried it… but I get error “4576 Dom Operation Failed.”

maybe you can’t declare 2 domparsers in the same session… here’s my code:

Dim domParser As NotesDOMParser

Dim docNode As NotesDOMDocumentNode

Dim docRootNode As NotesDOMNode

Dim fieldDomParser As NotesDOMParser

Dim fieldDocNode As NotesDOMDocumentNode

Dim fieldDocRootNode As NotesDOMNode

Dim fieldElementNode As NotesDOMElementNode

Set domParser=session.CreateDOMParser(inputSubformXMLStream, outputSubformPlusFieldXMLStream)

domParser.Process

Set docNode = domParser.Document

Set docRootNode = docNode.DocumentElement

Set fieldDomParser=session.CreateDOMParser(fieldXMLStream, dummyStream)

fieldDomParser.Process

Set fieldDocNode = fieldDomParser.Document

Set fieldDocRootNode = fieldDocNode.DocumentElement

Set fieldElementNode = fieldDocRootNode.Clone(True)

If docRootNode.NodeName = “section” Then

Call docRootNode.AppendChild( fieldElementNode)

End If

Call domParser.Serialize()

someone suggested:

I’ve not done much with xml in R6 so don’t know the answer but…

You can declare 2 parsers. What you’ve done works right up to the appendchild. At that point you can append a new node but it refuses to accept a cloned node.

Perhaps you could try just appending a new node along the lines of

<xsl:include src=“c:\field.xml”/>

and pipe the output through xslt?

but am having a hard time setting the prefix… i am pretty sure i have the syntax right, but i keep getting a Dom Operation Error: namespace error.

i have set the domparser doNamespaces property to true… is there something else I am missing?

I am trying to add a node just as above

<xsl:include src=“c:\field.xml”/>

any suggestions would be greatly appreciated.

what’s the best way to do this??

thanks, T