RelaxNG - *any* attribute? - validation

Is there a way to define an any name attribute? I'm validating code where users can and do apply their own attributes for tags and the like, which don't impact my project.
<define name="div">
<zeroOrMore>
<attribute name="*">
<text />
</attribute>
</zeroOrMore>
<text />
</define>

<anyName/> seems to be what you are looking for:
<define name="div">
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<text/>
</define>

Related

CRM solution import failed "an item with the same key has already been added"

I have a strange behaviour in one of our CRM-Organizations.
When I export a solution (which only contains the account-entity) as an unmanaged solution it works.
But when I reimport this very same solution without changing anything I get this error
"an item with the same key has already been added".
I found out that I have to remove the Attribute "ownerid" from the solution (and one relationship) and then it works...
this is the attribute
<attribute PhysicalName="OwnerId">
<Type>owner</Type>
<Name>ownerid</Name>
<LogicalName>ownerid</LogicalName>
<RequiredLevel>systemrequired</RequiredLevel>
<DisplayMask>ValidForAdvancedFind|ValidForForm|ValidForGrid|RequiredForForm</DisplayMask>
<ImeMode>auto</ImeMode>
<ValidForReadApi>1</ValidForReadApi>
<ValidForCreateApi>1</ValidForCreateApi>
<IsCustomField>0</IsCustomField>
<IsAuditEnabled>1</IsAuditEnabled>
<IsSecured>0</IsSecured>
<IntroducedVersion>5.0.0.0</IntroducedVersion>
<SourceType>0</SourceType>
<LookupStyle>single</LookupStyle>
<LookupTypes>
<LookupType id="00000000-0000-0000-0000-000000000000">8</LookupType>
<LookupType id="00000000-0000-0000-0000-000000000000">9</LookupType>
</LookupTypes>
<displaynames>
<displayname description="Vertriebsverantwortlicher" languagecode="1031" />
<displayname description="Owner" languagecode="1033" />
<displayname description="Właściciel" languagecode="1045" />
</displaynames>
<Descriptions>
<Description description="Geben Sie den Benutzer oder das Team ein, der bzw. das mit der Verwaltung des Datensatzes betraut ist. Dieses Feld wird aktualisiert, wenn der Datensatz einem anderen Benutzer zugewiesen wird." languagecode="1031" />
<Description description="Enter the user or team who is assigned to manage the record. This field is updated every time the record is assigned to a different user." languagecode="1033" />
<Description description="Wprowadź nazwę użytkownika lub zespołu, który zarządza rekordem. To pole jest aktualizowane za każdym razem, gdy rekord zostanie przypisany do innego użytkownika." languagecode="1045" />
</Descriptions>
</attribute>
I also checked the serverlogs and found this:
<importexportxml start="635818108905329459" stop="635818109069971342" progress="22.2222222222222" processed="true">
<solutionManifests>
<solutionManifest languagecode="1031" id="Firma_Transfer" LocalizedName="Firma_Transfer" processed="true">
<UniqueName>Firma_Transfer</UniqueName>
<LocalizedNames>
<LocalizedName description="Firma_Transfer" languagecode="1031" />
</LocalizedNames>
<Descriptions />
<Version>1.0.0</Version>
<Managed>0</Managed>
<Publisher>
<UniqueName>myorg</UniqueName>
<LocalizedNames>
<LocalizedName description="Myorg" languagecode="1031" />
</LocalizedNames>
<Descriptions />
<EMailAddress />
<SupportingWebsiteUrl />
<Addresses>
<Address>
<City />
<Country />
<Line1 />
<Line2 />
<PostalCode />
<StateOrProvince />
<Telephone1 />
</Address>
</Addresses>
</Publisher>
<results />
<result result="success" errorcode="0" errortext="" datetime="13:08:12.07" datetimeticks="635818072920798192" />
</solutionManifest>
</solutionManifests>
<upgradeSolutionPackageInformation>
<upgradeRequired>0</upgradeRequired>
<upgradeValid>1</upgradeValid>
<fileVersion>7.0.1.129</fileVersion>
<currentVersion>7.0.1.129</currentVersion>
<fileSku>OnPremise</fileSku>
<currentSku>OnPremise</currentSku>
</upgradeSolutionPackageInformation>
<entities>
<entity LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="true">
<result result="failure" errorcode="0x80044150" errortext="Ein Element mit dem gleichen Schlüssel wurde bereits hinzugefügt." datetime="13:08:26.96" datetimeticks="635818073069658863" />
</entity>
</entities>
<nodes />
<settings />
<dashboards />
<securityroles />
<workflows />
<templates />
<optionSets />
<ConnectionRoles />
<SolutionPluginAssemblies />
<SdkMessageProcessingSteps />
<ServiceEndpoints />
<webResources />
<reports />
<FieldSecurityProfiles />
<convertrules />
<routingrules />
<Slas />
<languages>
<language>
<result result="success" errorcode="0" errortext="" datetime="13:08:11.07" datetimeticks="635818072910798185" />
</language>
</languages>
<entitySubhandlers>
<savedQuery LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/>
<formXml LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false">
</formXml>
<entityCustomResources LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/>
<entityRibbon LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/>
<savedQueryVisualization LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false">
</savedQueryVisualization>
</entitySubhandlers>
<rootComponents>
<rootComponent processed="false" />
</rootComponents>
<dependencies>
<dependency processed="false" />
</dependencies>
All I found in the internet pointed to an problem with an attribute (missmatching type, ...) but in my case this is the same organization and no transfer from dev to prod or something like that...
We are using CRM 2015 but we had this problem in 2011 already.
Has anybody a solution for this? we don't want to edit the customization.XML everytime before importing a solution...
this is the database-field
[OwnerId] [uniqueidentifier] NOT NULL CONSTRAINT [DF_AccountBase_OwnerId] DEFAULT ('00000000-0000-0000-0000-000000000000')
thanks
Tobias
Your database field for OwnerId looks fine. Delete any custom fields with common names from your destination organization and try the import again. For instance, if you have new_LastEmailDate on both, or any custom field that performs the same function as a custom field in the solution, delete it from the destination. One of your custom fields is being recognized as a new addition of an existing field, probably due to capitalization. If you're writing it in from the new solution, you don't need it in the destination anyway and a non-conflicting copy will be replaced.
This happens for me when I try to reinstall a CRM 2016 Outlook that has been offline with a previous version of CRM. Uninstalling CRM and SQL server related items, cleaning up the registry deleting all folder and files related to the installation. I think it's worth mentioning that the installations works against the same CRM environment on other PC's.
The error you are seeing is very generic, but the fact that you know which attribute is causing the issue makes things a lot easier. It is usually possible to fix this type of issue by making direct database changes to repair corrupted metadata (unsupported!), but it requires a SQL developer with decent knowledge of how the CRM metadata tables work. If you have such a person I could provide additional guidance, otherwise you should create a case with Microsoft.

