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


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Multiple Xpath expressions returned in document order

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :Sql Server
 
Hi all

I am using XQuery in SQL Server in my project. I need to retrieve multiple elements located in different places in the document and I need the retrieved elements in the document order.
My program should work with any XML file so I do not have a specific structure. It is just a function that gets multiple XPath expressions and return the retrieved elements in the document order.

For example
<Document>
   <Book ID="1"/>
   <Book ID="2"/>
   <Book ID="3">
       <Chapter ID="1"/>
   </Book>
</Document>

Assuming the previous xml is stored in column x in Table.

select x.query('
/Book[@ID="2"],
/Book/Chapter[@ID="1"],
(/Book[@ID="1"]
') as result
from Table where ID =1

the previous query will return the elements in the order they have in the query not the order they have in the document, the result is
  <Book ID="2"/>
<Chapter ID="1"/>
<Book ID="1"/>

When retrieving multiple elements using one Xpath expressions, SQL serve


View Complete Post


More Related Resource Links

iTextSharp - Multiple Document Concatenation

  

Hi,

I have built a routine which takes a byte() array and passes it to iTextSharp for rendering as a PDF.  This is working just fine.

However, in my application, users want to be able to select multiple documents and have the program render them as a single, combined PDF.

For the purpose of this discussion, let's say they chose two documents.  I form the byte() array containing the data of the first document and then, I increase the size of that byte() array and load the second document's data into one.  The result is that I have a single combined byte() array which I now want to render.

However, when the PDF viewer opens (in runtime), it's only showing me the first document (as if there is no more data in the byte() array to render).
My thinking is that perhaps it's picking up the End Of File (EOF) marker and therefore not rendering the data past that point in the byte() array.

Any thoughts on this?  Here's my code.

Prior to the For/Next construct, I have a dataset already containing a list of documentId's from a database that works with my EDM package.
A webservice call returns the byte() array for each document in my dataset into mb() and I use mbbnew() to build the combined byte() array for the documents requested by the user.

Just to be clear,

How to modify dropdown document template list order when creating document library?

  
when creating a new document library, the first template is the one for word 2003. Can we change that to word 2007 one? thanks,

Need to link multiple External Content List items to a single document metadata column

  
I have an external content list - for my purposes, the data isn't any fancier than a list of terms provided by a web service (read only - I don't need update/delete functionality). I want to be able to link any subset of those terms to a single document metadata column (in other words, I need it to work like a normal content list that is defined to allow multiple values in a column) but SharePoint doesn't let me do that on an ECL. I need the content list to be externally driven since more values are going to be added to an outside system over time, but I think it's possible that I may not need a full-fledged ECL list to make this work this way in SharePoint. Just to clarify: I don't need the metadata values in my documents to maintain a PERSISTENT link to the web service (if someone changes an underlying value in the web service DB, it doesn't need to be updated in the document table too). I just want SharePoint to offer up an updated set of source values from the web service if somebody goes in and edits the document metadata. Any ideas for how I can make this work?

Document Set - Problem when uploading multiple files with "Launch forms in a dialog" disabled

  
Hello, Has anyone come across this before? I have a basic document library for which I have enabled "Allow management of content types" and disabled "Launch forms in a dialog".  Both of these settings are in the "Advanced Settings" page.  Also, the document library does not have versioning enabled and check out is not required. I added the OOTB "Document Set" content type to this document library and allowed OOTB "Document" content type documents in this document set.  This document set does not have any default content. The issue arises after I upload multiple files and click the "Done" button.  After I do this, the browser redirects to the top level of the site!  For example, if I uploaded to my document set at http://server/sites/anyname/doclib, I am redirected to http://server/. This issue has come up in both a standard server and an enterprise server. Steps to repeat issue: Create a document set Open the document set Select "Upload Multiple Documents" Drag and drop or browse for files Click "OK" Click "Done" Actually, this issue also occurs when "Launch forms in a dialog" is enabled.  In this case, you just have to navigate to the upload form directly (with all the necessary query string parameters, of course). Has anyone else seen this issu

