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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
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
ste5anSenior DeveloperCommented:
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.
metalteckAuthor Commented:
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

metalteckAuthor Commented:
Hi Guys,
Here is the schema I have.
ste5anSenior DeveloperCommented:
Can you also post your XML or a sample showing the error?
Gertone (Geert Bormans)Information ArchitectCommented:
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)
Gertone (Geert Bormans)Information ArchitectCommented:
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
metalteckAuthor Commented:
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)Information ArchitectCommented:
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
metalteckAuthor Commented:
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)Information ArchitectCommented:
Now validate again using the Upstream xsd and see what happens
metalteckAuthor Commented:
I'm getting the same error.
Gertone (Geert Bormans)Information ArchitectCommented:
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
metalteckAuthor Commented:
Gertone (Geert Bormans)Information ArchitectCommented:
You do realize that you sent an older version of the package than the earlier schema you sent?

                  <xsd:element ref="SHOPEmployeeErrorDtl" maxOccurs="1000"/>
on line 2170 of IRS-CAC.xsd
will cause issues in most parsers because this high number is very uncommon

Other than that, the schema package is valid

I validated this file form the examples in the package
and my parser says this one is valid.

Can you try to test that first?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
metalteckAuthor Commented:
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?
Gertone (Geert Bormans)Information ArchitectCommented:
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
metalteckAuthor Commented:
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)Information ArchitectCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.