Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML definitons in another file

Status
Not open for further replies.

dhelie

Programmer
Apr 30, 2008
5
US
Hi;

I am just beginning with XML and I received two XML schema files. One schema file has the field descriptions and the other has the type definitions of these fields. Is there a way to have the schema file with the field descriptions to include the file that has the type definitions? In C I can use the include statement for including external files.

===========t4rif.xmsl sample code======================
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="<!-- @@@@ Definition of T4RIF ComplexTypes @@@@ 2008/sept/03 Version# 2.8-->
<xsd:complexType name="T4RIFSlipType">
<xsd:all>
<xsd:element name="RCPNT_NM" type="NameType"/>
<xsd:element name="RCPNT_ADDR"
type="CanadaAddressType" minOccurs="0"/>
<xsd:element name="sin" type="sinType"/>
<xsd:element name="ctrct_nbr" type="char12Type"/>
<xsd:element name="bn" type="bnType"/>
<xsd:element name="sps_cntrb_ind" type="indicator1-2Type"/>
<xsd:element name="sps_sin" type="sinType"/>
<xsd:element name="rpt_tcd" type="slipDataType"/>
<xsd:element name="DTH_DT" type="DateType" minOccurs="0"/>
<xsd:element name="T4RIF_AMT" type="T4rifAmtType" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>



============ this is the xml definition file sample =====
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="<!-- @@@@ COMPLEX TYPE DEFINITIONS @@@@ 2008/sept/03 Version# 2.8 -->
<xsd:complexType name="CanadaAddressType">
<xsd:all>
<xsd:element name="addr_l1_txt" type="char30Type" minOccurs="0"/>
<xsd:element name="addr_l2_txt" type="char30Type" minOccurs="0"/>
<xsd:element name="cty_nm" type="char28Type" minOccurs="0"/>
<xsd:element name="prov_cd"
type="provinceStateType" minOccurs="0"/>
<xsd:element name="cntry_cd" type="countryType" minOccurs="0"/>
<xsd:element name="pstl_cd" type="pcType" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
any help will be great!
 
I know that the following makes the content of a XSD file usable by an XML file:

xmlns:xsi=" xsi:noNamespaceSchemaLocation="pruebaXSD.xsd" (This would be put in xsd:schema in your case.

I suppose it will also work for two XSD files. Good luck.
 
Well, just a note, pruebaXSD.xsd, would be whatever xsd file you'd like to include.
 
thank you for our reply.. but can you do a sample based upon the 2 files samples I included? I think I know what you are talking about but not convince that I am doing it right.

 
In the first xsd document, at the top level, add the line with element xsd:include.
[tt] <xsd:include schemaLocation="uri-of-second.xsd" />[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top