cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error on XML Parser when referencing external DTD

Former Member
0 Likes
1,380

Hi,

I was trying to replicate some examples I found on the "XML Services" guide. In particular, I'm having troubles to make the parser download an external DTD definition. According to the manual "There are no restrictions on the use of URIs as href attributes or document text, and XML Services resolves external reference URIs that specify http URIs."

But when I execute this query:

insert into text_docs values (xmlvalidate('<!DOCTYPE emp_name PUBLIC "prueba" "http://xx.xx.xx.xx/dtd_emp.dtd"><emp_name>John Doe</emp_name>',option 'dtdvalidate=yes'))

I get this exception:

XMLVALIDATE(): XML parser fatal error <<An exception occurred!

Type:NetAccessorException, Message:Could not create the socket for URL '{0}'.

Error={1}>> at line 1, offset 71.

Using google I found people who got the same error, but I haven't found any solution.

Any help would be appreciated

Thanks

Leandro

View Entire Topic
Former Member
0 Likes

Hi! Now I tried on a different server which is running ASE 16.0 Sp02 (lastest), and I get a different error:


XMLVALIDATE(): XML parser fatal error <<An exception occurred!

Type:MalformedURLException, Message:Unsupported URL protocol:

'http://xx.xx.xx.xx/>> at line 1, offset 4.

SQLCODE=14702

Server=SYBASE, Severity Level=16, State=0, Transaction State=1, Line=1

Line 1

Former Member
0 Likes

hmmm..  I can get the following to work:

insert into text_docs values (xmlvalidate('<!DOCTYPE emp_name PUBLIC "http://xx.xx.xx.xx/dtd_emp.dtd"><emp_name>John Doe</emp_name>'

,option 'dtdvalidate=yes xmlerror=null'))

can further use any option for xmlerror=[null|message|exception]

Former Member
0 Likes

Kevin,

So all you did was take out the word "prueba" e.g. "test" in Spanish? See below.

Thank you.

Jean-Pierre

insert into text_docs values (xmlvalidate('<!DOCTYPE emp_name PUBLIC "prueba" "http://xx.xx.xx.xx/dtd_emp.dtd"><emp_name>John Doe</emp_name>',option 'dtdvalidate=yes'))

insert into text_docs values (xmlvalidate('<!DOCTYPE emp_name PUBLIC "http://xx.xx.xx.xx/dtd_emp.dtd"><emp_name>John Doe</emp_name>'

,option 'dtdvalidate=yes xmlerror=null'))

Former Member
0 Likes

Thanks Jean-Pierre & Kevin!

Adding xmlerror=null as an option doesn't solve the issue, it's just a workaround to make xmlvalidate return null in case of an error.

Jean-Pierre, "prueba" is needed because if you don't add a name to the DOCTYPE declaration, xmlvalidate raises an exception: "Expected quoted string"

Former Member
0 Likes

Leandro,

Thank you for pointing that out. I have not used the XML features of ASE and I was just following the discussion with interest.

Regards,

Jean-Pierre