1. Jan Kopal
  2. PowerBuilder
  3. Tuesday, 4 February 2020 06:56 AM UTC

Hello,

is it possible to validate XML against XSD file i Powerbuilder?

I have XML string (of XML file) and local copy of XSD file. I found XMLParseFile and XMLParseString functions, but i don't know how to tell which XSD file to use...

Thank You,

 

Jan

Accepted Answer
Michael Kramer Accepted Answer Pending Moderation
  1. Tuesday, 4 February 2020 09:39 AM UTC
  2. PowerBuilder
  3. # Permalink

René is right!

Re: Connect XML to XSD
You should insert a "schema reference" into the XML text before validating it using XMLParseString.
Stack Overflow has thread on your exact situation incl. how to reference your local XSD.

 

HTH /Michael

Comment
There are no comments made yet.
Jan Kopal Accepted Answer Pending Moderation
  1. Tuesday, 4 February 2020 13:55 PM UTC
  2. PowerBuilder
  3. # 1

Thank You for response.

First I added a schema reference to the root element:

<Invoice xmlns="http://isdoc.cz/namespace/invoice" version="5.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://isdoc.cz/namespace/invoice file:///D:\xsd\isdoc-invoice-5.1.xsd">

 

Then I called a function:

ll_error = XMLParseString(ls_test_xml, ValAuto!, TRUE, TRUE, TRUE)

 

...and it works!

 

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 4 February 2020 07:33 AM UTC
  2. PowerBuilder
  3. # 2

Hi Jan,

I'm not sure, but one way could be that you "connect" your XML with the XSD file by changing the XML.

Or you use MSXML ActiveX. You may google how to validate XML to XSD using MSXML.

HTH,

René

 

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.