.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Crawl XML files and map node values to properties

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :SharePoint

How can I crawl XML files and map node values to properties?


For example I have a node called "PostedDate" and want to query all xml files with a specific posted date. Is this possible in MOSS out-of-the box? Do I have to write an extension in c#?


Any help would be very appreciated !! Thanks.



View Complete Post

More Related Resource Links

reading values from config files in NUnit tests


One of my NUnit tests has to read in some values from config files.  In my main application this process works perfectly well, however when I run the unit test, the code that reads in the values from the config files doesnt read anything in.  Ive tried putting app.config in my unit test project (I even tried web.config) but nothing seems to work.  Are there any special steps involved when reading from config files in an nunit test ?

Node probability distibution - values don't sum to 1?

Hi, I am using sequence clustering algorithm and I have checked Node probability distribution (state transition) for one of the cluster. Probability values don't sum to 1. Why? I think they should. Do I miss something?

SharePoint crawl errors on files which are not present

All, I'm noticing 2 errors in my crawl logs. Neither of the files exist anywhere on our site. The URLs are http://.../forms/repair.aspx and http://.../forms/combine.aspx and the error message is 'Error in the Microsoft Windows SharePoint Services Protocol Handler'. Our crawl normally takes about 3 and a half hours. Recently, it's been taking 5-6 hours. These 2 errors are logged at the end of the crawl. While the crawl is running, I see the success count growing and at about 3 and a half hours into the process, the success count stops growing. I'm not sure what the crawl is doing for the next 2 or so hours, but if finally logs the 2 errors mentioned earlier at the end of the crawl, then completes. I have tried resetting the crawled content and changing the index location of the SSP, but neither have worked.  I have also tried excluding the path to these two files with crawl rules, but that hasn't worked. I am on SharePoint 2007 SP2. Any ideas? Thanks

Treeview node to add onclick event to download files

 Hi, I would like to know how to add onclick evend to a TreeNode so that the file can be downloaded.   How can I implement below sample code to a TreeNode? <a href="#" onclick="popup('/directory1/Somefile.doc'); return false;" target="download"> Somefile </a> <script language="javascript"> function popup(url) { popWin = window.parent.open(url, 'popWindow', 'height=900, width=900, toolbar=no, menubar=yes, scrollbars=yes, titlebar=no, resizable=yes,location=0, directories=no, status=no'); } </script> I have TreeNodePopulate event to populate nodes like this: protected void DocRepository_TreeNodePopulate(object sender, TreeNodeEventArgs e) { .... String[] files = Directory.GetFiles(fullPath); foreach(String file in files) { TreeNode newNode  = new TreeNode(Path.GetFileName(file), Path.GetFileName(file)); node.ChildNodes.Add(newNode); } }   Thank you in advance.              

Assign values to base class properties


In my controller have a FormViewModel which inherits from a domain class declared in dbml.  In the constructor of the FormViewModel I want to do a shorthand assignment to the inherited class properties with the passed in object (ie thisPerson) without iterating through each property of the inherited class and assigning its value with corresponding property in the passing in object. Should I use super, base, this, or something else?

public MyFormViewModel: Person
  public SelectList Cities {get; private set;}
  public SelectList State {get; private set;}

  public MyFormViewModel(){}

  public MyFormViewModel(Person thisPerson) 

        this = thisPerson; 
     //or super = thisPerson;
     //base = thisPerson;


List Properties Supporting Files Display item form won't stay set


In Sharepoint designer I am trying to set a custom display form for a list, following the instructions in the Sharepoint designer help.


I've got a functional display form, called DispForm3.aspx. I know it works since I tested it by replacing the form name in the normal URL where a display form is opened.


However I can not get the list to accept this new form as the display item form.


In Sharepoint Designer, in the List Properties Supporting Files tab I set the Display item form to be DispForm3.aspx and press OK. When I look again I see that the Display item for is DispForm.aspx.


This happens on any list that I try to customise the display form for, even new ones.


Sharepoint designer is allowing me to set the display item form to DispForm3.aspx but is not saving it, or is failing silently when it tries to save it.


Any assistance appreciated.


SPSWC:ProfilePropertyValue and multiple values user properties


Hi, I'm trying to customize the profile.aspx page in My Profile (SP 2010). All works fine except for the fact that I can't see the values of the user properties configured as multiple-value fields.

I'm using spswc:ProfilePropertyValue and what I get is a list of value separator (comma or semicolon, as configured in the user property) without values.

Do you know how to display multiple value user properties?

Thank you

Unable to change autogrowth properties of SQL Server 2008 data and log files


I have used the GUI and the CLI to attempt to change SQL Server 2008 log file autogrowth property all to NO avail. In other words, there are NO error messages of any kind, indeed the CLI reports that the command completed successfully. But re-examining the database properties shows that NO change was effected.

For the CLI command, I have used the following with dots filled in for my database and logfile:


Why doesn't this work? How to make it work?


Reading inner node values of xml


I have an xml file in the below format.

<?xml version="1.0" encoding="utf-8"?>
<Control ID="Title" Editable="true" UserControlName="Title.ascx"  Visible="true" Enabled="true" ></Control>
<Control ID="Edit"  Editable="true" UserControlName="Edit.ascx"  Visible="true" Enabled="true"></Control>

I need to loop through each element and get the value.

Using XmlTextReader iam able to do that but  If the tag name is <Control> then i need to get values for ID,Editable,UserControlName,Visible etc.. after that again read node values only  if the node is <Content> it should read all the attribute values for  that <Content>.

Please help me out

Determine node type selected in TreeView and reading property values


I am hoping that someone can help me get past some problems I am having when using the WPF TreeView control.  I have a TreeView that at most can have 3 levels.  The levels are defined as Project, Discipline, Person which would look like the following:

+ Project

    + Discipline

        - Person

My TreeView is bound to a database using two HierarchicalDataTemplate's and then one DataTemplate (the binding is done in the XAML).

What I would like to get is the following information when selecting an item:

  1. Read the selected value (text of the selected node)
  2. passing values to object properties of action method parameter


    I have an action method that accepts a single parm.

    That parm is an object with multiple properties. MVC correctly maps values from the querystring
    to properties in the parm object by matching property name to querystring value name. 
    Problem is, properties in the action method parm object which are themselves objects with
    properties, are not assigned their matching values from the querystring. The class object has a
    constructor which accepts a single string parameter.

    How do I assign to properties of an action method parameter which are themselves class objects?



                    <%: Html.ActionLink("Edit", "ProductMasterEdit", 
                           new { ProdKey=item.ProductKey.Value, 
                           ProductKey = item.ProductKey.Value })%> 
        public ViewResult ProductMasterEdit(ProductMaster Item)
      public partial class ProductMaster
        public ProductKey ProductKey
          get { return new ProductKey(this.ProdKey); }
          set { this.ProdKey = value.Value; }


workflow triggered during upload but after the user enters values in the properties dialog


1) When "Start this workflow when a new item is created" option is selected the workflow gets triggered as soon as the file is uploaded and even before the 'edit properties' dialog is displayed.  I want the workflow to be triggered after the properties are entered by the user on upload.


2) Selecting "Start this workflow when an item is changed." option also does not trigger the workflow during upload.  This triggers only when the user explicitly selects 'Edit Properties' dialog.


So my question is, how to get the workflow triggered during upload but after the user enters values in the prop

List Properties > Supporting Files?


I don't understand one of the fields/drop lists I am seeing on the Supporting Files tab.  It is the second one down  "Content type specific forms:",  then the drop down list has Folder and the the name of my Content Type used for that list.  I know that selecting the correct one is important in selecting a new edit item form because my edit form select doesn't "take" if I select the Contenty Type one. 

Also, in case they are related, in my list when the new Item button is clicked, the user is presented with creating New ContentType Name.  Why is that? Why isn't it a new item?

There are no mistakes; every result tells you something of value about what your are trying to accomplish.

Unique values for properties?



I need a way to create unique values for a property in my custom server control..

In this case I will have the poroperty called "Name" and I neeed the value of Name to be unique for each "instance" of the control...

So for instance if I have a page with more then one instance of the control, I dont want the value of the Name property for these instances to be allowed to be the same..

...to put it kind of simple, if I dont remember this incorrect, I want it to be sort of like the ID property..but with another name then ID..

Anyone has any idea how to do this?

Thanks in advance!

Class Properties Not Reflecting Their Changed Values


 I am using a class to track if a user cleared their personal information found within some text boxes on a form. In the button click event to clear the text boxes I am creating a new object to the class and assigning true to one property value. Sounds simple until I try and submit the form with a different button, and create a another object reference that I use in an IF statement to check the property value for true. Every time the statement fails because the value being returned from the getter in my class is false.

This is the class:

Public Class FormStateClass
    'property holds true or false 
    'based on if the user clears the populated form values.
    'True = Form was cleared
    'False = Form was not cleared

    Private _test As Boolean
    Public Property FormState As Boolean
            Return _test
        End Get
        Set(ByVal value As Boolean)
            _test = value
        End Set
    End Property

End Class

This is the code I am using to set the property to true:

Dim thisForm = New FormStateClass With {.FormState = True}

I've also tried these statements:

Retrieve values of all instances of a node


Suppose i have xml variable with value,
DECLARE @t xml
SET @t = '<root><ID>1</ID><ID>2</ID><ID>3</ID></root>'
I want to fetch values of node ID into a resultset like,

how can i achieve this?

Thanks in advance!!


Errors in the Crawl log and files not showing up in the search results


MOSS 2007:

Problem:  Errors in the Crawl log and files not showing up in the search results

Symptoms/ Error messages: "The filename or extension is too long. (The item was deleted because it was either not found or the crawler was denied access to it.)"

What I have done:  The file paths are under the limit imposed by MS, I already checked that.  The indexing account has access to the files security wise.

·          <

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend