Jump to content

simonnito

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About simonnito

  • Rank
    Newbie
  1. Actually I created another xsd files containing only the common global variables. Thus file3.xsd looks like below:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <!-- D├ęclarations des variables globales --> <xs:attribute name="tableDeCode" type="xs:string"/> <xs:element name="ctpays"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="tableDeCode" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <!-- fin des variables globales --></xs:schema>in file1.xsd and file2.xsd I just included file3.xsd and used the attribute ref="....." to the global variable I needed.file 1.xsd:<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="variablesGlobales.xsd"/> <xs:complexType name="T_Allocataire"> <xs:sequence> .......... .......... <xs:element ref="ctpays"/> </xs:sequence> </xs:complexType></xs:schema>=> XMLSpy does not return any error.
  2. Hi,I am building a xsd schema splitted in severals xsd schema. My problem is the following (with xmlspy):I must use the same element and the same attribute in different xsd schema, but I do not know how to declare this element and this attribute to make them as global variables for any includes xsd files.For instance :the file main.xsd:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="NewSchema"> <xs:include schemaLocation="file1.xsd"/> <xs:include schemaLocation="file2.xsd"/> <xs:attribute name="tableDeCode" type="xs:string"/> <xs:element name="ctpays"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="tableDeCode" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="data"> <xs:complexType> <xs:sequence> <xs:element name="file1" type="T_file1"/> <xs:element name="file2" type="T__file2" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element></xs:schema>file1.xsd:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="T_file1"> <xs:sequence> <xs:element ref="ctpays"/> </xs:sequence> </xs:complexType></xs:schema>error=> 'ctpays' must refer to an existing elementfile2.xsd:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="T_file2"> <xs:sequence> <xs:element ref="ctpays"/> </xs:sequence> </xs:complexType></xs:schema>error=> 'ctpays' must refer to an existing elementAlso, I tried to declare into file1.xsd AND file2.xsd: <xs:attribute name="tableDeCode" type="xs:string"/> <xs:element name="ctpays"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="tableDeCode" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element>But xmlspy returns the following error when I tried to validate main.xsd:tableDeCode is already declared in file1.xsdDoes anyone know how I can sort it out ?Thanks
×
×
  • Create New...