Jump to content
Sign in to follow this  
Guest silverfox

Polimorphism and abstract

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...