XSD to validate same element name with different content - xsd

I'm learning about XSDs. I wanted to know if there's a way to validate these 3 xml examples in one xsd? Let's just stick with XSD 1.0 (without asserts). I know I can technically use minOccurs=0 for all the sub elements. Is there a better solution?
<property>
<item>car</item>
<cost>500</cost>
<wheels>4</wheels>
</property>
<property>
<item>chair</item>
<cost>100</cost>
<legs>10</legs>
<edible>yes</edible>
</property>
<property>
<item>bed</item>
<bedbugs>yes</bedbugs>
<dirty>no</dirty>
</property>

Related

styleClass property always gets overwritten when adding style in theme

I am using a theme for my XPage application to set global look&feel settings so my configuration for the viewRoot looks like this:
<control dojoTheme="true">
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/favicon.ico</value>
</property>
<property>
<name>style</name>
<value>#{javascript:
var response = facesContext.getExternalContext().getResponse();
response.setHeader("X-UA-Compatible", "IE=8");
}</value>
</property>
<property mode="concat">
<name>styleClass</name>
<value>claro</value>
</property>
</control>
Although I use the mode="concat", which I thought just adds (like array.concat) my properties to my viewRoot but it always overwrites it, so that my <body> looks like this:
<body class="claro"... instead of:
<body class="xsp lotusui claro"...
I experienced this problem with other <controls>/<properties> as well.
My current solution is that I set the property value to xsp lotusui claro not just only claro to prevent my body from loosing all oneui/xsp styles. Anyone got a idea why the mode="concat" is not working in my example? or is this mode for something else?
I could not find a good documentation of all theme properties so if someone got a good link, I would be glad if he could share it.
EDIT:
As I am also working on a XPages Theme at the moment I got more curious and played a little bit with this. As far as I can see your code works perfectly fine . In my Tests I experienced that you can concat a style definition to a pre-defined styleClass. So you can create an XPages and define a body style class like this with a body-styleClass predefined within the XPage:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" styleClass="mystyle">
<xp:button value="Label" id="button1" themeId="bt"
styleClass="oink">
</xp:button>
</xp:view>
Using a Theme you can now add another (or even multiple) styleClasses:
<control>
<name>ViewRoot</name>
<property mode="concat">
<name>styleClass</name>
<value>claro</value>
</property>
</control>
In your scenario, you want to concat the styleClass definition which is added as "default" styleClass - and this seems to be an issue or conflict.
So, for now this is my conclusion. If there is anybody else having more and deeper insights I would also be interested in deeper insights into Themes and inheritance in particular.
Old comment:
As far as I know, to only add the attribute, you should set the override-property of the control to false.
Example (your code changed):
<control dojoTheme="true" override="false">
<name>ViewRoot</name>
<property>
<name>pageIcon</name>
<value>/favicon.ico</value>
</property>
<property>
<name>style</name>
<value>#{javascript:
var response = facesContext.getExternalContext().getResponse();
response.setHeader("X-UA-Compatible", "IE=8");
}</value>
</property>
<property mode="concat">
<name>styleClass</name>
<value>claro</value>
</property>
Hope that works and helps,
Michael
I know it has been a while, but did you remember to "extend" the theme you want to include the original classes from? i.e.:
<theme extends="oneui">
<control….>…</control>…
</theme>

How can I set application layout properties in a theme?

I understand how to set properties like style and styleClass using a theme but how do I set a property such as productLogo in my theme?
I tried
<control>
<name>ApplicationLayout</name>
<property>
<name>configuration.oneuiApplication.productLogo</name>
<value>"/LogoSmall.JPG"</value>
</property>
</control>
and
<control>
<name>ApplicationLayout</name>
<property>
<name>configuration.productLogo</name>
<value>"/LogoSmall.JPG"</value>
</property>
</control>
<control>
<name>ApplicationLayout</name>
<property>
<name>productLogo</name>
<value>"/LogoSmall.JPG"</value>
</property>
</control>
but none seemed to work.
Can this be done? If so how?
First of all you need to determine the themeID of the component. Tim Tripcony has wrote a blog about how to do this, see http://xmage.gbs.com/blog.nsf/d6plinks/TTRY-8RXAQ6
When you know the theme id you can use in your own theme

Theme not working for Button

