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/TokenContentSpec.java
package com.ctc.wstx.dtd;
import com.ctc.wstx.cfg.ErrorConsts;
import com.ctc.wstx.util.PrefixedName;
/**
* Content specification that defines content model consisting of just
* one allowed element. In addition to the allowed element, spec can have
* optional arity ("*", "+", "?") marker.
*/
public class TokenContentSpec
extends ContentSpec
{
final static TokenContentSpec sDummy = new TokenContentSpec
(' ', new PrefixedName("*", "*"));
final PrefixedName mElemName;
/*
///////////////////////////////////////////////////
// Life-cycle
///////////////////////////////////////////////////
*/
public TokenContentSpec(char arity, PrefixedName elemName)
{
super(arity);
mElemName = elemName;
}
public static TokenContentSpec construct(char arity, PrefixedName elemName)
{
return new TokenContentSpec(arity, elemName);
}
public static TokenContentSpec getDummySpec() {
return sDummy;
}
/*
///////////////////////////////////////////////////
// Public API
///////////////////////////////////////////////////
*/
@Override
public boolean isLeaf() {
return mArity == ' ';
}
public PrefixedName getName() {
return mElemName;
}
@Override
public StructValidator getSimpleValidator() {
return new Validator(mArity, mElemName);
}
@Override
public ModelNode rewrite() {
TokenModel model = new TokenModel(mElemName);
if (mArity == '*') {
return new StarModel(model);
}
if (mArity == '?') {
return new OptionalModel(model);
}
if (mArity == '+') {
return new ConcatModel(model,
new StarModel(new TokenModel(mElemName)));
}
return model;
}
@Override
public String toString() {
return (mArity == ' ') ? mElemName.toString()
: (mElemName.toString() + mArity);
}
/*
///////////////////////////////////////////////////
// Validator class:
///////////////////////////////////////////////////
*/
final static class Validator
extends StructValidator
{
final char mArity;
final PrefixedName mElemName;
int mCount = 0;
public Validator(char arity, PrefixedName elemName)
{
mArity = arity;
mElemName = elemName;
}
/**
* Rules for reuse are simple: if we can have any number of
* repetitions, we can just use a shared root instance. Although
* its count variable will get updated this doesn't really
* matter as it won't be used. Otherwise a new instance has to
* be created always, to keep track of instance counts.
*/
@Override
public StructValidator newInstance() {
return (mArity == '*') ? this : new Validator(mArity, mElemName);
}
@Override
public String tryToValidate(PrefixedName elemName)
{
if (!elemName.equals(mElemName)) {
return "Expected element <"+mElemName+">";
}
if (++mCount > 1 && (mArity == '?' || mArity == ' ')) {
return "More than one instance of element <"+mElemName+">";
}
return null;
}
@Override
public String fullyValid()
{
switch (mArity) {
case '*':
case '?':
return null;
case '+': // need at least one (and multiples checked earlier)
case ' ':
if (mCount > 0) {
return null;
}
return "Expected "+(mArity == '+' ? "at least one" : "")
+" element <"+mElemName+">";
}
// should never happen:
throw new IllegalStateException(ErrorConsts.ERR_INTERNAL);
}
}
}
⏎ com/ctc/wstx/dtd/TokenContentSpec.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, ≈62🔥, 0💬
Popular Posts:
Java Architecture for XML Binding (JAXB) is a Java API that allows Java developers to map Java class...
What Is poi-ooxml-5.2.3.jar? poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which...
HttpComponents Core Source Code Files are provided in the source package file, httpcomponents-core-5...
Java Servlet API 4.0.1 Source Code Files are important if you want to compile them with different JD...
maven-settings-builder-3 .8.6.jaris the JAR file for Apache Maven 3.8.6 Settings Builder module. Apa...