You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Quynh-Anh Nguyen <qu...@rrc.state.tx.us> on 2006/01/12 22:07:17 UTC
RE: XmlError.getLine() always returns -1 even
withXmlOptions.setLoadLineNumbers() set
Thank you.
I've got this working now, my main mistake was this line:
ps81Doc = PS81Document.Factory.parse(inputXMLStream);
This should have been:
ps81Doc = PS81Document.Factory.parse(inputXMLStream,
validationOptions);
By using the validationOptions only during the validation phase won't
get me the line number,
it has to be there during the parse phase as well.
-ann
>>> radup@bea.com 1/12/2006 3:02:26 PM >>>
One thing I can suggest is double-check that you are indeed using the
V2
version, using:
"scomp -version"
V2.0 supports line numbers by default, while V2.1 also has column
numbers on by default
Radu
-----Original Message-----
From: Quynh-Anh Nguyen [mailto:quynh-anh.nguyen@rrc.state.tx.us]
Sent: Friday, January 06, 2006 5:18 AM
To: user@xmlbeans.apache.org
Subject: XmlError.getLine() always returns -1 even
withXmlOptions.setLoadLineNumbers() set
Hello,
I can't seem to get the line number that is associated with the
XmlError
that I do get when I validate. Does anybody knows what is wrong, or is
this feature not supported. I have also searched the Internet and
hunt
up on this subject, but I just can't get it to work. I also follow
the
thread regarding the Piccolo subject for line number as well, but I am
using 2.1.0, which should have this feature.
Any help is greatly appreciated.
I am using XmlBeans 2.1.0 with WebLogic 8.1, jdk142_03.
ArrayList validationErrors = new ArrayList();
XmlOptions validationOptions = new XmlOptions();
validationOptions.setLoadLineNumbers(XmlOptions.LOAD_LINE_NUMBERS_END_EL
EMENT);
validationOptions.setErrorListener(validationErrors);
PS81Document ps81Doc;
try {
ps81Doc = PS81Document.Factory.parse(inputXMLStream);
PS81Document.PS81 test = ps81Doc.getPS81();
IdentifyingRecord81 header = test.getHeader();
boolean isValid = header.validate(validationOptions);
if (!isValid) {
Iterator iter = validationErrors.iterator();
while (iter.hasNext()) {
XmlError xmlError = (XmlError) iter.next();
int line = xmlError.getLine();
.
.
.
}
.
.
.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org