I started playing with themes. I was able so create CSS and associated the CSS to various table elements. Works fine.
Now I am trying to do the same with a button. But it does not seem to work. If I apply the styleclass right to the button then it works.
<theme extends="oneuiv2.1">
<resource>
<content-type>text/css</content-type>
<href>app.css</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>viewpicklistCC.css</href>
</resource>
<control>
<name>Button</name>
<property>
<name>styleClass</name>
<value>MyButton</value>
</property>
</control>
<control>
<name>HtmlTable</name>
<property>
<name>styleClass</name>
<value>PNCTable</value>
</property>
</control>
<control>
<name>HtmlTd</name>
<property>
<name>styleClass</name>
<value>PNCTableCell</value>
</property>
</control>
</theme>
.MyButton {
width:179.0px;
font-family:Arial,sans-serif;
font-size:18pt;
color:rgb(255,128,0);
font-weight:bold
}
In a theme you need to use the theme id of a control in order to target it. This is not the same as the CSS style class.
You can set the theme id manually on a control (in Style - Theme, or in All properties - Style - Theme id) and then target the control by referring to this theme id.
Or you can use the default theme id for a control. The XPageswiki contains a list of default theme ids for core controls:
http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/Work_with_themes#themeID+values+for+core+controls
So in your case you need to use one of the following theme ids in order to target your button:
Button: Button.Command
Button with type=submit: Button.Submit
Button with type=cancel: Button.Cancel

Set expandLevel for xe:navigator using a theme

I would like to set the expandLevel property for several extension libary navigators using a theme. I can set expandable and expandEffect but I can not get expandLevel to work. I am using the following in my theme:
<!-- Navigator -->
<control>
<name>Outline.Navigator</name>
<property type="boolean">
<name>expandable</name>
<value>true</value>
</property>
<property>
<name>expandEffect</name>
<value>wipe</value>
</property>
<property>
<name>expandLevel</name>
<value>#{0}</value>
</property>
</control>
I have also tried using <value>0</value> which also does not work.
Booleans need to be passed as EL, just like numbers. Pass the value of the expandable property as #{true}, otherwise it will try to assign a String value.

Set Custom Properties for a custom field type within a content type feature

I have created a custom field type (derived from SPFieldText) and added a custom property "MyProperty". Now what I am looking for is, I need to use this field type in my Content Type feature.
How can I specity my custom property within a Content Type definition file, just like what we do with OOB field types?
I've seen a workaround here but it only solves only the problem of XSD validation. Site column is getting installed properly but the value that I specify in the feature is not set for the column after installing the feature.
Thank in advance
Arun
This worked for me
<Field ID="{EB4A62A3-5722-4D12-9AB8-BB36461D8E5D}" Type="MyCustomFieldType" Name="Website" DisplayName="Website" StaticName="Website" Required="true">
<Customization>
<ArrayOfProperty>
<Property>
<Name>MyFirstProperty</Name>
<Value>www.stackoverflow.com</Value>
</Property>
<Property>
<Name>MySecondProperty</Name>
<Value>stackoverflow</Value>
</Property>
</ArrayOfProperty>
</Customization>
</Field>
you can access the property in the validation class like this:
string myFieldValue = ((XmlNode[])this.GetCustomProperty("MyFirstProperty"))[0].Value;
Something like this
<Field ID="{aec8cea1-d0df-49fc-baef-d356e58423f4}" Name="ClientWorkspace" DisplayName="$Resources:Nervogrid.Lauxtermann.Root,FieldWorkspaceDisplayName;" Type="ExtendedWorkspace" Group="$Resources:Nervogrid.Lauxtermann.Root,GroupLauxtermannFields;" AllowDuplicateValues="FALSE">
<Customization>
<ArrayOfProperty>
<Property>
<Name>SiteTemplates</Name>
<Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">;#12203;#</Value>
</Property>
<Property>
<Name>HideOnDisplayForm</Name>
<Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">$Resources:core,fld_no;</Value>
</Property>
<Property>
<Name>HideOnEditForm</Name>
<Value xmlns:q3="http://www.w3.org/2001/XMLSchema" p4:type="q3:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">$Resources:core,fld_yes;</Value>
</Property>
</ArrayOfProperty>
</Customization>
</Field>
Here is a thread on msdn forums that should answer your question. - http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/fb1cb936-3abb-48c2-8d19-49007688dc34/

Resources