Code example for Document

Methods: importNode

0
		if (importerDoc == null) {
			OMDOMFactory fac = new OMDOMFactory();
			importerDoc = (Document) fac.createOMDocument();
		} 
		// Import the node as an AXIOM-DOOM node and use toSting() 
		Node axiomNode = importerDoc.importNode(node, true);
		return axiomNode.toString();
	} 
 
	public static String getHMAC(String secretKey, String baseString) throws SignatureException {
		try { 
			SecretKeySpec key = new SecretKeySpec(secretKey.getBytes(), HMAC_SHA1_ALGORITHM);
			Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
			mac.init(key);
			byte[] rawHmac = mac.doFinal(baseString.getBytes());
			return Base64.encode(rawHmac);
		} catch (Exception e) {
			throw new SignatureException("Failed to generate HMAC : " + e.getMessage());
		} 
	}