Java tutorial
//package com.java2s; /* * $Id: XMLUtilities.java,v 1.28 2005/09/05 13:58:15 gmcgoldrick Exp $ * * Copyright (C) 2002, Cladonia Ltd. All rights reserved. * * This software is the proprietary information of Cladonia Ltd. * Use is subject to license terms. */ public class Main { /** * Removes the XML Declaration * * @param text The XML whose declaration is to be removed * * @return String the text of the XML with declaration removed */ public static String removeXMLDeclaration(String text) { int start = text.indexOf("<?xml"); if (start == -1) { return text; } int end = text.indexOf("?>"); return text.substring(end + 2); } }