auto creation of child nodes
June 24 2008
- 1 reply.
- This question is resolved, if you still have a question, you can re-open it by reacting to it.
- This question was started by Iddo.
- Last post by Carl.
member 24 June,
13:41 | When I create a node with the following function:
function createNode(node,childName) { var document = node.getOwnerDocument(); var newnode = document.createElement(childName); node.appendChild(newnode); } the node is created but an error occurs, because, according to the xsd, the node should have childelements. When adding this node with the Xopus UI, the childnodes are automatically added. How to accomplish that using javascript? |
Xopus Team 24 June,
14:07 | Iddo! I happily direct you to the wonderful world of makeComplete and makeValid, where no node escapes schema validation or goes without what is required. This is a fine example: node.appendChild(newnode); // try catch in case the make complete returns errors try { newnode.makeComplete(); } catch (e) { node.removeChild(newnode); } First we add the node to the document, so that Xopus can understand how to validate it, then makeComplete is called (makeValid does the same thing). This is under a try catch, because if makeComplete may open attribute editors with required attribute values, and this dialog is cancelled, the node is not valid, the function throws an exception, and therefore the node must be removed from the document. Enjoy. |
- support /
- forum /
- How To ... /
- auto creation of child nodes
React
Write a comment