Java tutorial
//package com.java2s; /* * XMLUtils.java * * Copyright (c) 1998 - 2006 BusinessTechnology, Ltd. * All rights reserved * * This program is the proprietary and confidential information * of BusinessTechnology, Ltd. and may be used and disclosed only * as authorized in a license agreement authorizing and * controlling such use and disclosure * * Millennium ERP system. * */ import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static String cdataValue(Element element) { if (element == null) return null; // get the first element with the given name Node node = element.getFirstChild(); if (node != null) { do { if (node.getNodeType() == Node.CDATA_SECTION_NODE) { return node.getNodeValue(); } } while ((node = node.getNextSibling()) != null); } return null; } }