Reputation: 543
Firstly, i used to a xsd/xml validator to check if my xsd works against my xml file which compiled without any errors. I wanted to reference the xsd file inside my xml file and did so like this:
<?xml version="1.0" encoding="utf-8"?>
<Families xmlns="C:\workspace\XMLApplication\XMLApplication\XML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="C:\workspace\XMLApplication\XMLApplication\XML Family.xsd">
//other xml elements here.
</Families>
And within my xsd like this:
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
This is a screenshot of what I'm getting. I've looked online for many solutions but most of them don't really relate to this specific case.
Is there any major reason why these messages keep coming up? Would it have something to do with the xsd design? If it is an xsd issue and you would like to look at the full xsd file, here it is:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Families" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Family" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FamilyID" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<xsd:element name="PostalAddress" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MailingAddress1" type="xsd:string" minOccurs="0" />
<xsd:element name="MailingAddress2" type="xsd:string" minOccurs="0" />
<xsd:element name="MailingCity" type="xsd:string" minOccurs="0" />
<xsd:element name="MailingPostCode" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ClientAddress" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="HomeAddress1" type="xsd:string" minOccurs="0" />
<xsd:element name="HomeAddress2" type="xsd:string" minOccurs="0" />
<xsd:element name="HomeCity" type="xsd:string" minOccurs="0" />
<xsd:element name="HomePostcode" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Family_Client" minOccurs="1" maxOccurs="10">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ClientID" type="xsd:int" />
<xsd:element name="Title" type="Title" minOccurs="0"/>
<xsd:element name="FirstName" type="xsd:string" />
<xsd:element name="LastName" type="xsd:string" />
<xsd:element name="MiddleName" type="xsd:string" minOccurs="0" />
<xsd:element name="PreferredName" type="xsd:string" minOccurs="0" />
<xsd:element name="Email" type="xsd:string" minOccurs="0" />
<xsd:element name="Gender" type="Gender" minOccurs="0" />
<xsd:element name="Dob" type="xsd:date" minOccurs="0" />
<xsd:element name="HomePhone" type="xsd:string" minOccurs="0" />
<xsd:element name="MobilePhone" type="xsd:string" minOccurs="0" />
<xsd:element name="BusinessPhone" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkEmail" type="xsd:string" minOccurs="0" />
<xsd:element name="Fax" type="xsd:string" minOccurs="0" />
<xsd:element name="Smoker" type="YesOrNo" minOccurs="0" />
<xsd:element name="BestTimeToCall" type="xsd:string" minOccurs="0" />
<xsd:element name="Occupation" type="xsd:string" minOccurs="0" />
<xsd:element name="Employer" type="xsd:string" minOccurs="0" />
<xsd:element name="Industry" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Loan" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LenderName" type="LenderName" />
<xsd:element name="LoanStatus" type="LoanStatus" />
<xsd:element name="LoanReferenceNumber" type="xsd:string" minOccurs="0" />
<xsd:element name="DateCreated" type="xsd:date" minOccurs="0" />
<xsd:element name="DateSettled" type="xsd:date" minOccurs="0" />
<xsd:element name="DateSubmitted" type="xsd:date" minOccurs="0" />
<xsd:element name="ApprovalDate" type="xsd:date" minOccurs="0" />
<xsd:element name="DateDeclined" type="xsd:date" minOccurs="0" />
<xsd:element name="DateWithdrawn" type="xsd:date" minOccurs="0" />
<xsd:element name="DatePreApproved" type="xsd:date" minOccurs="0"/>
<xsd:element name="DatePreApprovalExpiry" type="xsd:date" minOccurs="0"/>
<xsd:element name="DeferralReviewDate" type="xsd:date" minOccurs="0"/>
<xsd:element name="DateCancelled" type="xsd:date" minOccurs="0"/>
<xsd:element name="Loan_Structure" minOccurs="0" maxOccurs="10">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LoanTerm" type="InterestTerm" minOccurs="0"/>
<xsd:element name="InterestOnlyTerm" type="InterestTerm" minOccurs="0"/>
<xsd:element name="FixedRateTerm" type="InterestTerm" minOccurs="0"/>
<xsd:element name="FixedRateExpiryDate" type="xsd:date" minOccurs="0"/>
<xsd:element name="InterestRate" type="xsd:decimal" minOccurs="0"/>
<xsd:element name="Amount" type="xsd:decimal" minOccurs="0"/>
<xsd:element name="LoanStructureType" type="LoanStructureType" minOccurs="0"/>
<xsd:element name="RateType" type="RateType" minOccurs="0"/>
<xsd:element name="FrequencyName" type="FrequencyType" minOccurs="0"/>
<xsd:element name="PaymentAmount" type="xsd:decimal" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Family_Client" minOccurs="1" maxOccurs="20">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ClientID" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="YesOrNo">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Yes"/>
<xsd:enumeration value="No"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Gender">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Male"/>
<xsd:enumeration value="Female"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Title">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Mr"/>
<xsd:enumeration value="Mrs"/>
<xsd:enumeration value="Ms"/>
<xsd:enumeration value="Miss"/>
<xsd:enumeration value="Dr"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="RateType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Fixed"/>
<xsd:enumeration value="Floating"/>
<xsd:enumeration value="Variable"/>
<xsd:enumeration value="TBA"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LoanStructureType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Principal and Interest"/>
<xsd:enumeration value="Interest Only"/>
<xsd:enumeration value="Revolving Credit"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="FrequencyType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Weekly"/>
<xsd:enumeration value="Fortnightly"/>
<xsd:enumeration value="Monthly"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="InterestTerm">
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="30"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LoanStatus">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Conditional Approval"/>
<xsd:enumeration value="Construction Loan - Progressive Drawdown"/>
<xsd:enumeration value="Pre-Approved"/>
<xsd:enumeration value="Settled"/>
<xsd:enumeration value="Unconditional Approval"/>
<xsd:enumeration value="Cancelled"/>
<xsd:enumeration value="Declined"/>
<xsd:enumeration value="Discharged"/>
<xsd:enumeration value="Loan Repaid"/>
<xsd:enumeration value="Lost to Other Lender/Competitor"/>
<xsd:enumeration value="Not Proceeded With"/>
<xsd:enumeration value="On hold"/>
<xsd:enumeration value="Approved"/>
<xsd:enumeration value="Deferred"/>
<xsd:enumeration value="In Progress"/>
<xsd:enumeration value="Paid"/>
<xsd:enumeration value="Pre Submission"/>
<xsd:enumeration value="Submitted to Lender"/>
<xsd:enumeration value="Waiting for Documentation"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LenderName">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Abode Mortgages Limited"/>
<xsd:enumeration value="Access Home Loans Limited"/>
<xsd:enumeration value="AMBL"/>
<xsd:enumeration value="AMP"/>
<xsd:enumeration value="ANZ"/>
<xsd:enumeration value="Argosy"/>
<xsd:enumeration value="ASAP Finance Limited"/>
<xsd:enumeration value="ASB"/>
<xsd:enumeration value="Ascend Finance"/>
<xsd:enumeration value="Avanti Finance"/>
<xsd:enumeration value="Basecorp Finance"/>
<xsd:enumeration value="Bluestone"/>
<xsd:enumeration value="BNZ"/>
<xsd:enumeration value="CBS"/>
<xsd:enumeration value="Commix Group Limited"/>
<xsd:enumeration value="Cressida"/>
<xsd:enumeration value="DBR Limited"/>
<xsd:enumeration value="Family Finance"/>
<xsd:enumeration value="Freedom Mortgages Ltd"/>
<xsd:enumeration value="Freedom Mtgs"/>
<xsd:enumeration value="GE Money"/>
<xsd:enumeration value="Gem Hoam Loans"/>
<xsd:enumeration value="General Finance"/>
<xsd:enumeration value="Gold Band Finance"/>
<xsd:enumeration value="Home Trust Mortgages (Central West) Ltd"/>
<xsd:enumeration value="HSBC"/>
<xsd:enumeration value="Kiwibank"/>
<xsd:enumeration value="KMM H/O"/>
<xsd:enumeration value="Liberty"/>
<xsd:enumeration value="MARAC"/>
<xsd:enumeration value="Metro Money Ltd"/>
<xsd:enumeration value="Mortgage North"/>
<xsd:enumeration value="MTF"/>
<xsd:enumeration value="Mutual Finance Limit"/>
<xsd:enumeration value="National Bank"/>
<xsd:enumeration value="NBS"/>
<xsd:enumeration value="NZ Finance"/>
<xsd:enumeration value="NZ Guardian Trust"/>
<xsd:enumeration value="NZCU"/>
<xsd:enumeration value="NZF"/>
<xsd:enumeration value="Origin - ANZ"/>
<xsd:enumeration value="Other Lenders"/>
<xsd:enumeration value="Other Non Bank Lenders"/>
<xsd:enumeration value="Pacific Home Loans"/>
<xsd:enumeration value="Pacific Retail Finan"/>
<xsd:enumeration value="PFS"/>
<xsd:enumeration value="Pioneer"/>
<xsd:enumeration value="Presto"/>
<xsd:enumeration value="Property Equity Finanance"/>
<xsd:enumeration value="Property Finance Securities Limited"/>
<xsd:enumeration value="Public Trust"/>
<xsd:enumeration value="RESIMAC"/>
<xsd:enumeration value="SBS"/>
<xsd:enumeration value="SCF"/>
<xsd:enumeration value="Sentinel"/>
<xsd:enumeration value="Southern Cross Building Society"/>
<xsd:enumeration value="Southern Cross Finance Ltd"/>
<xsd:enumeration value="Sovereign"/>
<xsd:enumeration value="SuperBank"/>
<xsd:enumeration value="Tasman Mortgages"/>
<xsd:enumeration value="The Co-operative Bank"/>
<xsd:enumeration value="TSB"/>
<xsd:enumeration value="United Home Loans"/>
<xsd:enumeration value="Westpac"/>
<xsd:enumeration value="Wizard Homeloans"/>
<xsd:enumeration value="Other"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Upvotes: 0
Views: 995
Reputation: 1163
xmlns="..." defines your default namespace. As you don't provide a namespace suffix for your root element name, that default namespace must match the target namespace defined in the xsd schema you import / intend to generate an instance of.
Upvotes: 0
Reputation: 111726
If you really do want your XML document to have a default namespace of C:\workspace\XMLApplication\XMLApplication\XML
(as indicated by xmlns="C:\workspace\XMLApplication\XMLApplication\XML"
on the root Families
element):
Change
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
to
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="C:\workspace\XMLApplication\XMLApplication\XML">
so that the targetNamespace of the XSD matches the default namespace specified by your XML document.
Upvotes: 1