001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.xslt.model.impl;
020:
021: import java.util.HashSet;
022: import java.util.Set;
023: import java.util.concurrent.atomic.AtomicReference;
024:
025: import javax.xml.namespace.QName;
026:
027: import org.netbeans.modules.xslt.model.XslComponent;
028:
029: /**
030: * Enumeration representing XSL specific elements.
031: * Please note that almost any XML element could
032: * appear in XSL document and we should provide
033: * access to this element. This enumeration
034: * contains only XSL specific elements ( lile xsl instructions ).
035: *
036: * @author ads
037: *
038: */
039: enum XslElements {
040:
041: ANALIZE_STRING("analyze-string"), // NOI18N
042: APPLY_IMPORTS("apply-imports"), // NOI18N
043: APPLY_TEMPLATES("apply-templates"), // NOI18N
044: ATTRIBUTE("attribute"), // NOI18N
045: ATTRIBUTE_SET("attribute-set"), // NOI18N
046: CALL_TEMPLATE("call-template"), // NOI18N
047: CHARACTER_MAP("character-map"), // NOI18N
048: CHOOSE("choose"), // NOI18N
049: COMMENT("comment"), // NOI18N
050: COPY("copy"), // NOI18N
051: COPY_OF("copy-of"), // NOI18N
052: DECIMAL_FORMAT("decimal-format"), // NOI18N
053: DOCUMENT("document"), // NOI18N
054: ELEMENT("element"), // NOI18N
055: FALLBACK("fallback"), // NOI18N
056: FOR_EACH("for-each"), // NOI18N
057: FOR_EACH_GROUP("for-each-group"), // NOI18N
058: FUNCTION("function"), // NOI18N
059: IF("if"), // NOI18N
060: IMPORT("imoprt"), // NOI18N
061: IMPORT_SCHEMA("import-schema"), // NOI18N
062: INCLUDE("include"), // NOI18N
063: KEY("key"), // NOI18N
064: MATCHING_SUBSTRING("matching-substring"), // NOI18N
065: MESSAGE("message"), // NOI18N
066: NAMESPACE("namespace"), // NOI18N
067: NAMESPACE_ALIAS("namespace-alias"), // NOI18N
068: NEXT_MATCH("next-match"), // NOI18N
069: NON_MATCHING_SUBSTRING("non-matching-substring"), // NOI18N
070: NUMBER("number"), // NOI18N
071: OTHERWISE("otherwise"), // NOI18N
072: OUTPUT("output"), // NOI18N
073: OUTPUT_CHARACTER("output-character"), // NOI18N
074: PARAM("param"), // NOI18N
075: PERFORM_SORT("perform-sort"), // NOI18N
076: PRESERVE_SPACE("preserve-space"), // NOI18N
077: PROCESSING_INSTRUCTION("processing-instruction"), // NOI18N
078: RESULT_DOCUMENT("result-document"), // NOI18N
079: SEQUENCE("sequence"), // NOI18N
080: SORT("sort"), // NOI18N
081: STRIP_SPACE("strip-space"), // NOI18N
082: STYLESHEET("stylesheet"), // NOI18N
083: TRANSFORM("transform"), // NOI18N this is the same tag as previous "stylesheet".
084: TEMPLATE("template"), // NOI18N
085: TEXT("text"), // NOI18N
086: VALUE_OF("value-of"), // NOI18N
087: VARIABLE("variable"), // NOI18N
088: WHEN("when"), // NOI18N
089: WHITH_PARAM("with-param") // NOI18N
090: ;
091:
092: XslElements(String str) {
093: myName = str;
094: }
095:
096: public String getName() {
097: return myName;
098: }
099:
100: public QName getQName() {
101: return new QName(XslComponent.XSL_NAMESPACE, getName());
102: }
103:
104: public static Set<QName> allQNames() {
105: if (myQNames.get() == null) {
106: Set<QName> set = new HashSet<QName>(values().length);
107: for (XslElements element : values()) {
108: set.add(element.getQName());
109: }
110: myQNames.compareAndSet(null, set);
111: }
112: return myQNames.get();
113: }
114:
115: private String myName;
116:
117: private static AtomicReference<Set<QName>> myQNames = new AtomicReference<Set<QName>>();
118: }
|