Can a FHIR extension be defined within the StructureDefinition of a profiled resource?

Does a FHIR extension always have to be defined in its own StructureDefinition before it can be used in a resource profile?
Or can its definition exist solely within the StructureDefinition of a profiled resource?
E.g.
<StructureDefinition xmlns="http://hl7.org/fhir">
<base value="http://hl7.org/fhir/StructureDefinition/Order" />
<name value="Order" />
...
<differential>
<element>
<path value="Order.extension" />
<name value="type" />
<label value="Type" />
<short value="BookAppointment | TelephonePatient | PatientNote | Note | Other" />
<definition value="Order type" />
<min value="1" />
<max value="1" />
<type>
<code value="code" />
</type>
<binding>
<strength value="required" />
<valueSetReference>
<reference value="http://test.org/fhir/ValueSet/task-type" />
</valueSetReference>
</binding>
</element>
...
Is the above valid?
No, that's not valid - because Order.extension can't have a type of "code". You could, in theory, slice extension and constrain the value[x] type to be valueCode with the specified properties. You'd also have to constrain the URL to a specified fixed value. The tricky part is that the URL you indicate as the fixed value is supposed to resolve to a StructureDefinition that defines the extension. So you really won't have saved yourself any work. Sending an instance where any immediate receiver can't discover the extension definition would make you automatically non-conformant.

How to validate against schema for namespace, not complete document?

