Here you can find the source of isValidTagException(HashSet tagExceptions, String buffer)
private static boolean isValidTagException(HashSet tagExceptions, String buffer)
//package com.java2s; /******************************************************************************* * Copyright (c) 2006, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * /* w w w . ja v a 2 s . co m*/ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ import java.util.*; public class Main { private static boolean isValidTagException(HashSet tagExceptions, String buffer) { // Sample buffer format: // NO '<' // tagName att1="value" att2="value" // NO '>' // Parse tag name and ignore attributes (if any specified) String tagName = getTagName(buffer); // Check to see if the tag name is a tag exception if (tagExceptions.contains(tagName)) { return true; } return false; } private static String getTagName(String buffer) { // Sample buffer format: // NO '<' // tagName att1="value" att2="value" // NO '>' StringBuffer tagName = new StringBuffer(); // The tag name is every non-whitespace character in the buffer until // a whitespace character is encountered for (int i = 0; i < buffer.length(); i++) { char character = buffer.charAt(i); if (Character.isWhitespace(character)) { break; } tagName.append(character); } return tagName.toString(); } }