XACML2 Schema Generation Error for .NET - Cannot use wildcards at the top level of a schema - code-generation

Has anyone been able to successfully generate C# entity classes from XACML2 schema files? I am getting "Cannot use wildcards at the top level of a schema." I think this has something to do with xs:any elements. I have tried change the processContents="skip" (from "lax") but to no avail. I get this using WSCF Blue as well as xsd.exe.

Works perfectly for me using the version of xsd.exe that ships w/ VS 2010.

I have no problems running the Xacml3 schema through VS2010 XSD.exe, but I do see this "Cannot use wildcards at the top level of a schema" error when trying to process the Xacml2 schema with XSD.
XSD processes the Xacml2 Policy schema with no errors.
XSD reports this wildcard error when processing the Xacml2 Context schema.
The issue appears to be the combination of ##any and mixed="true" in the xacml-context:AttributeValueType schema definition. Other definitions of AttributeValueType in Xacml2 Policy schema and Xacml3 use an xs:complexContent wrapper around an ExpressionType extension, which in turn contains xs:any and xs:anyAttribute definitions. The Xacml2 context:AttributeValueType does not contain this wrapper.
Solution: Remove mixed="true" from the Xacml2 xacml-context:AttributeValueType definition and XSD will generate the correct class types for the schema. The generated AttributeValueType class will have properties for a list of elements and a list of attributes, which covers all the bases.

Related

org.dozer.MappingException: No read or write method found for field

org.dozer.MappingException: No read or write method found for field
(tarShipMethodCode.lmCourier.courierName) in class (class
com.essilor.ong.domain.inventory.POLocationEntity)
I am getting this error when i build my war file and try to run Tomcat.
I am using JPA and dozer mapping.
Can anyone tell me how to fix it?
Check your Beans and your Dozer-Mapping-File.
There are multiple (more or less common) errors possible:
Typo in the mappingfile. Check the package and field names in your POLocationEntity, does it have a field named tarShipMethodCode, and does this have an ImCourier field, and this a courierName field?
Lack of getters / setters. Again check the beans, Dozer usually expects getFieldName and setFieldName methods, unless you specified others (which I do not assume, maybe post your mapping file).
Narrow the problem down: Is this the only field that is not working? Or is this field not specified at all? Dozer tends to try to map-by-name fields that do not have corresponding entries in the mapping file, which could lead to unexpected errors.
tl;dr
With some more information (mapping xml, bean code) this would be easier to analize, but the above pointers are the ones that solve these kinds of problems in my experience.

Howto customize pluralisation for Entity Framework 5

As my database was designed using german table- and column names, the default pluralisation feature of entity framework doesn't work for me.
I have found a couple of resources where this is discussed, but none of them seem to work.
What i have found:
There is the PluralisationService where i can add the mappings:
PluralizationService pluralizer =
PluralizationService.CreateService(CultureInfo.GetCultureInfo("en-us"));
ICustomPluralizationMapping mapping = ps as ICustomPluralizationMapping;
mapping.AddWord("Tabelle", "Tabellen");
But what's next?
I have tried to:
EntityModelSchemaGenerator generator = new EntityModelSchemaGenerator(container);
generator.PluralizationService = pluralizer;
generator.GenerateMetadata();
and put both of them in my POCO T4 Template. But it throwed the following exception:
The EntityContainer 'ContainerName' is not a store EntityContainer. Parameter name: storeEntityContainer
at System.Data.Entity.Design.EntityModelSchemaGenerator.Initialize(...)
at Microsoft.VisualStudio.TextTemplating...GeneratedTextTransformation.TransformText()
To completely customize the table names in EF Code First, you can use the Table attribute to explicitly specify the name of the table associated with a class:
[Table("InternalBlogs")]
public class Blog
{
//...
}
I'm also looking for the same thing. Maybe this can help. I'm just not willing to pay for such a basic feature.
EDIT:
The code you posted is to be used with EdmGen2 wich will give you CSDL, SSDL or MSL files pluralized according to your class.
A very old question, but if someone is still looking for a possible workflow/solution:
I had a similar problem where I wanted to customize the schema import (CSDL) from the database. The solution / workflow was as follows:
Deployed the database schema (I used Visual Studio Database Project VS 201x) to a
local database
Imported the database model using EDMGEN to create the CSDL, SSDL and MSDL files
http://msdn.microsoft.com/en-us/library/vstudio/bb387165(v=vs.110).aspx
Modified EDMGEN2 with my changes on how to handle pluralization and naming with custom rules and created EDMX file
Ran the T4 templates (with additional customization as needed) to create
output.

Ignoring some elements/classes in JAXB binding

I use Hyperjaxb to generate some classes with JPA annotations from XML schemas. I'd like to specify which elements from given schema xjc should generate. I can't change xsd file. I can modify only bindings.xjb. I tried to use hj:ignored, but without success.
Well, hj:ignored is the answer. It allows you to make Hyperjaxb ignore certain classes.
Here's an example:
<jaxb:bindings
node="xsd:complexType[#name='issue121Type']//xsd:element[#name='simpleCollection']">
<hj:ignored/>
</jaxb:bindings>
Customizations work in schema as well as via xjb files.
See this project for instance.
How does "without success" reveal itself?

XML schema for Eclipse target definition files

Where can I find the XML schema and/or documentation for Eclipse target definition files (*.target)?
May be this schema might fit the target files created for an RCP platform.
Part of that schema file is visible in the Eclipse help page.
There is no schema or documentation defining the structure of a target definition file (.target). This is because the file structure is not intended to be API (it may change between release).
The structure has changed several times already. The code used to serialize/deserialize the file can be found in the following classes:
org.eclipse.pde.internal.core.target.TargetDefinitionPersistenceHelper
org.eclipse.pde.internal.core.target.TargetPersistence38Helper
org.eclipse.pde.internal.core.target.TargetPersistence36Helper
org.eclipse.pde.internal.core.target.TargetPersistence35Helper
org.eclipse.pde.internal.core.target.TargetPersistence34Helper

CA: Suppress results from generated code not working in VS2010 beta 2

I'm trying to run codeanalysis on an assembly that contains an entity model (edmx file). In project properties I have checked the "Suppress results from generated code" option, but I am still getting a lot of CA errors pertaining to the auto-generated EF code.
Has anyone experienced this? And is there a work-around?
Just put the attribute on your class definition.
But how to do it, since your file can get overridden any time. Use a separate file, since all generated classes are partial classes. Open a separate file, and write something like:
[GeneratedCode("EntityModelCodeGenerator", "4.0.0.0")]
public partial class YourEntitiesContextName : ObjectContext
{
}
This will skip code analysis on your particular generated class. StyleCop for instance is more smart and doesn't touch files that have .designer/.generated part in their name or regions that have generated word in their name.
Well, "Suppress results from generated code" really means "Don't look at types with GeneratedCodeAttribute". EF's code generator hasn't added this, historically (though I've suggested it to the team). But you can add it if you use custom T4.