How do I know what my XML namespace should be from reading the XSD files?
The XML namespace of the root element of the XML document should match the targetNamespace
attribute value of the governing XSD.
I see in the Base Schema there is an element EFilingMegabatchXML which encloses EFilingBatchXML. EFilingBatchXML is also defined in the Base Schema file. Is that a problem?
The root element must be defined at the top level of the associated XSD, so you would not be able to have an XML document with a EFilingBatchXML
root element validate against the base schema since it doesn't have such an element at the top level.
From what you've posted (assuming it's representative of your actual case), fc2:EFilingBatchXML
as the root element of your XML document with the fc2
namespace prefix bound to www.fincen.gov/base
ought to associated with https://www.fincen.gov/sites/default/files/schema/base/EFL_CTRXBatchSchema.xsd
per your xsi:schemaLocation
attribute value. It's defined at the top-level there, so it should be accessible for documents for which it is a root element.
Sample Valid XML
The XSD seems to suffer from paper-form era requirements such as a minimum of six fc2:Party
elements, so this "minimal" example is a bit long, but the following XML is valid against the XSD indicated in the xsi:schemaLocation
attribute.
<?xml version="1.0" encoding="UTF-8"?>
<fc2:EFilingBatchXML TotalAmount="35000" PartyCount="6" ActivityCount="1"
xsi:schemaLocation="www.fincen.gov/base
https://www.fincen.gov/sites/default/files/schema/base/EFL_CTRXBatchSchema.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fc2="www.fincen.gov/base">
<fc2:FormTypeCode>CTRX</fc2:FormTypeCode>
<fc2:Activity SeqNum="1">
<fc2:EFilingPriorDocumentNumber>0</fc2:EFilingPriorDocumentNumber>
<fc2:FilingDateText>20200804</fc2:FilingDateText>
<fc2:ActivityAssociation SeqNum="2">
<fc2:CorrectsAmendsPriorReportIndicator></fc2:CorrectsAmendsPriorReportIndicator>
<fc2:FinCENDirectBackFileIndicator></fc2:FinCENDirectBackFileIndicator>
<fc2:InitialReportIndicator></fc2:InitialReportIndicator>
</fc2:ActivityAssociation>
<fc2:Party SeqNum="3">
<fc2:ActivityPartyTypeCode>35</fc2:ActivityPartyTypeCode>
<fc2:PartyName SeqNum="4"></fc2:PartyName>
</fc2:Party>
<fc2:Party SeqNum="5">
<fc2:ActivityPartyTypeCode>35</fc2:ActivityPartyTypeCode>
<fc2:PartyName SeqNum="6"></fc2:PartyName>
</fc2:Party>
<fc2:Party SeqNum="7">
<fc2:ActivityPartyTypeCode>35</fc2:ActivityPartyTypeCode>
<fc2:PartyName SeqNum="8"></fc2:PartyName>
</fc2:Party>
<fc2:Party SeqNum="9">
<fc2:ActivityPartyTypeCode>35</fc2:ActivityPartyTypeCode>
<fc2:PartyName SeqNum="10"></fc2:PartyName>
</fc2:Party>
<fc2:Party SeqNum="11">
<fc2:ActivityPartyTypeCode>35</fc2:ActivityPartyTypeCode>
<fc2:PartyName SeqNum="12"></fc2:PartyName>
</fc2:Party>
<fc2:Party SeqNum="13">
<fc2:ActivityPartyTypeCode>35</fc2:ActivityPartyTypeCode>
<fc2:PartyName SeqNum="14"></fc2:PartyName>
</fc2:Party>
<fc2:CurrencyTransactionActivity SeqNum="15">
<fc2:AggregateTransactionIndicator></fc2:AggregateTransactionIndicator>
<fc2:ArmoredCarServiceIndicator></fc2:ArmoredCarServiceIndicator>
<fc2:ATMIndicator></fc2:ATMIndicator>
<fc2:MailDepositShipmentIndicator></fc2:MailDepositShipmentIndicator>
<fc2:NightDepositIndicator></fc2:NightDepositIndicator>
<fc2:SharedBranchingIndicator></fc2:SharedBranchingIndicator>
<fc2:TotalCashInReceiveAmountText></fc2:TotalCashInReceiveAmountText>
<fc2:TotalCashOutAmountText></fc2:TotalCashOutAmountText>
<fc2:TransactionDateText>20200804</fc2:TransactionDateText>
<fc2:CurrencyTransactionActivityDetail SeqNum="16">
<fc2:CurrencyTransactionActivityDetailTypeCode>55</fc2:CurrencyTransactionActivityDetailTypeCode>
<fc2:DetailTransactionAmountText></fc2:DetailTransactionAmountText>
<fc2:OtherCurrencyTransactionActivityDetailText></fc2:OtherCurrencyTransactionActivityDetailText>
<fc2:OtherForeignCurrencyCountryText></fc2:OtherForeignCurrencyCountryText>
</fc2:CurrencyTransactionActivityDetail>
</fc2:CurrencyTransactionActivity>
</fc2:Activity>
</fc2:EFilingBatchXML>
If this guidance doesn't lead you to be able to successfully validate your XML against the XSD in the xsd:schemaLocation
attribute, then post a Minimum Complete Example that fails to validate for further assistance.
See also