Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2007, 03:10 AM
Authorized User
 
Join Date: Nov 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to give a unique id like that 15b85c2b-83ca-44

I have a little query of generting unique id for creating node , Is there is any way to generate random no ...

I have to genarate a random no for FieldUniqueId attribute in the <FieldToSupport> each time when I create a new node <FieldToSupport>..

I tried it by using Session.SessionID but the no string genarated for example 'hzskur45zxzh4jiwq5lsp3j3' this is same during for the logged user .... also i have to generate random no string in the format like '15b85c2b-83ca-44ec-8741-22a4dc64f64d' ..

 following is the strucuture of XML file

<FieldsToSupport>

<FieldToSupport>
          <Caption>Blank</Caption>
          <Url>Blank</Url>
          <Label>NewField1</Label>
          <HtmlName />
          <HtmlId />
          <FieldUniqueId>15b85c2b-83ca-44ec-8741-22a4dc64f64d</FieldUniqueId>
          <LinkHref>http://careers.msn.com/</LinkHref>
          <InnerHTML>Careers &amp;amp; Jobs</InnerHTML>
          <OuterHTML>&lt;A href="http://careers.msn.com"&gt;Careers &amp;amp; Jobs&lt;/A&gt;</OuterHTML>
          <PopupHTML />
          <FieldSupportItems />
        </FieldToSupport>

<FieldToSupport>
......
</FieldToSupport>

<FieldToSupport>
......
</FieldToSupport>

</FieldsToSupport>

 
Old November 15th, 2007, 04:58 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

There is an XPATH function called generateId() which will generate a random ID for any node. I however doubt it will be in the format you require.

If you need are using .Net then obviously Guid.NewGuid() would be the way to go.

/- Sam Judson : Wrox Technical Editor -/
 
Old November 28th, 2007, 06:44 PM
Authorized User
 
Join Date: Sep 2004
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default

Simple ASP

Function createGuid()
  Set TypeLib = Server.CreateObject("Scriptlet.TypeLib")
  tg = TypeLib.Guid
  createGuid = left(tg, len(tg)-2)
  Set TypeLib = Nothing
End Function






Similar Threads
Thread Thread Starter Forum Replies Last Post
generate unique id capri SQL Server 2000 1 April 6th, 2008 10:18 AM
Create Unique Id langer123 Classic ASP Basics 0 April 6th, 2005 01:27 PM
Creating a Unique ID for each row maxworlund SQL Server DTS 1 March 8th, 2005 09:33 PM
Getting Unique ID from Database Nicky_uk Classic ASP Databases 9 January 26th, 2005 04:45 PM
Generate unique ID when populating a table sroman SQL Server 2000 2 August 5th, 2003 03:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.