You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by evilT <ev...@gmx.de> on 2000/09/16 17:32:08 UTC
(Schema) validation questions!
Hi all,
i just got a few question on validation, hoping that anyone is willing to help me...
1) if i parse a document and some validation error occur then by mean of SAXParseException i have acces to colum/line number in the xml file, where the error occured and i even get the element value (e.g. datatype error: 'bblabla' is not a decimal..) but not the element itself, (e.g. <ERRORELEMENT>)... i tried to go throug the source code but that's a bit complicated... is there an easy way to reach that? (whitout opening the file again)
2) Regarding to question 1, is it normal that if type of an element is 'string' no error occurs no matter whether value if this element is empty or just a decimal? Because if i say type='positiveInteger' an error occurs if the value is empty or not a decimal, like i would expect it...
3) and here my last question: i wrote some lines of code to imitate a RevalidatingDOMParser and there i serialize the Document in a PipedWriter and reparse it with PipedReader(PipedWriter) like follows...
blah validate(Document doc)
{
pipeIn = new PipedReader();
pipeOut = new PipedWriter(pipeIn);
OutputFormat oformat = new OutputFormat(Method.XML, null, true);
XMLSerializer serializer = new XMLSerializer(writer, oformat);
serializer.serialize(doc);
try
{
parser.reset();
parser.parse(new InputSource(reader));
}
catch(some errors...
...
}
but the serialize method seems to hang if i try that like it would ran in an endless loop... what have i done wrong, or is there another way to reach this functionality??
I were really lucky if someone could help me!
thanks in advance
tob