Jump to content

Polimorphism and abstract


Guest silverfox

Recommended Posts

Guest silverfox

Hello all.I'm trying to create a schemas library in order to validate some different xml.XML is constructed in this form:<PETITION> <TIME hour minute second/> <RESPONSETYPE type channel/> <PETITIONTYPE1> ...some petition data nodes... <PETITIONTYPE1/> [any number of petitiontype, but all the same type]</PETITION>PETITIONTYPE tag is a type of petition, it can be four different types <PETITONTYPE1> to <PETITIONTYPE4>this structure can't be modified.I'm trying to make any type of polimorphism, but all I could find by searching the web was multi-container, and, in this case, it's not valid (petitions in this list must have identical types)In the other hand, all these tags must be translated, I tried it with generic abstract tags and taking translated tags into a different files, one for each language. Only there are valid the files totally translated into the one only language (mixed tags are not allowed)Then, I'd this:<xsd:element name="refPetition" abstract="true" type="TypePetition"/><xsd:complexType name="TypePetition"> <xsd:element name="data1" type="t1"/> <xsd:element name="data2" type="t2"/></xsd:complexType> but, I need translate data1 and data2, now, I make some changes here:<xsd:complexType name="TypePetition"> <xsd:element ref="refData1"/> <xsd:element ref="refData2"/></xsd:complexType>and adding<xsd:element name="refData1" abstract="true" type="t1"/><xsd:element name="refData2" abstract="true" type="t2"/>In translationFile, I add all translated tags:<xsd:element name="data1Lang1" susbtitutionGroup="refData1"/>...and so on...But XML files cannot be validate, because cannot find type in data1Lang1.My questions are:1.- Can I use some kind of polimorphism for petitionTypes without modify my structure?2.- Does exist any form not to write the type in the not abstract element, and leaving it in abstract elements?Thankou very much for your answers, all kind of comments will be really appreciated.Silverfox

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...