Fixed bug that caused NullPointerException.

Added option to add selected elements to the default subnode
collection via element.childelement = prototype._children.
This commit is contained in:
hns 2002-07-10 18:30:56 +00:00
parent d6d7141350
commit d41c6d5657

View file

@ -217,6 +217,8 @@ public class XmlConverter implements XmlConstants {
if ( helmaKey==null && !sparse ) { if ( helmaKey==null && !sparse ) {
helmaKey = childElement.getNodeName().replace(':',defaultSeparator); helmaKey = childElement.getNodeName().replace(':',defaultSeparator);
} }
if (helmaKey == null)
continue;
// get the node on which to opererate, depending on the helmaKey // get the node on which to opererate, depending on the helmaKey
// value from the properties file. // value from the properties file.
@ -232,10 +234,15 @@ public class XmlConverter implements XmlConstants {
continue; continue;
// try to get the virtual node // try to get the virtual node
helma.objectmodel.INode worknode = node.getNode( helmaKey, false ); INode worknode = null;
if ( worknode==null ) { if ("_children".equals (helmaKey)) {
// if virtual node doesn't exist, create it worknode = node;
worknode = helmaNode.createNode( helmaKey ); } else {
node.getNode( helmaKey, false );
if ( worknode==null ) {
// if virtual node doesn't exist, create it
worknode = helmaNode.createNode( helmaKey );
}
} }
if (DEBUG) if (DEBUG)
debug( "mounting child "+ childElement.getNodeName() + " at worknode " + worknode.toString() ); debug( "mounting child "+ childElement.getNodeName() + " at worknode " + worknode.toString() );