Topic: Validating OFX XML using the schema?

Has anyone ever validated an OFX 2.1.1 XML file that conforms to the PDF specification using the schema?  It doesn't seem possible to me.

The schema, as written, uses a localized (hidden) namespace for most elements, such as SIGNONMSGSRSV1.  However, the OFX element is globally declared, so it can't be localized.  Therefore the only way I can find to get an OFX file to validate is to add a namespace directive and use it only on the OFX tags:

<ofx:OFX xmlns:ofx="http://ofx.net/types/2003/04">
  <SIGNONMSGSRSV1>
    ...
  </SIGNONMSGSRSV1>
</ofx:OFX>

This clearly contradicts the OFX 2.1.1 PDF specification.  However, I've tried two different validators (xmllint from libxml2 and the online validator at http://www.w3.org/2001/03/webdata/xsv ) and both give errors when bare <OFX> tags are used.  For example, when validating the example statement on page 317 of the specification, xmllint gives:

$ xmllint --noout --schema OFX2_Protocol.xsd /tmp/statement_example.xml
/tmp/statement_example.xml:1: element OFX: Schemas validity error : Element 'OFX': No matching global declaration available for the validation root.
/tmp/statement_example.xml fails to validate

Is the schema wrong, is the specification wrong, or am I missing something?  Any insights would be appreciated.

Thanks,
Jody

Re: Validating OFX XML using the schema?

Here is a sample header for an OFX 2.0 file:

<?OFX OFXHEADER="200" VERSION="200" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>
<OFX><SIGNONMSGSRSV1>...</OFX>

This is real output from an actual brokerage.

I have never tried validating this file against the schema but any XML parser should be able to handle it.  I have ran it through the python xml parser and it did fine.

Jesse

Re: Validating OFX XML using the schema?

So this particular brokerage has decided to follow the PDF specification, and disregard the schema.  I'm not sure this is the correct thing to do (hence my question.)  Why is there a schema if it can't be used to validate an OFX document?

By the way, you can validate (or in the case of that document, attempt to validate) an XML document against a schema in Python using the LXML toolkit.

Re: Validating OFX XML using the schema?

Try the xml validator here, its a free online tool; http://www.liquid-technologies.com/Free … dator.aspx

Re: Validating OFX XML using the schema?

geeta897 wrote:

Try the xml validator here, its a free online tool; http://www.liquid-technologies.com/Free … dator.aspx

The sample banking response on page 317 fails validation using that site:

Error: Could not find schema information for the element 'DTASOF'.

To use the site, I had to put the schema online - it's temporarily available from http://modernduck.com/xmltmp/ofx_schema … otocol.xsd if you want to try and reproduce this result.  Generally, though, this site doesn't seem to give as good error messages as the w3c online validator at http://www.w3.org/2001/03/webdata/xsv so I suggest using that one instead.

It still looks to me like either the OFX PDF specification or the XML schema is broken (version 2.1.1.)

Re: Validating OFX XML using the schema?

Has anyone been able to figure this out?

I'm also running into the same problem as scjody and I do find it odd that the xsd's vary from the pdf.  Maybe there is something I'm missing on how I should be using xmllint to verify my xml?