org.xdef.impl.parsers.XSParseToken Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xdef Show documentation
Show all versions of xdef Show documentation
X-definition 4.2 (Open Source Software)
package org.xdef.impl.parsers;
import org.xdef.msg.XDEF;
import org.xdef.XDParseResult;
import org.xdef.proc.XXNode;
/** Parser of Schema "token" type.
* @author Vaclav Trojan
*/
public class XSParseToken extends XSAbstractParseToken {
private static final String ROOTBASENAME = "token";
public XSParseToken() {super();}
@Override
public void parseObject(final XXNode xnode, final XDParseResult p){
int pos0 = p.getIndex();
if (_whiteSpace == WS_COLLAPSE) {
p.isSpaces();
}
String s = p.nextToken();
if (s == null) {
//Incorrect value of '&{0}'&{1}{: }
p.error(XDEF.XDEF809, parserName(), s);
return;
}
String token;
p.isSpaces();
while ((token = p.nextToken()) != null) {
s += ' ' + token;
p.isSpaces();
}
if (_whiteSpace == WS_COLLAPSE) {
p.isSpaces();
}
p.replaceParsedBufferFrom(pos0, s);
p.setParsedValue(s);
checkItem(p);
}
@Override
public String parserName() {return ROOTBASENAME;}
}