I have a document like this:
<d:block xmlns:d="D" xmlns:b="B" xmlns="default" name="popover">
<d:description>...</d:description>
<d:sample>
<b:popover>
...some b:stuff...
</b:popover>
</d:sample>
</d:block>
Schema for this document looks like:
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<element name="block" ns="D">
<attribute name="name"/>
<element name="description">
<text/>
</element>
<element name="sample">
<ref name="anything"/>
</element>
</element>
</start>
<define name="anything">
<element>
<anyName>
<except>
<nsName ns="D"/>
</except>
</anyName>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anything"/>
</choice>
</zeroOrMore>
</element>
</define>
</grammar>
"Anything" literally means anything but D-namespaced.
And I want to create another schema for B namespace to use it against any arbitrary XML containing B:namespace.
How to create Schema for the namespace, not for the complete document?
Can't get this.
A kind of schema like that should work. You just have to define the elements for B namespace in the define element named BElements.
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<ref name="anythingOrB"/>
</start>
<define name="anythingOrB">
<choice>
<ref name="BElements"/>
<ref name="anythingExceptB"/>
</choice>
</define>
<define name="anythingExceptB">
<element>
<anyName>
<except>
<nsName ns="B"/>
</except>
</anyName>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anythingOrB"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="BElements">
<choice>
<element name="elt1" ns="B">
<empty/>
</element>
<element name="elt2" ns="B">
<empty/>
</element>
</choice>
</define>
</grammar>

Referencing specific element(s) in a RelaxNG schema with externalRef

So I have one RelaxNG schema that references another:
<define name="review">
<element name="review">
<externalRef href="other.rng"/>
</element>
</define>
other.rng:
<start>
<choice>
<ref name="good"/>
<ref name="bad"/>
</choice>
</start>
<define name="good">
<element name="good"/>
</define>
<define name="bad">
<element name="bad"/>
</define>
Is there any way I can import only <good>, but not allow <bad>? The goal being:
<review><good/></review>: valid
<review><bad/></review>: invalid
The grammar you import with externalRef can't be modified. To achieve the kind of validation you're after, I see this method :
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<include href="other.rng">
<start combine="choice">
<ref name="review"/>
</start>
</include>
<define name="review">
<element name="review">
<ref name="good"/>
</element>
</define>
</grammar>
You include the other schema.
You override the start element in the include (good and bad elements won't be possible root).
The specification says :
If the include element has a start component, then all start
components are removed from the grammar element.
You make a reference to the good element in your review definition.

Issue regarding Pie Chart in CRM 2011

I have a Pie chart which is based on out-of-box 'Activity' entity. The issue is regarding the following line:-
<attribute groupby="true" alias="groupby_column" name="scheduledend" dategrouping="week" />
Since, I am doing grouping on the 'Weekly' basis, due to which 'Horizontal (category) axis labels' are coming as Week 51 of 2011, Week 52 of 2011, etc. What I want is to modify this axis labels as Week 1, Week 2...? But, I am unable to find the solution for it. Any idea, any workaround is highly appreciated.
Btw, following is the XML which I am using :-
<visualization>
<visualizationid>{4930EBE4-3317-E111-B519-005056B20058}</visualizationid>
<name>My Team's Aging Activities</name>
<primaryentitytypecode>activitypointer</primaryentitytypecode>
<datadescription>
<datadefinition>
<fetchcollection>
<fetch mapping="logical" aggregate="true">
<entity name="activitypointer">
<attribute alias="aggregate_column" name="activityid" aggregate="count" />
<attribute groupby="true" alias="groupby_column" name="scheduledend" dategrouping="week" />
<filter type="and">
<condition attribute="scheduledend" operator="next-x-weeks" value="4" />
<condition attribute="scheduledend" operator="not-null" />
</filter>
</entity>
</fetch>
</fetchcollection>
<categorycollection>
<category>
<measurecollection>
<measure alias="aggregate_column" />
</measurecollection>
</category>
</categorycollection>
</datadefinition>
</datadescription>
<presentationdescription>
<Chart Palette="None" PaletteCustomColors="97,142,206; 209,98,96; 168,203,104; 142,116,178; 93,186,215; 255,155,83; 148,172,215; 217,148,147; 189,213,151; 173,158,196; 145,201,221; 255,180,138">
<Series>
<Series ShadowOffset="0" IsValueShownAsLabel="true" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PieLabelStyle=Inside, PieDrawingStyle=Default" ChartType="pie">
<SmartLabelStyle Enabled="True" />
</Series>
</Series>
<ChartAreas>
<ChartArea>
<Area3DStyle Enable3D="true" />
</ChartArea>
</ChartAreas>
<Legends>
<Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59" />
</Legends>
<Titles>
<Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0"></Title>
</Titles>
</Chart>
</presentationdescription>
<isdefault>false</isdefault>
</visualization>
Thanks.
The field you are referring to is called LegendText, and according to CRM Chart Guy the legend text on a pie chart cannot be changed (See "Stuff we unfortunately cannot do.." at the end of the article).
http://crmchartguy.wordpress.com/2014/03/13/all-things-pie-chart-in-dynamics-crm/

Resources