Adding a full node to an existing XML document on a by xpath specified location

  
I want to add a complete node to an existing XML document.So:1. get the XML document from the session2. create a new node3. pass the node and the session to a function, that adds the node on the location of the xpath4. return the new session, updated with the node in the specified locationBelow my code, which DOESNT work.I've had some other advices, but nothing seems to work. What am i doing wrong?!?!Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    Dim doc As XmlDocument = New XmlDocument()    Dim xmldoc As XmlDocument = Session("XML") 'get XMLdocument from session    Dim locationNode As XmlNode = doc.CreateElement("location")    Dim locationAttribute As XmlAttribute = doc.CreateAttribute("id")    locationAttribute.Value = "3"    locationNode.Attributes.Append(locationAttribute)    Dim titleNode As XmlNode = doc.CreateElement("title")    titleNode.AppendChild(doc.CreateTextNode("Empire State Building"))    locationNode.AppendChild(titleNode)    doc.AppendChild(locationNode)    Dim newNode As XmlNode = doc.ImportNode(locationNode, True)    AddOrUpdateNodeInSession(Session, "//root/dat

Using a List View web part to display documents from multiple document libraries from different site

  
Hi there, I am trying to have one web part display documents (or list items) from different document libraries (or different lists) from different site collections. I have achieved this under a single site collection using Data View Web Part (using SPD). I have also achieved displaying a single document library (or a list) from a different site collection by using List View Web Part. but I am not sure how to get my head around displaying documents or list items from different document libraries or lists across site collections. I have thought of using SPSiteDataQuery or ListViewByQuery, but they all seem to focus one site collection at a time. If any of you have done this before, please share your best practice on this one with me. Much appreciated. Clark

Multiple Order by clauses with Union

  

I'm trying to figure out how to run this code, I have over 40 tables that I need to get data from, the only thing I can think of is to use "Union" , I need to get the last record in each table by StartTS (StartTimeStamp) so I figured the best approach is to use "Select Top (1) and use Order by StartTS to get the data.  This works great if you are only grabbing data from 1 table, however like I said I need to grab from over 40. 

My example uses only 2 tables:

SELECT   TOP (1)
             (SELECT   [Unit Name]
              FROM     dbo.UnitVerificationData
              WHERE   (Unit_Code = dbo.CP_BCELP.Unit_Code)) AS UnitName, Operation_type, StartTS, StopTS
FROM     dbo.CP_BCELP
ORDER BY StartTS DESC
UNION
SELECT   TOP (1)
             (SELECT   [Unit Name]
              FROM     dbo.UnitVer

Adding multiple users to a document library column by web service

  

I'm attempting to create some VB code to call a SharePoint Web Service to add a document and associated metadata to a document library. I can successfully add metadata to a text column but I'm having some problems getting multiple entries into a column which is specified to take multiple users (and does so when they are added manually) although I can get a single user in using the following snippet.

Dim info2 As MySharePoint.FieldInformation = New MySharePoint.FieldInformation()
info2.DisplayName = "Authors"
info2.InternalName = "Authors"
info2.Type = MySharePoint.FieldType.User
info2.Value = "1"

I'm hoping that someone will be able to advise me of the approach or syntax necessary to add multiple users to this Authors column e.g. Users 1 and 74. I note that

info2.Value = "1,74" or info2.Value = "1;74"

don't appear to work.


1.)Duplicating VB Right() functionality 2.) Seek and replace multiple expressions in a single pass?

  
Two questions:
1. I want to replicate the functionality of the Right() string function in Regex in order to lop off the first four characters of certain 20 character strings if those leading characters happen to be "K3AH". Right(string,16) would be part of the VB code I'd use to do it but this is what I've come up with using Regex:

Dim re As New Regex("\bK3AH+(?=\d{16})", RegexOptions.Multiline)

Dim source$ = "SRA-7138-29		K3AH1241091742015390	K3AH1241170743153764	6454	dawni001"

source$ = re.Replace(source$, "")
And it seems to work, returning "SRA-7138-29  1241091742015390AH1241170743153764 6454 dawni001"

Is there a better (i.e.,faster, safer, whatever) way to do this?


2. Is it possible, using Regex, to search for multiple (different) expressions and make replacement for all of them while only makin a single pass through a text file?

Locating documents with no checked in version across multiple sites and document libraries

  

I have searched and searched but have not found a solution anywhere. My problem is that we have a number of document libraries that require check out for editing and have mandatory fields. When users upload multiple documents the documents are kept checked out until a value is assigned to the field and the document is checked in. The issue is, that users may not complete the process and subsequently no other users can see the document.

We tried indexing the 'Checked out to' field and allowing for users to search based on this. However, this does not display documents with no checked in version and as such does not help...

Is there some way that we can make the search indexer crawl these documents or have a web part that lists documents checked out to the logged in user? We are using SharePoint Foundation 2010 which may make this more difficult.


Error: OLE DB provider "SQLNCLI" for linked server "MHTIS01T" returned message "Multiple-step OLE DB

  

Hi All, i am getting the error (in title) while executing the package.

can somebody tell me how do i solve it?


Multiple templates for Document Repository

  

Hi,

We have a document repository in SharePoint 2010 and we need to have multiple document templates for it. From the Document Repository > Advanced Settings > Document Template - it only lets us have a single document as the template.

We would like users to have the option of selecting from multiple document templates, when they are creating a new document in the document repository.

Thanks,

Aritra Saha


Sharepoint2010:Upload multiple document and connect to outlook :owssupp.dll & stssync

  

My first question went un-answered but I solved in after some midnights, now this is my second question, I am beginning to think SharePoint2010 is fantastic but is lacking in real support.

I am using SharePoint2010 , accessing from internet on Windows7(64bit) and Office 2010(64bit) notebook, While trying to access iver internet, Multiple upload of documents and Connect to Outlook are greyed out even after placing the URL in the trusted sites. Afte rmuch digging up it points to OWSSUPP.DLL and STSSYNC, which are supposed to help in these function. In Office 2010 I can't find this DLL and IE8 (64bit) does not have the STSSYNC active X loaded in my managed-add-in nor did it prompt me to download this active x.

The big question here is can some one help be shed light on this, what's the point if all on OWSSUPP.DLL are talking on Office 2007 when Office 2010 is in the market.


External Data Fields in a Word Template saved as a content type in a document library with multiple

  

I have created a Word Template for a Document Library that has an External Data Column in it of Client Name which also adds Client Address1, Client Address2, Client City, Client State, & Client Zip.  Now this works fine for a Document library with that template as the Template.dotx file. 

I want to be able to make a bunch of Templates and have them all as Content Types in one Library.  When I do this I cannot get the External Data Quick Parts to work.

Anyone have any ideas?


Sum Multiple Declared Expressions

  

I have 2 Declared expressions that I need to add together, I know how to do a normal SUM on Select statements however this is a little different, or at least it appears that way to me.

Here are the 2 Declared Statements:

declare @Amount float

select top 1 @Amount = CAST(dbo.Designated_Amount.Amount AS Float)
    FROM  dbo.Designated_Amount INNER JOIN
       dbo.SIMS ON dbo.Designated_Amount.Unit_Code = dbo.SIMS.Unit_Code
    WHERE not exists (Select * From dbo.SIMS Where (dbo.Designated_Amount.Unit_Code = '114') AND dbo.SIMS.Event_Type in ('IR','ME',

Need to link multiple External Content List items to a single document metadata column

  

I have an external content list - for my purposes, the data isn't any fancier than a list of terms provided by a web service (read only - I don't need update/delete functionality). I want to be able to link any subset of those terms to a single document metadata column (in other words, I need it to work like a normal content list that is defined to allow multiple values in a column) but SharePoint doesn't let me do that on an ECL. I need the content list to be externally driven since more values are going to be added to an outside system over time, but I think it's possible that I may not need a full-fledged ECL list to make this work this way in SharePoint.

Just to clarify: I don't need the metadata values in my documents to maintain a PERSISTENT link to the web service (if someone changes an underlying value in the web service DB, it doesn't need to be updated in the document table too). I just want SharePoint to offer up an updated set of source values from the web service if somebody goes in and edits the document metadata.

Any ideas for how I can make this work?


Categories: 
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