From d41c6d5657a8477fadfa8d18b3ad72843617d8a7 Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 10 Jul 2002 18:30:56 +0000 Subject: [PATCH] Fixed bug that caused NullPointerException. Added option to add selected elements to the default subnode collection via element.childelement = prototype._children. --- src/helma/objectmodel/dom/XmlConverter.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/helma/objectmodel/dom/XmlConverter.java b/src/helma/objectmodel/dom/XmlConverter.java index 2b4bf53a..58ef2dbd 100644 --- a/src/helma/objectmodel/dom/XmlConverter.java +++ b/src/helma/objectmodel/dom/XmlConverter.java @@ -217,6 +217,8 @@ public class XmlConverter implements XmlConstants { if ( helmaKey==null && !sparse ) { helmaKey = childElement.getNodeName().replace(':',defaultSeparator); } + if (helmaKey == null) + continue; // get the node on which to opererate, depending on the helmaKey // value from the properties file. @@ -232,10 +234,15 @@ public class XmlConverter implements XmlConstants { continue; // try to get the virtual node - helma.objectmodel.INode worknode = node.getNode( helmaKey, false ); - if ( worknode==null ) { - // if virtual node doesn't exist, create it - worknode = helmaNode.createNode( helmaKey ); + INode worknode = null; + if ("_children".equals (helmaKey)) { + worknode = node; + } else { + node.getNode( helmaKey, false ); + if ( worknode==null ) { + // if virtual node doesn't exist, create it + worknode = helmaNode.createNode( helmaKey ); + } } if (DEBUG) debug( "mounting child "+ childElement.getNodeName() + " at worknode " + worknode.toString() );