R
RickH
Using the ms XMLDOM...
What techniques do you guys use to create deep elements in code for
appending to the main document as the user "adds" complex objects.
Currently I keep 3 files to do it like this:
1) The main xml file that the user is editing
2) The xsd file that validates the user-manipulated document
3) A "model" xml file that looks like the user xml file but only
contains empty element nodes or nodes with default values, and only
the bare minimum nodes needed to keep validity to the above xsd.
When the user wants to "add" a complex deep element to the main doc.
I use my model.xml file to instantiate a deep model of the complex
node they are trying to add, then I import that node into the users
document. Now the main doc contains the desired element and all it's
mandatory children.
This coding technique alleviates my code of having to actually know
what the structure is of a complex node and having to do many
appendChild commands to make it manually. IOW I basically just clone
it from the model.xml then the user fills out the values using the
existing web page code.
Are there other techniques for doing deep element creation using the
ms dom? Assuming my document has a known xsd schema, is there a
createDeepElement() or some such method? The ms DOM createElement()
method only generates a simple element, if one wants to free their
executing code from procedurally constructing complex elements, what
other techniques might be available than what I am doing?
Thanks
What techniques do you guys use to create deep elements in code for
appending to the main document as the user "adds" complex objects.
Currently I keep 3 files to do it like this:
1) The main xml file that the user is editing
2) The xsd file that validates the user-manipulated document
3) A "model" xml file that looks like the user xml file but only
contains empty element nodes or nodes with default values, and only
the bare minimum nodes needed to keep validity to the above xsd.
When the user wants to "add" a complex deep element to the main doc.
I use my model.xml file to instantiate a deep model of the complex
node they are trying to add, then I import that node into the users
document. Now the main doc contains the desired element and all it's
mandatory children.
This coding technique alleviates my code of having to actually know
what the structure is of a complex node and having to do many
appendChild commands to make it manually. IOW I basically just clone
it from the model.xml then the user fills out the values using the
existing web page code.
Are there other techniques for doing deep element creation using the
ms dom? Assuming my document has a known xsd schema, is there a
createDeepElement() or some such method? The ms DOM createElement()
method only generates a simple element, if one wants to free their
executing code from procedurally constructing complex elements, what
other techniques might be available than what I am doing?
Thanks