Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
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/DTDNmTokensAttr.java
package com.ctc.wstx.dtd; import javax.xml.stream.XMLStreamException; import com.ctc.wstx.io.WstxInputData; import com.ctc.wstx.sr.InputProblemReporter; import com.ctc.wstx.util.PrefixedName; /** * Specific attribute class for attributes that contain (unique) * identifiers. */ public final class DTDNmTokensAttr extends DTDAttribute { /* /////////////////////////////////////////////////// // Life-cycle /////////////////////////////////////////////////// */ /** * Main constructor. */ public DTDNmTokensAttr(PrefixedName name, DefaultAttrValue defValue, int specIndex, boolean nsAware, boolean xml11) { super(name, defValue, specIndex, nsAware, xml11); } @Override public DTDAttribute cloneWith(int specIndex) { return new DTDNmTokensAttr(mName, mDefValue, specIndex, mCfgNsAware, mCfgXml11); } /* /////////////////////////////////////////////////// // Public API /////////////////////////////////////////////////// */ @Override public int getValueType() { return TYPE_NMTOKENS; } /* /////////////////////////////////////////////////// // Public API, validation /////////////////////////////////////////////////// */ /** * Method called by the validator * to let the attribute do necessary normalization and/or validation * for the value. */ @Override public String validate(DTDValidatorBase v, char[] cbuf, int start, int end, boolean normalize) throws XMLStreamException { //int origStart = start; /* First things first; let's ensure value is not empty (all * white space)... */ while (start < end && WstxInputData.isSpaceChar(cbuf[start])) { ++start; } // Empty value? if (start >= end) { return reportValidationProblem(v, "Empty NMTOKENS value"); } /* Then, let's have separate handling for normalizing and * non-normalizing case, since latter is trivially easy case: */ if (!normalize) { for (; start < end; ++start) { char c = cbuf[start]; if (!WstxInputData.isSpaceChar(c) && !WstxInputData.isNameChar(c, mCfgNsAware, mCfgXml11)) { return reportInvalidChar(v, c, "not valid as NMTOKENS character"); } } return null; // ok, all good } //boolean trimmed = (origStart != start); //origStart = start; --end; // so that it now points to the last char // Wouldn't absolutely have to trim trailing... but is easy to do while (end > start && WstxInputData.isSpaceChar(cbuf[end])) { --end; //trimmed = true; } // Ok, now, need to check we only have valid chars, and maybe // also coalesce multiple spaces, if any. StringBuilder sb = null; while (start <= end) { int i = start; for (; i <= end; ++i) { char c = cbuf[i]; if (WstxInputData.isSpaceChar(c)) { break; } if (!WstxInputData.isNameChar(c, mCfgNsAware, mCfgXml11)) { return reportInvalidChar(v, c, "not valid as an NMTOKENS character"); } } if (sb == null) { sb = new StringBuilder(end - start + 1); } else { sb.append(' '); } sb.append(cbuf, start, (i - start)); start = i + 1; // Ok, any white space to skip? while (start <= end && WstxInputData.isSpaceChar(cbuf[start])) { ++start; } } /* 27-Nov-2005, TSa: Could actually optimize trimming, and often * avoid using StringBuilder... but let's only do it if it turns * out dealing with NMTOKENS normalization shows up on profiling... */ return (sb == null) ? null : sb.toString(); } /** * 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) throws XMLStreamException { String defValue = mDefValue.getValue(); int len = defValue.length(); // Then code similar to actual value validation: StringBuilder sb = null; int count = 0; int start = 0; main_loop: while (start < len) { char c = defValue.charAt(start); // Ok, any white space to skip? while (true) { if (!WstxInputData.isSpaceChar(c)) { break; } if (++start >= len) { break main_loop; } c = defValue.charAt(start); } int i = start+1; do { if (++i >= len) { break; } c = defValue.charAt(i); } while (!WstxInputData.isSpaceChar(c)); ++count; String token = defValue.substring(start, i); int illegalIx = WstxInputData.findIllegalNmtokenChar(token, mCfgNsAware, mCfgXml11); if (illegalIx >= 0) { reportValidationProblem(rep, "Invalid default value '"+defValue +"'; character #"+illegalIx+" (" +WstxInputData.getCharDesc(defValue.charAt(illegalIx)) +") not a valid NMTOKENS character"); } if (normalize) { if (sb == null) { sb = new StringBuilder(i - start + 32); } else { sb.append(' '); } sb.append(token); } start = i+1; } if (count == 0) { reportValidationProblem(rep, "Invalid default value '"+defValue +"'; empty String is not a valid NMTOKENS value"); return; } if (sb != null) { mDefValue.setValue(sb.toString()); } } }
⏎ com/ctc/wstx/dtd/DTDNmTokensAttr.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, 26915👍, 0💬
Popular Posts:
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...
JDK 17 jdk.localedata.jmod is the JMOD file for JDK 17 Localedata module. JDK 17 Locale Data module ...
JDK 17 java.management.jmod is the JMOD file for JDK 17 Management module. JDK 17 Management module ...