Avatar of metalteck
 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
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.
XMLWeb Languages and Standards

Avatar of undefined
Last Comment
Gertone (Geert Bormans)

8/22/2022 - Mon
Gertone (Geert Bormans)

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.

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

Hi Guys,
Here is the schema I have.

Can you also post your XML or a sample showing the error?
Gertone (Geert Bormans)

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)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Gertone (Geert Bormans)

I found the first schema in this github repo
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?
Gertone (Geert Bormans)

the location is in the import statement
means IRS-CAC.xsd needs to go from the schema, one level up in a folder that you name "COMMON"
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 started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

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?
Gertone (Geert Bormans)

Now validate again using the Upstream xsd and see what happens

I'm getting the same error.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Gertone (Geert Bormans)

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

Gertone (Geert Bormans)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Gertone (Geert Bormans)

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])'.
Gertone (Geert Bormans)

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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.