001: /*
002: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: *
025: * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
026: */
027:
028: /*
029: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
030: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
031: *
032: * This code is free software; you can redistribute it and/or modify it
033: * under the terms of the GNU General Public License version 2 only, as
034: * published by the Free Software Foundation. Sun designates this
035: * particular file as subject to the "Classpath" exception as provided
036: * by Sun in the LICENSE file that accompanied this code.
037: *
038: * This code is distributed in the hope that it will be useful, but WITHOUT
039: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
040: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
041: * version 2 for more details (a copy is included in the LICENSE file that
042: * accompanied this code).
043: *
044: * You should have received a copy of the GNU General Public License version
045: * 2 along with this work; if not, write to the Free Software Foundation,
046: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
047: *
048: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
049: * CA 95054 USA or visit www.sun.com if you need additional information or
050: * have any questions.
051: *
052: * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
053: *
054: */
055: package com.sun.xml.internal.fastinfoset.stax.events;
056:
057: import javax.xml.stream.XMLStreamConstants;
058:
059: /** A Utility class for the StAX Events implementation.
060: */
061: public class Util {
062:
063: /**
064: * A string is empty if it's null or contains nothing
065: *
066: * @param s The string to check.
067: */
068: public static boolean isEmptyString(String s) {
069: if (s != null && !s.equals(""))
070: return false;
071: else
072: return true;
073: }
074:
075: public final static String getEventTypeString(int eventType) {
076: switch (eventType) {
077: case XMLStreamConstants.START_ELEMENT:
078: return "START_ELEMENT";
079: case XMLStreamConstants.END_ELEMENT:
080: return "END_ELEMENT";
081: case XMLStreamConstants.PROCESSING_INSTRUCTION:
082: return "PROCESSING_INSTRUCTION";
083: case XMLStreamConstants.CHARACTERS:
084: return "CHARACTERS";
085: case XMLStreamConstants.COMMENT:
086: return "COMMENT";
087: case XMLStreamConstants.START_DOCUMENT:
088: return "START_DOCUMENT";
089: case XMLStreamConstants.END_DOCUMENT:
090: return "END_DOCUMENT";
091: case XMLStreamConstants.ENTITY_REFERENCE:
092: return "ENTITY_REFERENCE";
093: case XMLStreamConstants.ATTRIBUTE:
094: return "ATTRIBUTE";
095: case XMLStreamConstants.DTD:
096: return "DTD";
097: case XMLStreamConstants.CDATA:
098: return "CDATA";
099: }
100: return "UNKNOWN_EVENT_TYPE";
101: }
102:
103: }
|