I'm having problems with persistence in EMF. The problem occurs when I add an element to a file that contains a map of elements. The process is:
Load file
Add element
Save file
The first time I add an element, it works fine. But if I try to add another, it reads
the list in twice before adding the new element. All subsequent uses also read the list twice.
EXAMPLE
I start with a file that looks like this:
<?xml version="1.0" encoding="ASCII"?>
<org.eclipse.mbt.core:CoreServicesResources xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:org.eclipse.mbt.core="http://org/eclipse/mbt/core">
<primaryResources>
<elementsMap key="1">
<value URI="1">
<traceabilityProperties traceable="true" derived="true" topLevel="true" />
<keywords tags="foo" />
</value>
</elementsMap>
</primaryResources>
</org.eclipse.mbt.core:CoreServicesResources>
If I add a new element, I end up with a file that looks like this, which is correct:
<?xml version="1.0" encoding="ASCII"?>
<org.eclipse.mbt.core:CoreServicesResources xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:org.eclipse.mbt.core="http://org/eclipse/mbt/core">
<primaryResources>
<elementsMap key="1">
<value URI="1">
<traceabilityProperties traceable="true" derived="true" topLevel="true"/>
<keywords tags="foo"/>
</value>
</elementsMap>
<elementsMap key="2">
<value URI="2">
<traceabilityProperties traceable="true" derived="true" topLevel="true"/>
<keywords tags="bar"/>
</value>
</elementsMap>
</primaryResources>
</org.eclipse.mbt.core:CoreServicesResources>
However, if I then add another element, I get this, which is incorrect:
<?xml version="1.0" encoding="ASCII"?>
<org.eclipse.mbt.core:CoreServicesResources xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:org.eclipse.mbt.core="http://org/eclipse/mbt/core">
<primaryResources>
<elementsMap key="1">
<value URI="1">
<traceabilityProperties traceable="true" derived="true" topLevel="true"/>
<keywords tags="foo"/>
</value>
</elementsMap>
<elementsMap key="2">
<value URI="2">
<traceabilityProperties traceable="true" derived="true" topLevel="true"/>
<keywords tags="bar"/>
</value>
</elementsMap>
<elementsMap key="1">
<value URI="1">
<traceabilityProperties traceable="true" derived="true" topLevel="true"/>
<keywords tags="bar"/>
</value>
</elementsMap>
<elementsMap key="2">
<value URI="2">
<traceabilityProperties traceable="true" derived="true" topLevel="true"/>
<keywords tags="foo"/>
</value>
</elementsMap>
<elementsMap key="3">
<value URI="3">
<traceabilityProperties traceable="true" derived="true" topLevel="true"/>
<keywords tags="bar"/>
</value>
</elementsMap>
</primaryResources>
</org.eclipse.mbt.core:CoreServicesResources>
When I debug the code, the problem seems to be happening somewhere in the parser. I'm using the Java SE-11 System library, and the parser is com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
Has anyone else had problems like this?
Related
I am working on this xml file stored in my AWS s3 bucket, I have to update the value tags in the ATTRIBUTES tag. Can any body help me that how can I travel to the value tags and update the values in them? I am using minidom module and this is fetched as a class-xml.dom.minidom.Document
<?xml version="1.0" encoding="utf-8"?>
<PPL DATE="11/03/2021 14:58:58" USER="XXXX" WORKSTATION="FFFFF">
<PPLScene>
<ATTRIBUTES>
<VALUE NAME="SoilDescription" TYPE="String">Compacted Earth</VALUE>
<VALUE NAME="Latitude" TYPE="Double">38.25858101</VALUE>
<VALUE NAME="Longitude" TYPE="Double">-122.04101444</VALUE>
<VALUE NAME="ElevationMetersAboveMSL" TYPE="Double">-28.8674275705822</VALUE>
<VALUE NAME="DescriptionOverride" TYPE="String" />
<VALUE NAME="Guid" TYPE="String">ab0b7bdf-ad4f-4548-be4e-f457e61e1b53</VALUE>
<VALUE NAME="TreeNodeExpanded" TYPE="Boolean">True</VALUE>
<VALUE NAME="SelectedLoadCase" TYPE="Int32">0</VALUE>
<VALUE NAME="PPLVersion" TYPE="Int32">602</VALUE>
<VALUE NAME="WorkingDataStore" TYPE="String" />
</ATTRIBUTES>
</PPLScene>
</PPL>
I am using the following python code but no luck...
import boto3
import requests
from xml.etree.ElementTree import XML, fromstring, parse
import xml.etree.ElementTree as ET
from xml.dom import minidom
s3 = boto3.client('s3')
def lambda_handler(event, context):
bucket = 'bucketname'
pplx_file_int = 'Pole.xml'
key = pplx_file_int
print(str(key))
obj = s3.get_object(Bucket = bucket, Key = key)
file_data = obj['Body'].read()
print(file_data)
xmldoc = minidom.parseString(file_data)
print(type(xmldoc))
print(xmldoc.nodeName)
print(xmldoc.firstChild.tagName)
procedureList = xmldoc.getElementsByTagName('PPLChildElements')
for procElement in procedureList:
ListOfData2 = procElement.getElementsByTagName('WoodPole')
for attributes in ListOfData2:
element_1 = procElement.getElementsByTagName('ATTRIBUTES')
print(element_1)
Would recommend using parsel:
pip install parsel
Makes css and xpath convenient to use mate!
from parsel import Selector
sel = Selector(text=u"""
<PPL DATE="11/03/2021 14:58:58" USER="XXXX" WORKSTATION="FFFFF">
<PPLScene>
<ATTRIBUTES>
<VALUE NAME="SoilDescription" TYPE="String">Compacted Earth</VALUE>
<VALUE NAME="Latitude" TYPE="Double">38.25858101</VALUE>
<VALUE NAME="Longitude" TYPE="Double">-122.04101444</VALUE>
<VALUE NAME="ElevationMetersAboveMSL" TYPE="Double">-28.8674275705822</VALUE>
<VALUE NAME="DescriptionOverride" TYPE="String" />
<VALUE NAME="Guid" TYPE="String">ab0b7bdf-ad4f-4548-be4e-f457e61e1b53</VALUE>
<VALUE NAME="TreeNodeExpanded" TYPE="Boolean">True</VALUE>
<VALUE NAME="SelectedLoadCase" TYPE="Int32">0</VALUE>
<VALUE NAME="PPLVersion" TYPE="Int32">602</VALUE>
<VALUE NAME="WorkingDataStore" TYPE="String" />
</ATTRIBUTES>
</PPLScene>
</PPL>""")
print("===============Text Fields==================")
for name_attr in sel.css('PPL PPLScene ATTRIBUTES VALUE'):
print(name_attr.css("::text").get()) # Text
print("===============Atttributes==================")
for name_attr in sel.css('PPL PPLScene ATTRIBUTES > VALUE'):
if ('name' in name_attr.attrib ):
print(name_attr.attrib['name']) # Text
I'm stuck trying to find some data in a Sharepoint list.
I have the list ID, using the List Service "GetList" method I can see that the field I'm looking for is attached to the list. When I try to use "GetListItems" the field isn't there.
I've been assuming that it means the field I want isn't in the default view, but even when I define the view fields explicitly or change the query, I still can't find the data. What should I do?
Here are some of the attempts I've made, none show the fields I'm looking for.
Method 1:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<viewFields>
<FieldRef Name="_ows_Title"/>
<FieldRef Name="_ows_Project_x0020_Description"/>
<FieldRef Name="_ows_Style_x0020_number_x0020_quantit"/>
<FieldRef Name="_ows_Requirement"/>
<FieldRef Name="_ows_First_x0020_order_x0020_entry_x0"/>
<FieldRef Name="_ows_MKT_x0020__x0025__x0020_Completi"/>
<FieldRef Name="_ows_MFG_x0020__x0025_Completion"/>
</viewFields>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
Method 2:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<viewFields>
<FieldRef Name="Title"/>
<FieldRef Name="Project_x0020_Description"/>
<FieldRef Name="Style_x0020_number_x0020_quantit"/>
<FieldRef Name="Requirement"/>
<FieldRef Name="First_x0020_order_x0020_entry_x0"/>
<FieldRef Name="MKT_x0020__x0025__x0020_Completi"/>
<FieldRef Name="MFG_x0020__x0025_Completion"/>
</viewFields>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
Method 3:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<Query>
<Where>
<Gt>
<FieldRef Name="ID"/>
<Value Type="Counter">0</Value>
</Gt>
</Where>
</Query>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
All three methods list all fields in the default view (ignoring my filters/query) but correctly limited to 10 results.
Your examples appear to be missing the outer <{namespace}:viewFields> node defined by the "http://schemas.microsoft.com/sharepoint/soap/" schema. (That or they're missing the inner <ViewFields> node in the body of the parameter.)
The name properties of the FieldRef nodes should be the internal names of the columns.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<ns1:viewFields>
<ViewFields>
<FieldRef Name="Title"/>
<FieldRef Name="Project_x0020_Description"/>
<FieldRef Name="Style_x0020_number_x0020_quantit"/>
<FieldRef Name="Requirement"/>
<FieldRef Name="First_x0020_order_x0020_entry_x0"/>
<FieldRef Name="MKT_x0020__x0025__x0020_Completi"/>
<FieldRef Name="MFG_x0020__x0025_Completion"/>
</ViewFields>
</ns1:viewFields>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
Note that the response will include system columns (such as Title, ID, and Created/Modified) in the results, even if you didn't specify them in the ViewFields.
In my custom SharePoint 2010 site definition:
I have a custom list instance in my site definition with multiple views...
I have a page that I want to display one of the views on...
In the page's Elements.xml definition, where can I select to show either the "Correspondence" or "Accounting" views shown in the list instance's Schema.xml below?
XML has been cleaned up for simplicity of reading.
List Instance's Schema.xml
<List Title="Client Documents" Direction="none" Url="Client Documents" BaseType="1" Type="101" BrowserFileHandling="Permissive" EnableContentTypes="TRUE" DisableAttachments="TRUE" Catalog="FALSE" VersioningEnabled="TRUE" SendToLocation="|" ImageUrl="/_layouts/images/itdl.png" xmlns:ows="Microsoft SharePoint" xmlns:spctf="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>...</ContentTypes>
<Fields>...</Fields>
<Forms />
<Views>
...
<View DisplayName="CORE Client - Accounting" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/dlicon.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="Forms/CORE Client Accounting.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<Where>
<Eq>
<FieldRef Name="ContentType" />
<Value Type="Computed">Client - Accounting</Value>
</Eq>
</Where>
</Query>
<ViewFields>...</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
<View DisplayName="CORE Client - Correspondence" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/dlicon.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="Forms/CORE Client Correspondence.aspx" SetupPath="pages\viewpage.aspx">
<XslLink>main.xsl</XslLink>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Client_x0020_Correspondence_x0020_Type" />
</GroupBy>
<Where>
<Eq>
<FieldRef Name="ContentType" />
<Value Type="Computed">Client - Correspondence</Value>
</Eq>
</Where>
</Query>
<ViewFields>...</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
...
</Views>
</MetaData>
</List>
Module's Elements.xml
<File Url="ClientDocumentsCorrespondence.aspx" Path="default.aspx" Type="GhostableInLibrary" >
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/PLClientDocuments.aspx" />
<Property Name="Title" Value="GASOP Client Documents - Correspondence" />
<Property Name="ContentType" Value="Welcome Page" />
<AllUsersWebPart WebPartOrder="0" WebPartZoneID="zone1">...</AllUsersWebPart>
<AllUsersWebPart WebPartOrder="1" WebPartZoneID="zone1">...</AllUsersWebPart>
<View List="Client Documents"
DisplayName=""
Url=""
DefaultView="FALSE"
BaseViewID="1"
Type="HTML"
WebPartOrder="0"
WebPartZoneID="zone2"
ContentTypeID="0x"
ID="g_4d8c86ec_b324_4f6a_a2e9_ba1a36466c68"
Hidden="TRUE">
<![CDATA[<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>...</properties>
</data>
</webPart>
</webParts>]]>
</View>
</File>
its seem to on schema.xml you have creating two views but both have same BaseViewID. you must be unique BaseViewID for each view. 1 is the ID of the AllItems view(Default View).
Refer to this post: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/52e45ddd-73a8-400f-890c-323a0eaaeccb
copy-paste default view and giv unique Id of BaseViewID.
than on your Module's Elements.xml
<View List="Lists/Client Documents" BaseViewID="<<Your View Unique ID>>" DisplayName="Client Documents" Name="Client Documents" RecurrenceRowset="TRUE" WebPartZoneID="Main" WebPartOrder="0">
<![CDATA[
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Title">Invoice Approved</property>
<property name="AllowConnect" type="bool">True</property>
<property name="AllowClose" type="bool">False</property>
</properties>
</data>
</webPart>
</webParts>
]]>
</View>
Please read for more details : http://blog.qumsieh.ca/2010/09/01/sharepoint-2010-schema-xml-onet-xml-and-toolbar-type/
Although I specify a ViewFields element in my sharepoint list service's GetListItems query, all fields are returned. The following code builds the request:
XmlDocument xmlDoc = new System.Xml.XmlDocument();
XmlNode query = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
XmlNode viewFields = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");
XmlNode queryOptions = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
... set query ...
viewFields.InnerXml = "<FieldRef Name='LinkFilename' /><FieldRef Name='FileDirRef' /><FieldRef Name='FileLeafRef' />";
queryOptions.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><DateInUtc>TRUE</DateInUtc><Folder>Resource Management Tools</Folder><ViewAttributes Scope='Recursive' />";
XmlNode xmlNode = SharePointListWebService.GetListItems(
_listServiceConfigurationSettings.ListName,
string.Empty,
query,
viewFields,
null,
queryOptions,
null);
According to fiddler, this results in the following soap envelope being posted to the list service:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>Shared Documents</listName>
<viewName />
<query>
<Query xmlns="">
<Where>
<And>
<Contains>
<FieldRef Name="FileLeafRef" />
<Value Type="Text">.xls</Value>
</Contains>
<Geq>
<FieldRef Name="Modified"
IncludeTimeValue="True" />
<Value Type="DateTime">2010-05-10T11:53:32Z</Value>
</Geq>
</And>
</Where>
<OrderBy>
<FieldRef Name="FileDirRef" />
</OrderBy>
</Query>
</query>
<viewFields>
<ViewFields xmlns="">
<FieldRef Name="LinkFilename" />
<FieldRef Name="FileDirRef" />
<FieldRef Name="FileLeafRef" />
</ViewFields>
</viewFields>
<queryOptions>
<QueryOptions xmlns="">
<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>
<DateInUtc>TRUE</DateInUtc>
<Folder>Resource Management Tools</Folder>
<ViewAttributes Scope="Recursive" />
</QueryOptions>
</queryOptions>
</GetListItems>
</soap:Body>
</soap:Envelope>
and the following soap response being returned from the service:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<GetListItemsResult>
<listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<rs:data ItemCount="19">
<z:row ows_LinkFilename='[SENSITIVE DATA].xls'
ows_FileDirRef='278;#sites[SENSITIVE DATA]'
ows_FileLeafRef='278;#[SENSITIVE DATA].xls'
ows_MetaInfo='278;#Subject:SW| vti_parserversion:SR|12.0.0.6421 ContentTypeId:SW|0x0101006C2E647253A1074FB6079F08E5F2A395 _Author:SW|[SENSITIVE DATA] _Category:SW| vti_author:SR|[SENSITIVE DATA] _Comments:SW| vti_approvallevel:SR| vti_categories:VW| vti_cachedcustomprops:VX|vti_approvallevel vti_categories Subject vti_assignedto Keywords _Author _Category _Comments vti_assignedto:SR| Keywords:SW| vti_modifiedby:SR|[SENSITIVE DATA]'
ows__ModerationStatus='0' ows__Level='1'
ows_Last_x0020_Modified='278;#2010-06-29T18:55:38Z'
ows_ID='278' ows_owshiddenversion='53'
ows_UniqueId='278;#{0E51B2B1-89A7-4895-8ECC-0FE7D420470C}'
ows_FSObjType='278;#0'
ows_Created_x0020_Date='278;#2009-03-09T16:06:41Z'
ows_ProgId='278;#' ows_Modified='2010-06-29T18:55:37Z'
ows_FileRef='278;#sites[SENSITIVE DATA].xls'
ows_DocIcon='xls'
ows_Editor='262;#[SENSITIVE DATA]' />
</rs:data>
</listitems>
</GetListItemsResult>
</GetListItemsResponse>
</soap:Body>
</soap:Envelope>
Notice the z:row element has more fields included than I specified in my ViewFields criteria. I also set IncludeMandatoryColumns to false in my query options. Did I do something wrong or do I not understand how ViewFields really works as I thought it would limit the fields i.e. z:row attributes returned by the SharePoint list service.
I've been struggling with this issue, too. Tonight I found a solution that seems to work for me...hopefully it's helpful for others, as well.
The structure of your viewFields node is fine...
<viewFields>
<ViewFields xmlns="">
<FieldRef Name="LinkFilename" />
<FieldRef Name="FileDirRef" />
<FieldRef Name="FileLeafRef" />
</ViewFields>
</viewFields>
The problem is likely your field names. Apparently you have to use the internal names rather than the display names. One quick & easy way to determine the internal names is to go to the List Settings page for your list and hover over each column in the list. The browser's status bar will show a URL similar to this..
http://YOUR_SITE/_layouts/FldEdit.aspx?List=%7B12345678%2D1234%2D1234%2D1234%2D123456789012%7D&Field=INTERNAL_FIELD_NAME
Use the internal field name shown there for each of the fields you want to return from the GetListItems() service. For example,
<FieldRef Name="LinkFilename" />
....might need to be written as...
<FieldRef Name="Link_x0020_Filename" />
At least that's what it took to solve the problem for me. Hope that helps!
There is a ViewFieldsOnly property for the purpose (I've not experimented with it though).
When you specify fields by setting the ViewFields property, the query retrieves data for more than just those fields. To optimize performance, you can limit the data that is returned by the query by setting the ViewFieldsOnly property to true.
Without doing any of my own research, tt looks like you're generating the following XML node:
<viewFields>
<ViewFields xmlns="">
<FieldRef Name="LinkFilename" />
<FieldRef Name="FileDirRef" />
<FieldRef Name="FileLeafRef" />
</ViewFields>
</viewFields>
Do you mean to have your ViewFields element embedded in another viewFields element?
The ReSharper reformat code feature is very handy and flexible, particularly with the new code layout templating flexibility JetBrains have added in version 3.0.
Is there a standard set of code style settings for ReSharper which match the rules enforced by Microsoft StyleCop, so that StyleCop compliance can be as easy as running the ReSharper "reformat code" feature?
Try the ReSharper StyleCop plugin at: http://www.codeplex.com/StyleCopForReSharper
I am looking for the same things.
Here is a Custom Type member layout:
<?xml version="1.0" encoding="utf-8"?>
<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">
<!--Do not reorder COM interfaces and structs marked by
StructLayout attribute-->
<Pattern>
<Match>
<Or Weight="100">
<And>
<Kind Is="interface"/>
<HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/>
</And>
<HasAttribute CLRName="System.Runtime.InteropServices.StructLayoutAttribute"/>
</Or>
</Match>
</Pattern>
<!--Special formatting of NUnit test fixture-->
<Pattern RemoveAllRegions="true">
<Match>
<And Weight="100">
<Kind Is="class"/>
<HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute"
Inherit="true"/>
</And>
</Match>
<!--Setup/Teardow-->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Or>
<HasAttribute CLRName="NUnit.Framework.SetUpAttribute"
Inherit="true"/>
<HasAttribute CLRName="NUnit.Framework.TearDownAttribute"
Inherit="true"/>
<HasAttribute CLRName="NUnit.Framework.FixtureSetUpAttribute"
Inherit="true"/>
<HasAttribute CLRName="NUnit.Framework.FixtureTearDownAttribute"
Inherit="true"/>
</Or>
</And>
</Match>
<Group Region="Setup/Teardown"/>
</Entry>
<!--All other members-->
<Entry/>
<!--Test methods-->
<Entry>
<Match>
<And Weight="100">
<Kind Is="method"/>
<HasAttribute CLRName="NUnit.Framework.TestAttribute"
Inherit="false"/>
</And>
</Match>
<Sort>
<Name/>
</Sort>
</Entry>
</Pattern>
<!--Default pattern-->
<Pattern>
<!--public delegate-->
<Entry>
<Match>
<And Weight="100">
<Access Is="public"/>
<Kind Is="delegate"/>
</And>
</Match>
<Sort>
<Name/>
</Sort>
<Group Region="Delegates"/>
</Entry>
<!--public enum-->
<Entry>
<Match>
<And Weight="100">
<Access Is="public"/>
<Kind Is="enum"/>
</And>
</Match>
<Sort>
<Name/>
</Sort>
<Group>
<Name Region="${Name} enum"/>
</Group>
</Entry>
<!--fields and constants-->
<Entry>
<Match>
<Or>
<Kind Is="constant"/>
<Kind Is="field"/>
</Or>
</Match>
<Sort>
<Kind Order="constant field"/>
<Readonly/>
<Static/>
<Name/>
</Sort>
<Group Region="Fields"/>
</Entry>
<!-- Events-->
<Entry>
<Match>
<Kind Is="event"/>
</Match>
<Sort>
<Name/>
</Sort>
<Group Region="Events"/>
</Entry>
<!--Constructors. Place static one first-->
<Entry>
<Match>
<Kind Is="constructor"/>
</Match>
<Sort>
<Static/>
</Sort>
<Group Region="Constructors"/>
</Entry>
<!--properties, indexers-->
<Entry>
<Match>
<Or>
<Kind Is="property"/>
<Kind Is="indexer"/>
</Or>
</Match>
<Sort>
<Name/>
</Sort>
<Group Region="Properties"/>
</Entry>
<!--interface implementations-->
<Entry>
<Match>
<And Weight="100">
<Kind Is="member"/>
<ImplementsInterface/>
</And>
</Match>
<Sort>
<ImplementsInterface Immediate="true"/>
<Kind Order="property"/>
<Name/>
</Sort>
<Group>
<ImplementsInterface Immediate="true"
Region="${ImplementsInterface} Members"/>
</Group>
</Entry>
<!-- public Methods -->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Access Is="public"/>
</And>
</Match>
<Sort>
<Static/>
<Name/>
</Sort>
<Group>
</Group>
</Entry>
<!-- internal Methods -->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Access Is="internal"/>
</And>
</Match>
<Sort>
<Static/>
<Name/>
</Sort>
<Group>
</Group>
</Entry>
<!--protected internal Methods -->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Access Is="protected-internal"/>
</And>
</Match>
<Sort>
<Static/>
<Name/>
</Sort>
<Group>
</Group>
</Entry>
<!-- protected Methods -->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Access Is="protected"/>
</And>
</Match>
<Sort>
<Static/>
<Name/>
</Sort>
<Group>
</Group>
</Entry>
<!-- private Methods -->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Access Is="private"/>
</And>
</Match>
<Sort>
<Static/>
<Name/>
</Sort>
<Group>
</Group>
</Entry>
<!--all other members-->
<Entry/>
<!--nested types-->
<Entry>
<Match>
<Kind Is="type"/>
</Match>
<Sort>
<Name/>
</Sort>
<Group>
<Name Region="Nested type: ${Name}"/>
</Group>
</Entry>
</Pattern>
</Patterns>
<!--
I. Overall
I.1 Each pattern can have <Match>....</Match> element. For the given type
declaration, the pattern with the match, evaluated to 'true' with the
largest weight, will be used
I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements.
Type member declarations are distributed between entries
I.3 If pattern has RemoveAllRegions="true" attribute, then all regions
will be cleared prior to reordering. Otherwise, only auto-generated
regions will be cleared
I.4 The contents of each entry is sorted by given keys (First key is
primary, next key is secondary, etc). Then the declarations are
grouped and en-regioned by given property
II. Available match operands
Each operand may have Weight="..." attribute. This weight will be added
to the match weight if the operand is evaluated to 'true'.The default
weight is 1
II.1 Boolean functions:
II.1.1 <And>....</And>
II.1.2 <Or>....</Or>
II.1.3 <Not>....</Not>
II.2 Operands
II.2.1 <Kind Is="..."/>. Kinds are: class, struct, interface, enum,
delegate, type, constructor, destructor, property, indexer, method,
operator, field, constant, event, member
II.2.2 <Name Is="..." [IgnoreCase="true/false"] />. The 'Is' attribute
contains regular expression
II.2.3 <HasAttribute CLRName="..." [Inherit="true/false"] />. The 'CLRName'
attribute contains regular expression
II.2.4 <Access Is="..."/>. The 'Is' values are: public, protected, internal,
protected internal, private
II.2.5 <Static/>
II.2.6 <Abstract/>
II.2.7 <Virtual/>
II.2.8 <Override/>
II.2.9 <Sealed/>
II.2.10 <Readonly/>
II.2.11 <ImplementsInterface CLRName="..."/>. The 'CLRName' attribute
contains regular expression
II.2.12 <HandlesEvent />
-->
based on this one, that did not do the trick for me but who deserves the credit: http://www.clydesdalesoftware.net/blogs/jluif/CommentView,guid,1875594b-0d23-401f-8e22-f1cbf87beefe.aspx
This is a header snippet that complies to stylecop:
// <copyright file="$FileName$" company="$Company$">
// Copyright (c) 2008 All Right Reserved
// </copyright>
// <author>$author$</author>
// <email>$email$</email>
// <date>$date$</date>
// <summary>$summary$</summary>
Still not quite there but it is a start.
Since this answer the Custom type member layout has been put in the StyleCop for resharper plugin. See here