Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Woodstox 6.4.0 - Source Code Files
Woodstox 6.4.0 Source Code Files are provided at the Woodstox GitHub Website.
You can download them from the "src/main/java" folder.
You can also browse Woodstox Source Code files below:
✍: FYIcenter
⏎ com/ctc/wstx/util/PrefixedName.java
/* Woodstox XML processor
*
* Copyright (c) 2004 Tatu Saloranta, tatu.saloranta@iki.fi
*
* Licensed under the License specified in file LICENSE, included with
* the source code.
* You may not use this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ctc.wstx.util;
import javax.xml.namespace.QName;
/**
* Simple key Object to be used for storing/accessing of potentially namespace
* scoped element and attribute names.
*<p>
* One important note about usage is that two of the name components (prefix
* and local name) HAVE to have been interned some way, as all comparisons
* are done using identity comparison; whereas URI is NOT necessarily
* interned.
*<p>
* Note that the main reason this class is mutable -- unlike most key classes
* -- is that this allows reusing key objects for access, as long as the code
* using it knows ramifications of trying to modify a key that's used
* in a data structure.
*<p>
* Note, too, that the hash code is cached as this class is mostly used as
* a Map key, and hash code is used a lot.
*/
public final class PrefixedName
implements Comparable<PrefixedName> // to allow alphabetic ordering
{
private String mPrefix, mLocalName;
volatile int mHash = 0;
/*
///////////////////////////////////////////////////
// Life-cycle
///////////////////////////////////////////////////
*/
public PrefixedName(String prefix, String localName)
{
mLocalName = localName;
mPrefix = (prefix != null && prefix.length() == 0) ?
null : prefix;
}
public PrefixedName reset(String prefix, String localName)
{
mLocalName = localName;
mPrefix = (prefix != null && prefix.length() == 0) ?
null : prefix;
mHash = 0;
return this;
}
public static PrefixedName valueOf(QName n)
{
return new PrefixedName(n.getPrefix(), n.getLocalPart());
}
/*
///////////////////////////////////////////////////
// Accessors:
///////////////////////////////////////////////////
*/
public String getPrefix() { return mPrefix; }
public String getLocalName() { return mLocalName; }
/**
* @return True, if this attribute name would result in a namespace
* binding (ie. it's "xmlns" or starts with "xmlns:").
*/
public boolean isaNsDeclaration()
{
if (mPrefix == null) {
return mLocalName == "xmlns";
}
return mPrefix == "xmlns";
}
/**
* Method used to check for xml reserved attribute names, like
* "xml:space" and "xml:id".
*<p>
* Note: it is assumed that the passed-in localName is also
* interned.
*/
public boolean isXmlReservedAttr(boolean nsAware, String localName)
{
if (nsAware) {
if ("xml" == mPrefix) {
return mLocalName == localName;
}
} else {
if (mLocalName.length() == (4 + localName.length())) {
return (mLocalName.startsWith("xml:")
&& mLocalName.endsWith(localName));
}
}
return false;
}
/*
///////////////////////////////////////////////////
// Overridden standard methods:
///////////////////////////////////////////////////
*/
@Override
public String toString()
{
if (mPrefix == null || mPrefix.length() == 0) {
return mLocalName;
}
StringBuilder sb = new StringBuilder(mPrefix.length() + 1 + mLocalName.length());
sb.append(mPrefix);
sb.append(':');
sb.append(mLocalName);
return sb.toString();
}
@Override
public boolean equals(Object o)
{
if (o == this) {
return true;
}
if (!(o instanceof PrefixedName)) { // also filters out nulls
return false;
}
PrefixedName other = (PrefixedName) o;
if (mLocalName != other.mLocalName) { // assumes equality
return false;
}
return (mPrefix == other.mPrefix);
}
@Override
public int hashCode() {
int hash = mHash;
if (hash == 0) {
hash = mLocalName.hashCode();
if (mPrefix != null) {
hash ^= mPrefix.hashCode();
}
mHash = hash;
}
return hash;
}
@Override
public int compareTo(PrefixedName other)
{
// First, by prefix, then by local name:
String op = other.mPrefix;
// Missing prefix is ordered before existing prefix
if (op == null || op.length() == 0) {
if (mPrefix != null && mPrefix.length() > 0) {
return 1;
}
} else if (mPrefix == null || mPrefix.length() == 0) {
return -1;
} else {
int result = mPrefix.compareTo(op);
if (result != 0) {
return result;
}
}
return mLocalName.compareTo(other.mLocalName);
}
}
⏎ com/ctc/wstx/util/PrefixedName.java
Or download all of them as a single archive file:
File name: woodstox-core-6.4.0-fyi.zip File size: 552992 bytes Release date: 2022-10-25 Download
⇒ woodstox-core-6.4.0.jar - Woodstox Core 6.4.0
⇐ What Is Woodstox XML Processing
2023-01-29, ≈59🔥, 0💬
Popular Posts:
JDK 17 jdk.compiler.jmod is the JMOD file for JDK 17 Compiler tool, which can be invoked by the "jav...
JDK 17 jdk.jdeps.jmod is the JMOD file for JDK 17 JDeps tool, which can be invoked by the "jdeps" co...
JDK 11 jdk.jdi.jmod is the JMOD file for JDK 11 JDI (Java Debug Interface) tool. JDK 11 JDI tool com...
maven-compat-3.5.4.jar is the JAR file for Apache Maven 3.5.4 Compact module. The JAR file name may ...
JDK 17 java.rmi.jmod is the JMOD file for JDK 17 RMI (Remote Method Invocation) module. JDK 17 RMI m...