fixed formatting and indentation.
This commit is contained in:
parent
47ab428371
commit
443dd18158
1 changed files with 212 additions and 208 deletions
|
@ -75,7 +75,8 @@ public class XmlConverter implements XmlConstants {
|
||||||
|
|
||||||
public INode convert( Element element, INode helmaNode ) {
|
public INode convert( Element element, INode helmaNode ) {
|
||||||
offset++;
|
offset++;
|
||||||
if (DEBUG) debug("reading " + element.getNodeName() );
|
if (DEBUG)
|
||||||
|
debug("reading " + element.getNodeName() );
|
||||||
helmaNode.setName( element.getNodeName() );
|
helmaNode.setName( element.getNodeName() );
|
||||||
String prototype = (String)props.get(element.getNodeName().toLowerCase()+"._prototype");
|
String prototype = (String)props.get(element.getNodeName().toLowerCase()+"._prototype");
|
||||||
if ( prototype == null )
|
if ( prototype == null )
|
||||||
|
@ -124,15 +125,16 @@ public class XmlConverter implements XmlConstants {
|
||||||
if( helmaKey.equals("") )
|
if( helmaKey.equals("") )
|
||||||
// if property is set but without value, read elementname for this mapping
|
// if property is set but without value, read elementname for this mapping
|
||||||
helmaKey = childElement.getNodeName().replace(':',defaultSeparator);
|
helmaKey = childElement.getNodeName().replace(':',defaultSeparator);
|
||||||
if (DEBUG) debug("childtext-2-property mapping, helmaKey " + helmaKey + " for domKey " + domKey );
|
if (DEBUG)
|
||||||
|
debug("childtext-2-property mapping, helmaKey " + helmaKey + " for domKey " + domKey );
|
||||||
if ( helmaNode.getString(helmaKey,false)==null ) {
|
if ( helmaNode.getString(helmaKey,false)==null ) {
|
||||||
helmaNode.setString( helmaKey, XmlUtil.getTextContent(childNode) );
|
helmaNode.setString( helmaKey, XmlUtil.getTextContent(childNode) );
|
||||||
if (DEBUG) debug("childtext-2-property mapping, setting " + helmaKey + " as string" );
|
if (DEBUG)
|
||||||
|
debug("childtext-2-property mapping, setting " + helmaKey + " as string" );
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// is there a simple child-2-property mapping?
|
// is there a simple child-2-property mapping?
|
||||||
// (lets the user define to use only one element and make this a property
|
// (lets the user define to use only one element and make this a property
|
||||||
// and simply ignore other elements of the same name)
|
// and simply ignore other elements of the same name)
|
||||||
|
@ -141,16 +143,17 @@ public class XmlConverter implements XmlConstants {
|
||||||
// if property is set but without value, read elementname for this mapping:
|
// if property is set but without value, read elementname for this mapping:
|
||||||
if ( helmaKey.equals("") )
|
if ( helmaKey.equals("") )
|
||||||
helmaKey = childElement.getNodeName().replace(':',defaultSeparator);
|
helmaKey = childElement.getNodeName().replace(':',defaultSeparator);
|
||||||
if (DEBUG) debug("child-2-property mapping, helmaKey " + helmaKey + " for domKey " + domKey);
|
if (DEBUG)
|
||||||
|
debug("child-2-property mapping, helmaKey " + helmaKey + " for domKey " + domKey);
|
||||||
if ( helmaNode.getNode(helmaKey,false)==null ) {
|
if ( helmaNode.getNode(helmaKey,false)==null ) {
|
||||||
convert( childElement, helmaNode.createNode(helmaKey) );
|
convert( childElement, helmaNode.createNode(helmaKey) );
|
||||||
if (DEBUG) debug( "read " + childElement.toString() + helmaNode.getNode(helmaKey,false).toString() );
|
if (DEBUG)
|
||||||
|
debug( "read " + childElement.toString() + helmaNode.getNode(helmaKey,false).toString() );
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// map it to one of the children-lists
|
// map it to one of the children-lists
|
||||||
helma.objectmodel.INode newHelmaNode = null;
|
helma.objectmodel.INode newHelmaNode = null;
|
||||||
String childrenMapping = (String)props.get(element.getNodeName().toLowerCase()+"._children");
|
String childrenMapping = (String)props.get(element.getNodeName().toLowerCase()+"._children");
|
||||||
|
@ -170,7 +173,8 @@ public class XmlConverter implements XmlConstants {
|
||||||
// if virtual node doesn't exist, create it
|
// if virtual node doesn't exist, create it
|
||||||
worknode = helmaNode.createNode( helmaKey );
|
worknode = helmaNode.createNode( helmaKey );
|
||||||
}
|
}
|
||||||
if (DEBUG) debug( "mounting child "+ childElement.getNodeName() + " at worknode " + worknode.toString() );
|
if (DEBUG)
|
||||||
|
debug( "mounting child "+ childElement.getNodeName() + " at worknode " + worknode.toString() );
|
||||||
// now mount it, possibly re-using the helmaNode that's been created before
|
// now mount it, possibly re-using the helmaNode that's been created before
|
||||||
if ( newHelmaNode!=null ) {
|
if ( newHelmaNode!=null ) {
|
||||||
worknode.addNode(newHelmaNode);
|
worknode.addNode(newHelmaNode);
|
||||||
|
|
Loading…
Add table
Reference in a new issue