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/dtd/DTDIdAttr.java
package com.ctc.wstx.dtd;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import com.ctc.wstx.cfg.ErrorConsts;
import com.ctc.wstx.io.WstxInputData;
import com.ctc.wstx.sr.InputProblemReporter;
import com.ctc.wstx.util.ElementId;
import com.ctc.wstx.util.ElementIdMap;
import com.ctc.wstx.util.PrefixedName;
/**
* Specific attribute class for attributes that contain (unique)
* identifiers.
*/
public final class DTDIdAttr
extends DTDAttribute
{
/*
///////////////////////////////////////////////////////////////////////
// Life-cycle
///////////////////////////////////////////////////////////////////////
*/
/**
* Main constructor. Note that id attributes can never have
* default values.
*<p>
* note: although ID attributes are not to have default value,
* this is 'only' a validity constraint, and in dtd-aware-but-
* not-validating mode it is apparently 'legal' to add default
* values.
*/
public DTDIdAttr(PrefixedName name, DefaultAttrValue defValue, int specIndex,
boolean nsAware, boolean xml11)
{
super(name, defValue, specIndex, nsAware, xml11);
}
@Override
public DTDAttribute cloneWith(int specIndex) {
return new DTDIdAttr(mName, mDefValue, specIndex, mCfgNsAware, mCfgXml11);
}
/*
///////////////////////////////////////////////////////////////////////
// Public API
///////////////////////////////////////////////////////////////////////
*/
@Override
public int getValueType() {
return TYPE_ID;
}
@Override
public boolean typeIsId() {
return true;
}
/*
///////////////////////////////////////////////////////////////////////
// Public API, validation
///////////////////////////////////////////////////////////////////////
*/
/**
* Method called by the validator
* to let the attribute do necessary normalization and/or validation
* for the value.
*/
@SuppressWarnings("cast")
@Override
public String validate(DTDValidatorBase v, char[] cbuf, int start, int end, boolean normalize)
throws XMLStreamException
{
// Let's trim leading white space first...
while (start < end && WstxInputData.isSpaceChar(cbuf[start])) {
++start;
}
// No id?
if (start >= end) {
return reportValidationProblem(v, "Empty ID value");
}
--end; // so that it now points to the last char
while (end > start && WstxInputData.isSpaceChar(cbuf[end])) {
--end;
}
// Ok, need to check char validity, and also calc hash code:
char c = cbuf[start];
if (!WstxInputData.isNameStartChar(c, mCfgNsAware, mCfgXml11)) {
return reportInvalidChar(v, c, "not valid as the first ID character");
}
int hash = (int) c;
for (int i = start+1; i <= end; ++i) {
c = cbuf[i];
if (!WstxInputData.isNameChar(c, mCfgNsAware, mCfgXml11)) {
return reportInvalidChar(v, c, "not valid as an ID character");
}
hash = (hash * 31) + (int) c;
}
// Either way, we do need to validate characters, and calculate hash
ElementIdMap m = v.getIdMap();
PrefixedName elemName = v.getElemName();
Location loc = v.getLocation();
ElementId id = m.addDefined(cbuf, start, (end - start + 1), hash,
loc, elemName, mName);
// We can detect dups by checking if Location is the one we passed:
if (id.getLocation() != loc) {
return reportValidationProblem(v, "Duplicate id '"+id.getId()+"', first declared at "
+id.getLocation());
}
if (normalize) {
return id.getId();
}
return null;
}
/**
* Method called by the validator
* to ask attribute to verify that the default it has (if any) is
* valid for such type.
*/
@Override
public void validateDefault(InputProblemReporter rep, boolean normalize)
{
// Should never get called
throw new IllegalStateException(ErrorConsts.ERR_INTERNAL);
}
}
⏎ com/ctc/wstx/dtd/DTDIdAttr.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, ≈45🔥, 0💬
Popular Posts:
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
JDK 11 jdk.internal.JVM Stat.jmod is the JMOD file for JDK 11 Internal Jvmstat module. JDK 11 Intern...
JDK 17 java.base.jmod is the JMOD file for JDK 17 Base module. JDK 17 Base module compiled class fil...
Apache Ant Source Code Files are inside the Apache Ant source package file like apache-ant-1.10.10-s...