Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: declaring an element having subelements and restricted child-text-node value

From: George Cristian Bina <george@---------.--->
To: Vasilis Vagenas <vagenas.v@-----.--->
Date: 6/6/2006 5:51:00 PM
Hi,

When you have mixed content you cannot place constraints on the text 
nodes. In fact in your sample the Brand element has 3 text nodes:

"HP\n  "
"\n  "
"\n"

where \n stands for new line.

However, if you use Schematron then you can add rules to check for what 
you want but I would recommend changing the XML structure to have the 
brand name inside an element or attribute:

<Brand>
   <Name>HP</Name>
   <Type>Laptop</Type>
   <Type>Desktop</Type>
</Brand>

or

<Brand Name="HP">
   <Type>Laptop</Type>
   <Type>Desktop</Type>
</Brand>


Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


Vasilis Vagenas wrote:
> 
> I am trying to write an xml schema which will allow xml instance
> documents of the following form:
> 
> [............]
> <Brand>X1
>   <Type>X2
> [............]
> 
> where X1 must belong to a set of string values, e.g. X1 in {"HP", 
> "Toshiba"}
> and X2 must belong to another set of string values, e.g. X2 in
> {"Laptop","Desktop"}.
> 
> For examle:
> <Brand>HP
>   <Type>Laptop</Type>
>   <Type>Desktop</Type>
> </Brand>
> 
> 
> How can I declare an element that satisfies the following:
> 1) it has subelements and
> 2) the value of its child-text node is restricted (to belong to a set
> of values),
> just as in the example above?
> 
> I can declare an element satisfying either condition 1 or condition 2,
> but not both of them.
> 
> Thank you very much!
> 
> 

From george@o... Tue Jun 06 16:36:36 2006
Received: from maggie.w3.org ([193.51.208.68])
	by 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent