Answer 1
I assume you're talking about provisioning a custom site definition, and the onet.xml you're referring to is your own site definition file? I also assume you're trying to add the web part to a page you're provisioning in the site definition? If this is the
case you should do the following:
1) avoid, if possible, adding stuff to onet.xml - it's a throwback from the olden days. Create a feature for the module, then create another feature to 'staple' the first feature to the site definition. Chris O'Brien's blogs are always very clear and concise
- try this one out
http://www.sharepointnutsandbolts.com/2007/05/feature-stapling.html
2) if you're wanting to drop a View of a list or library onto a web part page then put something like this under the <File> element:
<ViewList="Path/To/Shared Documents"Name="Shared Documents"BaseViewID="1"WebPartZoneID="Left"ShowHeaderUI="TRUE"/>
To add a web part on a page you'll need this kind of thing:
<AllUsersWebPartWebPartZoneID="Top"WebPartOrder="1"><![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.UserDocsWebPart</TypeName>
<Title>Relevant Documents</Title>
<Description>Displays documents that are relevant to the current user.</Description>
<PartImageLarge>/_layouts/images/msusdocs.gif</PartImageLarge>
</WebPart>
]]></AllUsersWebPart>The code that goes inside your <![CDATA[...]]> you can find by navigating to Site Settings (Top level) > Web Part Gallery, click the Edit link on your desired web part, then click 'Export' to get the .dwp or .webpart file. Copy the xml from there
into your CDATA in your AllUsersWebPart element. I've only tried this with .dwp files, and I'm assuming that it works with .webpart files too - check out
Corey Roth's blog post about the different formats.
I've made a lot of assumptions about your question - could be making an ____ out of you and mption, let me know if I've got the wrong end of the stick!