use of com.sun.msv.util.StringRef in project OpenAM by OpenRock.
the class MSVValidator method startElement.
public void startElement(String uri, String local) throws SAXException {
writePendingText();
context.getNamespaceContext().startElement();
stack.push(acceptor);
StartTagInfo sti = new StartTagInfo(uri, local, local, emptyAttributes, this);
// we pass in an empty attributes, as there is just no way for us to
// properly re-construct attributes. Fortunately, I know MSV is not using
// attribute values, so this would work, but nevertheless this code is
// ugly. This is one of the problems of the "middle" approach.
Acceptor child = acceptor.createChildAcceptor(sti, null);
if (child == null) {
// this element is invalid. probably, so this object is invalid
// report an error
StringRef ref = new StringRef();
child = acceptor.createChildAcceptor(sti, ref);
context.reportEvent(target, ref.str);
}
this.currentElementUri = uri;
this.currentElementLocalName = local;
acceptor = child;
}
use of com.sun.msv.util.StringRef in project OpenAM by OpenRock.
the class MSVValidator method writePendingText.
private void writePendingText() throws SAXException {
// assert(textBuf!=null);
if (!acceptor.onText2(buf.toString(), this, null, null)) {
// this text is invalid.
// report an error
StringRef ref = new StringRef();
acceptor.onText2(buf.toString(), this, ref, null);
context.reportEvent(target, ref.str);
}
if (buf.length() > 1024)
buf = new StringBuffer();
else
buf.setLength(0);
}
use of com.sun.msv.util.StringRef in project OpenAM by OpenRock.
the class MSVValidator method startElement.
public void startElement(String uri, String local) throws SAXException {
writePendingText();
context.getNamespaceContext().startElement();
stack.push(acceptor);
StartTagInfo sti = new StartTagInfo(uri, local, local, emptyAttributes, this);
// we pass in an empty attributes, as there is just no way for us to
// properly re-construct attributes. Fortunately, I know MSV is not using
// attribute values, so this would work, but nevertheless this code is
// ugly. This is one of the problems of the "middle" approach.
Acceptor child = acceptor.createChildAcceptor(sti, null);
if (child == null) {
// this element is invalid. probably, so this object is invalid
// report an error
StringRef ref = new StringRef();
child = acceptor.createChildAcceptor(sti, ref);
context.reportEvent(target, ref.str);
}
this.currentElementUri = uri;
this.currentElementLocalName = local;
acceptor = child;
}
use of com.sun.msv.util.StringRef in project OpenAM by OpenRock.
the class MSVValidator method writePendingText.
private void writePendingText() throws SAXException {
// assert(textBuf!=null);
if (!acceptor.onText2(buf.toString(), this, null, null)) {
// this text is invalid.
// report an error
StringRef ref = new StringRef();
acceptor.onText2(buf.toString(), this, ref, null);
context.reportEvent(target, ref.str);
}
if (buf.length() > 1024)
buf = new StringBuffer();
else
buf.setLength(0);
}
use of com.sun.msv.util.StringRef in project OpenAM by OpenRock.
the class MSVValidator method _validate.
/** performs the validation to the object specified in the constructor. */
private void _validate() throws SAXException {
context.getNamespaceContext().startElement();
// validate attributes
target.serializeURIs(this);
endNamespaceDecls();
target.serializeAttributes(this);
endAttributes();
// validate content model
target.serializeBody(this);
writePendingText();
context.getNamespaceContext().endElement();
if (!acceptor.isAcceptState(null)) {
// some elements are missing
// report error
StringRef ref = new StringRef();
acceptor.isAcceptState(ref);
context.reportEvent(target, ref.str);
}
}
Aggregations