Link to home
Start Free TrialLog in
Avatar of Metalteck
MetalteckFlag for United States of America

asked on

Unable to Parse schema file

I'm trying to validate my xml file using notepad++.
I'm fairly new to XML so I'm having issues trying to resolve the following error:

Unable to parse schema file.
Parsing error at line 50:
Element'{http://www.w3.org/2001/XMLSchema}element', attribute
'ref': The QName value
'{urn:us:gov:treasure:irs:ext:aca:air:ty18}Form1094CUpstreamDetail'
does not resolve to a(n) element declaration.

This is what I have for the first couple of lines of the xml:
<?xml version="1.0" encoding="UTF-8"?>
<p:Form109495CTransmittalUpstream xmlns:p="urn:us:gov:treasury:irs:msg:form1094-1095Ctransmitterupstreammessage" xmlns:p1="urn:us:gov:treasury:irs:ext:aca:air:ty18" xmlns:p2="urn:us:gov:treasury:irs:common" xmlns:p3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:us:gov:treasury:irs:msg:form1094-1095Ctransmitterupstreammessage IRS-Form1094-1095CTransmitterUpstreamMessage.xsd ">

Any thoughts on how I can resolve this?
I've attached the Schema file.
IRS-Form1094-1095CTransmitterUpstrea.xsd
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

First, do you have the full schema?
There is a whole bunch of schema file references

Your message is not related to the XML,
it is related to a schema error..
make first sure you have all the files at the correct location

and you might find out that notepad++ is just not enough to deal with this XML complexity

anyhow, first the full schema
Schema parsing depends on the used tool chain. As Geert already wrote, the tools often require that these are local to the tool.

An I agree on using Notepad++ for XML. Altova has imho the best commercial tools for Windows. A good free tool is Visual Studio Code. It has already some native XML support as well as a lot of plugins available.
Avatar of Metalteck

ASKER

Hi Guys,
Here is the schema I have.
Can you also post your XML or a sample showing the error?
As I said before, the error is in the schema and the schema is not complete

There is two imports in the schema
	<xsd:import namespace="urn:us:gov:treasury:irs:common" schemaLocation="../COMMON/IRS-CAC.xsd"/>
	<xsd:import namespace="urn:us:gov:treasury:irs:ext:aca:air:ty18" schemaLocation="../EXT/IRS-EXT-ACA-AIR-1094BC.xsd"/>

Open in new window


The imports refer to a local file
The schema will not validate unless you have the files exactly there
AND make sure the referenced schema files don't have other imports (they will likely have)
I found the first schema in this github repo
https://github.com/sangramjadhav/irsclient/blob/master/model/src/main/resources/schema/COMMON/IRS-CAC.xsd
not sure that is an official one
If I look at the filestructure, there is a whole bunch of extra files
you can download the IRS client and that will give you all the schema files

I downloaded them, validated them and compared to your upstream message file... yours is 4 years more recent, but it could help if you can't get the official ones
Hi Guys,

Thank you for the feedback. I've got the 2 missing files that Geert said I was missing.
What location do I need to place them in order for them to be read?
the location is in the import statement
../COMMON/IRS-CAC.xsd
means IRS-CAC.xsd needs to go from the schema, one level up in a folder that you name "COMMON"
../EXT/IRS-EXT-ACA-AIR-1094BC.xsd
means IRS-EXT-ACA-AIR-1094BC.xsd needs to go from the schema one level up in a folder you name "EXT"

you will need to check for import or include statements in those two files too
I've checked and those files are in the appropriate folders.
I've attached a screenshot.
Do you know what else I need to do?
Xml-files-and-paths.docx
Now validate again using the Upstream xsd and see what happens
I'm getting the same error.
Well.... then there is something wrong in the package
Can you tell us where to get the package so I can check with oxygen xml
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Geert,
I re-downloaded the files from the IRS.
I just wanted let you know how I'm trying to test this.
There are to files my system generates: 1094C_Manifest_1_* and 1094C_Request_*
I open these 2 files in Notepad++ and open the 2 files I've attached to this thread.
I then go to Notepad++ and go to -Plugins--XML Tools --Validate.

I navigate to the directory where the IRS-Form1094-1095CTransmitterUpstreamMessage.xsd file is and get the following error message:
Validation of current file using XML schema:
ERROR: Element '{urn:us:gov:treasury:irs:msg:acauibusinessheader}ACAUIBusinessHeader': No matching global declaration available for the validation root.

Can you let me know what step I'm missing?
IRS-Form1094-1095CTransmitterUpstrea.xsd
IRS-EXT-ACA-AIR-1094BC.xsd
The notepad++ XML validator is an acceptable home and school tool for easy stuff
It is simply not powerful (and compliant) enough to deal with this complexity
The validation error is likely not caused by the data, but by the lack of conformance of the tool you are using.
I do use notepad++ XML plugin sometimes, but definitely not for xml with this complexity

Step one (as suggested before): try the sample files from the package (they are valid) and validate them against the schema
You will likely get the same error. Time to get decent tools then
Thanks for all the help guys. I finally got it to validate.
I just had one additional question and i'll open another thread for it.

I got the following message. Anything off the top of your head of how I can resolve this?
ERROR: Element '{urn:us:gov:treasury:irs:ext:aca:air:ty18}TotalEmployeeCnt': '' is not a valid value of the atomic type '{urn:us:gov:treasury:irs:ext:aca:air:ty18}TotalNumberType'.
ERROR: Element '{urn:us:gov:treasury:irs:ext:aca:air:ty18}TestScenarioId': [facet 'pattern'] The value 'T2018-1' is not accepted by the pattern '([1-9]|[1-9][0-9])C{0,1}-([0-9]|[1-9][0-9])'.
ERROR: Element '{urn:us:gov:treasury:irs:ext:aca:air:ty18}TestScenarioId': 'T2018-1' is not a valid value of the atomic type '{urn:us:gov:treasury:irs:ext:aca:air:ty18}TestScenarioIdType'.
ERROR: Element '{urn:us:gov:treasury:irs:ext:aca:air:ty18}TestScenarioId': [facet 'pattern'] The value 'T2018-2' is not accepted by the pattern '([1-9]|[1-9][0-9])C{0,1}-([0-9]|[1-9][0-9])'.
the error messages are pretty explicit
* T2018-1 should be of the form  99C-99 (as an example)
* check what is TotalNumberType in the schema and see if you adhere to that