List Info

Thread: Line number always 0 on schema error




Line number always 0 on schema error
user name
2006-12-15 14:57:24
Hello World, heelo Daniel,

I'm validating an XML file against a schema (Delphi):

schParCtxt := xmlSchemaNewMemParserCtxt(schemBuf,
schemBufLen);
sch        := xmlSchemaParse(schParCtxt);
schValCtxt := xmlSchemaNewValidCtxt(sch);
schemaRet  := xmlSchemaValidateDoc(schValCtxt, xmlFile);

If schemaRet is != 0 I'll get the error using
xmlGetLastError:

if (schemaRet <> 0) then begin
  schemError := xmlGetLastError();
  ...
  ...
end;

No matter for what reason nor where an error happens during
the
validation, the schemError^.line value is always 0.

I'm using libxml2 2.6.26 with the Delphi bindings...

What am I doing wrong? What do I need to do to get a correct
value?

Best regards
	Andreas
-- 
Andreas Tscharner                      andreas.tscharnermetromec.ch
------------------------------------------------------------
--------
"You take the blue pill and the story ends. You wake in
your bed and
 believe whatever you want to believe. You take the red pill
and you
 stay in Wonderland and I show you how deep the rabbit-hole
goes."
                                               -- Morpheus
in Matrix
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
Line number always 0 on schema error
user name
2006-12-15 15:04:57
On Fri, Dec 15, 2006 at 03:57:24PM +0100, Andreas Tscharner
wrote:
> Hello World, heelo Daniel,
> 
> I'm validating an XML file against a schema (Delphi):
> 
> schParCtxt := xmlSchemaNewMemParserCtxt(schemBuf,
schemBufLen);
> sch        := xmlSchemaParse(schParCtxt);
> schValCtxt := xmlSchemaNewValidCtxt(sch);
> schemaRet  := xmlSchemaValidateDoc(schValCtxt,
xmlFile);
> 
> If schemaRet is != 0 I'll get the error using
xmlGetLastError:
> 
> if (schemaRet <> 0) then begin
>   schemError := xmlGetLastError();
>   ...
>   ...
> end;
> 
> No matter for what reason nor where an error happens
during the
> validation, the schemError^.line value is always 0.
> 
> I'm using libxml2 2.6.26 with the Delphi bindings...

  Please try first with the latest version, so we don't
chase a 
non-existent bug.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
Line number always 0 on schema error
user name
2006-12-15 16:05:16
> On Fri, Dec 15, 2006 at 03:57:24PM +0100, Andreas
Tscharner wrote:
> > Hello World, heelo Daniel,
> > 
> > I'm validating an XML file against a schema
(Delphi):
> > 
> > schParCtxt := xmlSchemaNewMemParserCtxt(schemBuf,
schemBufLen);
> > sch        := xmlSchemaParse(schParCtxt);
> > schValCtxt := xmlSchemaNewValidCtxt(sch);
> > schemaRet  := xmlSchemaValidateDoc(schValCtxt,
xmlFile);
> > 
> > If schemaRet is != 0 I'll get the error using
xmlGetLastError:
> > 
> > if (schemaRet <> 0) then begin
> >   schemError := xmlGetLastError();
> >   ...
> >   ...
> > end;
> > 
> > No matter for what reason nor where an error
happens during the
> > validation, the schemError^.line value is always
0.
> > 
> > I'm using libxml2 2.6.26 with the Delphi
bindings...
> 
>   Please try first with the latest version, so we don't
chase a 
> non-existent bug.
> 

Confirmed for the latest version 2.6.27...

The schemaRet error code is 1868, the domain code is 17,
error level is
XML_ERR_ERROR and the given text is correct: I removed a
required
attribute from a node("The attribute 'z' is required
but missing")...
The program and the schema are both in memory.

Best regards
	Andreas
-- 
Andreas Tscharner                         
andreas.tscharnermetromec.ch
------------------------------------------------------------
------------
And the beast shall come forth surrounded by a roiling cloud
of
vengeance. The house of the unbelievers shall be razed and
they shall be
scorched to the earth. Their tags shall blink until the end
of days.
                                            -- The Book of
Mozilla 12:10


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )