HowTo: Generating several namespaces for an element in an XmlDocument?

Hi everybody,
I'm using VS 2005, .Net 2.0. The CreateElement() method of XmlDocument allows to supply a namespace URI. Now I want to add several namespace URIs with different prefixes to the element. How do I do that. Here an example:

   <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:html="http://www.w3.org/TR/REC-html40">

I could do this with the creation of additional attributes. But I am not sure if this is the expected way. Thanks for any hint.

Regards, hd
0
Harald
10/17/2007 11:24:54 AM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
550 Views

Similar Articles

[PageSpeed] 37

Harald wrote:

> I'm using VS 2005, .Net 2.0. The CreateElement() method of XmlDocument allows to supply a namespace URI. Now I want to add several namespace URIs with different prefixes to the element. How do I do that. Here an example:
> 
>    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
>     xmlns:o="urn:schemas-microsoft-com:office:office"
>     xmlns:x="urn:schemas-microsoft-com:office:excel"
>     xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
>     xmlns:html="http://www.w3.org/TR/REC-html40">
> 
> I could do this with the creation of additional attributes. But I am not sure if this is the expected way. Thanks for any hint.

Yes, if you want to ensure those namespace declarations are present on 
the root element then you need to create attributes on that element. See 
<URL:http://groups.google.com/group/microsoft.public.de.german.entwickler.dotnet.csharp/msg/ccd87e3c37fbeca4> 
for a code example doing that for a similar root element.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
10/17/2007 12:34:11 PM
Reply:

Similar Artilces:

Generac Guardian Series 5503 14,000 Watt Air-Cooled Propane/Natural Gas Powered Home Automatic Standby Generator with Steel Enclosure (CARB Compliant)
Price:$3,819.00 Image: http://specialdealfinder.info/image.php?id=B001DZLKHI Best deal: http://specialdealfinder.info/index.php?id=B001DZLKHI 14/13KW Air-Cooled Stand By Generator, Powers 14 Circuits Of Your Home Or Business Such As: Furnace, Water Heater, Kitchen, Including Refrigerator, Bathroom, Bedroom, Sump Pump, Family Room, True Power Technology Provides Safe Operation Of Sensitive Electronic Equipment & Appliances, Meets Ieee/Utility Standards, Easiest Installation With The Pre-Wired, Pre-Packaged 100A, Nema 1, Indoor Rated Only, Automatic Transfer Switch, OHVI Industrial En...

Howto create textbox like in powerpoint
Hi Could someone tell me how to create powerpoint type textboxes? Are they windowless rich edit controls? Thanks Sachin They are rich edit control, but they have a window, they are owned by the window that they are being displayed on. AliR. "sachinkundu" <sachinkundu@gmail.com> wrote in message news:1170062520.486641.43880@m58g2000cwm.googlegroups.com... > Hi > > Could someone tell me how to create powerpoint type textboxes? Are > they windowless rich edit controls? > > Thanks > Sachin > > They are rich edit control, but they have a wind...

Generate SQL code from Visio
How does Visio generate SQL code, table create scripts from the entities modelled ? > How does Visio generate SQL code, table create scripts from the entities > modelled ? I'm assuming by your question that you are using the pro version, in which case the answer is that it doesn't. However, you can download the utility on my website (free, url below) and the xslt available on the add-ons page which will export the model as XML and translate it into SQL DDL respectively. Hope that helps, Scot. ................................................ Scot Becker Orthogonal Softwar...

generate emails out of excel ?
Ok image an excel spread sheet, it's not a very complicated sheet.. It has rows, and there are columns... column say B has customers emails, right now the person who does it, manually pastes each line to generate an email and sends it and repeats the process for each new row of info in the spread sheet... First, is it possible to use VB and fire up outlook, not outlook express, but the regular one to send those emails ? the email would be a template, the same to each new email address ? Is this possible and if so, any ideas where to look, maybe some code already exists for this ? Tha...

faq: different elements in one container,is it possible?
Hi, I use CArray, CList etc. , and always the elements in the container are the same type. Now I want use these container to store the different elements , is it possible? As a example, class CMyPoint : public CPoint { .... CArray<int,int&> m_nindex; .... }; Now I want to store the CPoint and CMyPoint in CArray, how to define it? CArray<??,??> Thanks. Hi , define a structure of required elements and store it in CArray or CList.This way u can do what u wanted. Thanx, Ch.T.Gopi Kumar. "fcvcnet" wrote: > Hi, > I use CArray, CList etc. , and alwa...

NameSpace SelectNodes Problem
Hello, i have problems with the Namespaces and the .Net XML Parser My XML looks like this: <query xmlns="jabber:iq:roster"> <item jid="srlee@localhost" name="srlee" subscription="both"><group>contacts</group></item> <item jid="tlee@localhost" name="Troy" subscription="both"><group>contacts</group></item> <item jid="bglee@localhost" name="Barry" subscription="both"><group>contacts</group></item> <it...

Outlook generating errors
Hi, I currently have a users laptop that is running W2K with office 2000. Outlook runs of exchange server. Whenever the user tries to create a new email, reply or forward an existing email outlook generates errors says it is creating an error log and shuts down. The problem is not profile specific, I've completely removed outlook and completed a fresh install with office service pack three installed. Has anyone got any ideas as to what could be causing this or know where the Outlook error logs are stored? Any help would really be appreciated Cheers David ...

Smtp Authentication
Hi all I'm an IBM Domino administrator.But i have to fix an exchange 2003 server in these days.The problem is; the exchange server was full of spam yesterday because of open relay, i deleted all the spam.Now i want to make an smtp authentication setting on the exchange server. the schema is as that: 1 MS 2003 server (domain controller) with exchange 2003 installed (all fixpacks are included) (192.168.0.1).15 clients (winXP+Outlook 2000/XP/2003 mixed). network adress is 192.168.0.0/24 all the computers access to internet by a dsl router (192.168.0.254), using 192.168.0.1 as DNS server...

HOWTO Force landscape printing with CPrintDialog.
HOWTO Force landscape printing with CPrintDialog. Please help, I have the following code I want to FORCE to print in landscape after the CPrintDialog finishes. This solution must not touch the CWinApp's "m_hDevMode" data member. This solution must only do something to the DC returned from the CPrintDialog, and it must override any possible orientation settings the user may have change while they were inside CPrintDialog. : CPrintDialog CPrintDialog_Temp(FALSE); if (CPrintDialog_Temp.DoModal() == IDOK) { // Do something here to FORCE the print out to be landscape ...

DLL Howto
Hello everyone, I would like to fill in people who have not made MFC dlls my experiences making them, and how to make DLL creation extremely simple. First you want to create a MFC extension dll, which is important because this specific type of DLL will allow you to export functions and classes without any confusing code. After that, implement any classes to the dll and when the class is being declared include the AFX_EXT_CLASS macro. For instance class CModifyTransaction : public CDialog would become... class AFX_EXT_CLASS CModifyTransaction : public CDialog after that is added any dll ...

Print several pages to single paper
Hi, when previewing OneNote pages each page is a separate page of paper in print. Is there a way to have the pages follow on the same page separated only with the OneNote page title? Thanks Deejay wrote: > Hi, when previewing OneNote pages each page is a separate page of > paper in print. Is there a way to have the pages follow on the same > page separated only with the OneNote page title? No, there is no such option. Rainald ...

phone numbers generated twice (propagated campaign activities)?
Hi, strange. I am sure that, when propagating a campaign activity (i.e. phone call) and one of the recipients has no phone number, the resulting generated phone call activity keeps the phone number of the "predecessor" (the call generated before). Anyone noticed this? Achim Yes, Your doing ell mine genrates 3 entries ? Anyone have any solutions to this Achim Gounar wrote: > Hi, > > strange. I am sure that, when propagating a campaign activity (i.e. phone > call) and one of the recipients has no phone number, the resulting generated > phone call activity ...

Can I have the same element declared within itself ?
Hi, I wanted to know if it is legal in XML to declare an element within itself. For example... <A> This is an element of type A. <A> This is another element of type A </A> </A> Thanks, Sri Yes, it is legal -- Stan Kitsis Program Manager, XML Technologies Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm <sbeerav@gmail.com> wrote in message news:1130350155.959389.33080@z14g2...

Automatic Code Generation
Is automatic code generation (from an UML diagram) possible with Visio 2003 and Visual Studio .net? Thank you in advance....and happy new year! This functionality is part of Visual Studio 2003 Enterprise Edition. Visio 2003 does not have this feature. -- Mark Nelson Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Paolo Niccol�" <axettone@xiengeen.com> wrote in message news:e7I4oFx8EHA.3476@TK2MSFTNGP15.phx.gbl... > Is automatic code generation (from an UML diagram) possible with Visio > 2003 and V...

HOWTO: Protecting a Document???
Hi... I'm still using Office XP (Word 2002). I'm just about finished making a FORM document which I plan to turn into a template (.DOT). I've turned on the "Forms Protect"... which moves the user around the "protected text" but I also want to disable anyone from changing the original .DOT itself (this will be a standard form and don't need some smart-ass altering something that I'm, ultimately, responsible for). I'm still GOOGLE'g but... how can I allow a user to OPEN this file to enter data/check boxes into the FORM FIELDS......

purchase order with several items (5) with big quantities
Dear David, We have a purchase order with several items (5) with big quantities. We received only few quantities of them, affecting that purchase order; then we posted the reception. After few days, we tried to recept the rest of quantities pending but it is impossible because the purchase order appears like not approved; and the system displays a message: “keep the purchase order in a purchase batch”. How we can solve this problem, please help us. Best regards, Cesar Gallegos. ...

Pin Generator
Anyone know how to make a simple PIN generator in excel? -- Jeff =RAND()*(9999-1) Try typing this into a cell and change its number properties to having no decimal places. "GoBucks" wrote: > Anyone know how to make a simple PIN generator in excel? > -- > Jeff Jeff, How about entering this formula in a cell, thenRecalcing to generate a new number each time? =INT(RAND()*10000) Regards Pete "GoBucks" wrote: > Anyone know how to make a simple PIN generator in excel? > -- > Jeff ...

HowTo block Attachments on Exchange 2003???
Hi. I'm looking how to block certain types of attachments in Exchange 2003 (installed as part of Win2003 SBS PRO Server) in 'Exchange System Manager'? Is it possible to block certain attachments only for certain users? 10x and best regards, Dezo Damir Dezeljin <News@dezo.org> wrote in news:O3NZqtvsEHA.2460@TK2MSFTNGP10.phx.gbl: > I'm looking how to block certain types of attachments in Exchange 2003 > (installed as part of Win2003 SBS PRO Server) in 'Exchange System > Manager'? > > Is it possible to block certain attachments only for certai...

Exchange Certificate HowTo
I am looking for a howto on implementing Verisign Certificates into the Exchange environment. Currently all of our users have Digital ID's from Verisign to encrypt e-mail messages. We attempted to install these certificates into Outlook 2003 with no luck. When sending to user while attempting to encrypt it says that we are unable to send encrypted mail to this user even though we have his/her digital ID locally. My question involves how to get the server to recognize the certificates or how to enable exchange to see the certificates. We are using WIn2003 SBS with Exchange 2003 and on the c...

Getting the sum of several fields
I created a field called cash in a MS Access form, I want the totals for these fields 100 50 20 10 5 to be placed in that cash field. In the control source for the cash field I am using =Sum([100]+[50]+[20]+[10]+[5]) and thought that would work but it does not. I can do a sum of two fields, but anything larger does not work. What am I missing Dave I'm not entirely clear on the data structure underlying your form. Are you saying you have multiple fields ([100], [50], ...) and want to total across them? If so, you've just described ... a spreadsheet! Is there a reason you aren&...

12 generation genelogy chart
I would like a at least 12 generation genealogy chart because the only one listed has five ...

Generating Random Numbers
I see there is a way to generate random numbers (=rand(). It returns a number between 0 and 1. Is there a way to generate random numbers between and including 1 and 6? Thanks. Hi Matt, Try =RANDBETWEEN(1,6) HTH Regards, Howard "Matt" <mheimerl@pacbell.net> wrote in message news:Jjq%b.17398$Jd6.59@newssvr29.news.prodigy.com... > I see there is a way to generate random numbers (=rand(). It returns a > number between 0 and 1. > > > Is there a way to generate random numbers between and including 1 and 6? > > Thanks. > > One way: =INT(RA...

howto MsgHook on repaint?
Hi, i want to get a message, when a window or a region of the whole desktop was repainted (because of changed content). I need to get the handle to the window that was repainted. - Is that possible or do i get every repaint message? - Do i have to write a seperate DLL for the message hook? - Would I get the handle to the window that was repainted? The best solution, i think, is not makeable: I want to get a rectangle of the region that changed his content?! But I think that is nearly impossible or? Thanks for all tips, regards, Holger ...

How to Generate XSD from an XML
Hello , I am trying to extract from an xml file all the attributes and the data and create an XSD file which will match with my xml. I am using .NET VB. Does anyone Know how to do it ? Does anyone has a sample code of creating the XSD file ,simply by having the XML ? I do not want to use a xsd.exe or any other tool available on the net. I need script code in .NET VB I would mostly appreciate your help Thank you zakkar@gmail.com wrote: > I am trying to extract from an xml file all the attributes and the data > and create an XSD file which will match with my xml. I am using .NET &g...

Automatic Graph generation by series
In my work book I have a sheet which contains Scheduled installations and successful installations per week. Is there a way to automatically generate a graph depending on the week number? -- SiliconAlleyDude Yes, you can do so by creating dynamic formulas to control the series. You can find an explanation here. http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=518 ---- Regards, John Mansfield http://www.pdbook.com "SiliconAlleyDude" wrote: > In my work book I have a sheet which contains Scheduled installations and > successful installations per week. &g...