org.xdef.impl.parsers.XSParseNCName 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.sys.StringParser;
import org.xdef.XDParseResult;
import org.xdef.proc.XXNode;
/** Parser of Schema "NCName" type.
* @author Vaclav Trojan
*/
public class XSParseNCName extends XSAbstractParseToken {
private static final String ROOTBASENAME = "NCName";
public XSParseNCName() {super();}
@Override
public void parseObject(final XXNode xnode, final XDParseResult p){
int pos0 = p.getIndex();
p.isSpaces();
int pos = p.getIndex();
StringParser parser = new StringParser(p.getSourceBuffer(), pos);
if (!parser.isNCName((byte) StringParser.XMLVER1_0)) {
//Incorrect value of '&{0}'&{1}{: }
p.errorWithString(XDEF.XDEF809, parserName());
return;
}
String s = parser.getParsedString();
p.setIndex(parser.getIndex());
p.isSpaces();
p.replaceParsedBufferFrom(pos0, s);
p.setParsedValue(s);
checkItem(p);
}
@Override
public String parserName() {return ROOTBASENAME;}
}