public static void substituteProperties(Node node,Properties properties){
  Node child;
  Node next=node.getFirstChild();
  while ((child=next) != null) {
    next=child.getNextSibling();
    if (child.getNodeType() == Node.TEXT_NODE) {
      child.setNodeValue(PropertiesUtil.substituteProperty(child.getNodeValue(),properties));
    }
 else     if (child.getNodeType() == Node.ELEMENT_NODE) {
      NamedNodeMap attributes=child.getAttributes();
      for (int i=0; i < attributes.getLength(); i++) {
        Node attribute=attributes.item(i);
        attribute.setNodeValue(PropertiesUtil.substituteProperty(attribute.getNodeValue(),properties));
      }
      substituteProperties(child,properties);
    }
  }
}

public static void substituteProperties ( Node node , Properties properties ) { Node child ; Node next = node . getFirstChild ( ) ; while ( ( child = next ) != null ) { next = child . getNextSibling ( ) ; if ( child . getNodeType ( ) == Node . TEXT_NODE ) { child . setNodeValue ( PropertiesUtil . substituteProperty ( child . getNodeValue ( ) , properties ) ) ; } else if ( child . getNodeType ( ) == Node . ELEMENT_NODE ) { NamedNodeMap attributes = child . getAttributes ( ) ; for ( int i = 0 ; i < attributes . getLength ( ) ; i ++ ) { Node attribute = attributes . item ( i ) ; attribute . setNodeValue ( PropertiesUtil . substituteProperty ( attribute . getNodeValue ( ) , properties ) ) ; } substituteProperties ( child , properties ) ; } } }
replaces $ { property [ : default value ] } references in all attributes and text nodes of supplied node . if the property is not defined neither in the given properties instance nor in system . getproperty and no default value is provided , a runtime exception is thrown .
