Howto: Ommit empty xmlns specs?

Hi,
I generate Xml with the XmlDocument methods. Now I have the problem, that a node has a namespace declaration but the child text nodes shall not have a namespace specification.

The XML should look as follows:

<root xmlns="anyURI">
    <child 1>My Text</child 1>
...

But when generation the XLM, the nodes look like that:

<root xmlns="anyURI">
    <child 1 xmlns="">My Text</child 1>

How can I suppress the     xmlns=""    in child 1   ???

Thanks for any help!
Regards, hd



..PS:   C#, VS2005

Generation like this:

XmlElement  root = _doc.CreateElement("Root", "anyURI");
root.AppendChild(_doc.CreateElement("child 1")).InnerText = "My Text";

Output is generated with an Xml-Writer and the following settings:

settings.Indent = true;
settings.IndentChars = ("    ");
settings.Encoding = Encoding.GetEncoding("iso-8859-1");


0
Harald
10/17/2007 4:53:34 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
865 Views

Similar Articles

[PageSpeed] 11

Harald wrote:

> <root xmlns="anyURI">
>     <child 1>My Text</child 1>
> ..
> 
> But when generation the XLM, the nodes look like that:
> 
> <root xmlns="anyURI">
>     <child 1 xmlns="">My Text</child 1>
> 
> How can I suppress the     xmlns=""    in child 1   ???

You need to create each element in the namespace it belongs to

> XmlElement  root = _doc.CreateElement("Root", "anyURI");
> root.AppendChild(_doc.CreateElement("child 1")).InnerText = "My Text";

   ropt.AppendChild(_doc.CreateElement("child_1", "anyURI"))

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
10/18/2007 12:23:30 PM
Reply:

Similar Artilces:

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...

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...

MsgBox when the cell is empty
Hi, I want a msgBox when a cell i empty, I can´t get the cod to work, do anyone know how to do this? My code are Dim Period As Date Period = ActiveSheet.Range("b3") If Period="" Then MsgBox "Du har glömt att välja sorteringsperiod", vbCritical Exit Sub -- Best regards Mia Try Dim Period As Date If ActiveSheet.Range("b3") = "" Then MsgBox "Du har glömt att välja sorteringsperiod", vbCritical Exit Sub Else Period = ActiveSheet.Range("b3") End If ...

Snapshot viewer and empty page
My report is emailed using the snapshot feature, but when a specific user opens it, it's just an empty page. Others can open the report with snapshot except this user. I download the viewer from MS website and re-install it into that user's machine. Still doesn't work. I shut the machine down and turn it on again. Still doesn't wokr! I open My Computer -> Tools -> Folder options -> File Types tab and the .SNP extension is there (and the MS Office Access Snapshot Viewer is there, too). Still doesn't work! Can you please help me how to fix this problem? Than...

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 ...

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......

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...

Get rid of xmlns in schema
I am giving here all the details of my schema. (Auto geneterated class from .xsd) (There are more classes in my ContactMgmt schema) [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http:// www.xxxx.com/ContactManagement/DataSchema.xsd")] public partial class DeviceAssignment { private string cont...

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...

Three problems: Preparing to Send Messages popup and spam folder won't empty, and messages duplicate
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: imap I'm running into three problems: The first is one I hoped would have disappeared when I upgraded from 2004 to 2008 a couple months ago. At seemingly random (or maybe incremental?) times, I get a dialogue box that pops up that says &quot;Preparing to Send Messages&quot; that I imagine uploads messages from my desktop to the server or something like that. But the number keeps getting bigger and it often occurs when I'm in the middle of typing an e-mail and interrupts what I'...

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 ...

When I SUM cells & 1 is empty I need the result to be empty not 0
I am summing up cells from two different sheets (1, 2) onto a third. Some of the cell values on the first two sheets may not have anything in them, yet when I type in my formula on the 3rd sheet to sum the cells, I get a 0 value. The project I am working on has values of 0, 1, 2, and 3, so when there is a missing value I need to know about it (I do not know how to get Excel to do this - get no value, not even 0 in the results). Yet, right now when there is a missing value, I get a result of 0, which is confusing since that is one of the values I am interested in. Any help? Does thi...

Prevent Creation of pst-files
Hi All.. I seems that it can�t be prevented that users create pst-files...does anyone know a way to do this ?!? Best Regards Rikke Simonsen Rikek Simonsen <Rikek Simonsen> wrote: > I seems that it can�t be prevented that users create pst-files...does > anyone know a way to do this ?!? If they are not receiving their mail via an Exchange server, how do you expect them to receive any mail without a PST? -- Brian Tillman Smiths Aerospace 3290 Patterson Ave. SE, MS 1B3 Grand Rapids, MI 49512-1991 Brian.Tillman is the name, smiths-aerospace.com is the domain. I don't speak ...

HOWTO Do WScript in C++.
Here is a script from the MSDN article about the WScript's "SpecialFolders Property" var WshShell = WScript.CreateObject("WScript.Shell"); strDesktop = WshShell.SpecialFolders("Desktop"); var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk"); oShellLink.TargetPath = WScript.ScriptFullName; oShellLink.WindowStyle = 1; oShellLink.Hotkey = "Ctrl+Alt+e"; oShellLink.IconLocation = "notepad.exe, 0"; oShellLink.Description = "Shortcut...

CRM Address Book Entries in 4.0 Outlook Client are Empty
Hello, we uses CRM 3.0 and now we like to migrate to CRM 4.0. So, we installed CRM 4.0 on a seperate server in order to test the system. On one client we deinstalled CRM 3.0 Client for MS Outlook and installed CRM 4.0 Client. Everything works fine, but, wehen we like to compose a new e-mail, the CRM adress book is empty. Only the "CRM-Benutzer" (I accept "CRM User" in EN version) shows entries. The diagnose fuinkction tells me, that everything is fine. I searched in the web for more information. Other useres have the same problem. But I do not found a solution. Fo...

HowTo: Open IE without MenuBar ???
Hi NG, Does somebody know how I can open "iexplore.exe" without any tool- or menubar??? ShellExecute() doesn't work i think !? Thanks & rgds Torsten Run iexplore in the kiosk mode by passing the '-k' parameter. Something like { TCHAR sBrowser[MAX_PATH+1] = {0}; TCHAR sTempFile[MAX_PATH+1] = {0}; GetTempPath( MAX_PATH, sTempFile ); _tcscat( sTempFile, TEXT("abcd1.htm") ); if ( GetFileAttributes( sTempFile ) == DWORD(-1) ) { // if the file is not present, then create it. CFile aFile; aFile.O...

HOWTO: Mailto and Outlook??
Hi... I'm using Outlook XP but pretty sure I had same problem using Outlook 2000. I've coded my personal website to include a little Javascript MAILTO: routine using HTML "forms". I've spent several hours this weekend searching the web for examples and re-coding them into my website. They all SEEM to work (from the website viewpoint) but whenever I get the "... someone is trying to use Outlook..." popup the resultant message goes into my Outlook OUTBOX and NEVER gets sent! This script used to work! Do I have an Outlook "security" issue?? Or an I...

Outlook 2003
If I right click my hotmail folder's Junk Email folder and select empty, it clears down the list of emails shown within that folder, though on the next Send/Recv cycle, the list reappears. I don't think that Empty actually works. Is this bug going to be fixed ? Steve are you connecting to hotmail using HTTP or the outlook connector? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Author, Google and Other Search Engines (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips...

howto generate a map file
Hi, I have a user reporting a crash of my driver with Windows Ultimate 7 64 bit. Although I have tested with Home Premium without any crashes??? The only info I have on this: *** Mydriver.sys - Address: FFFFF8800B23701A base at FFFFF8800B235000, datestamp 4af85745 I tried to generate a map file in my source without success. LINKER_FLAGS=$(LINKER_FLAGS) /MAP:$(TARGETPATH)\$(TARGETNAME).map \ -MAPINFO:EXPORTS -MAPINFO:LINES -MAPINFO:FIXUPS NO MAP FILE?: Is there any other way I can correlate this above address with my release? Regards. Denis ...

counting rows counting empty rows
I have the following code in my macro to help me count the rows in m spreadsheet. The problem I am having is the cell it is looking at i empty but has a formula in it. It appears that it is counting th formulas too. How can I only count the cells that have data in them? Code ------------------- With Worksheets(Cur_Month).Range("EMP_HR_ID") If .Offset(0, 0) = "" Or Null Then MsgBox ("There were no HRIDs to process. Please Update the Information and Rerun the Application.") HRID_cnt = 0 ElseIf .Offset(1, 0) = "" Or Null Then HRID_cnt =...

multiple empty accounts showed up
I have three accounts with Broker X, which I've tracked for some time with Money (2006 Premium). Only one of them was set up for automatic updates. As soon as I enabled the other two for automatic updates, Money created SEVEN new empty accounts ("Broker X Cash Account", "Broker X Cash Account #2", ... "Broker X Margin Account", etc.) separate from the two I wanted to connect. Next thing I know, I have NINE pending statements for these seven imaginary and empty accounts, displaying "bank balance" totalling somewhere in the range of $200,000! Go...

howto rebild backup
Hi there, I am using Exchange 2003 on Win2k3 Server I have a strange problem: My boss bought himself a Mobile Phone (Samsung C5212 DuoS) which he wanted to use for synchronising Contacts and Calendar from Outlook 2003 (is client on that mentioned Exchange-Server). After installing the Software "Samsung New PC Studio" (which was the latest from Samsung Website) and synchronising contacts and calendar the whole data in his calendar before Aug 2009 was deleted. Seems like a problem of that "PC Studio" software because it had limited space for calendar ent...

Empty Mailbox
I had a user login this morning and her Contacts and Inbox were empty. I am running Exchange 2000 on Server 2000. What would be the best way to recover the lost information. Thanks Eric it depends on how you back up your private information store and how your users access their data. >-----Original Message----- >I had a user login this morning and her Contacts and Inbox were empty. I am >running Exchange 2000 on Server 2000. What would be the best way to recover >the lost information. > >Thanks >Eric > > >. > Do you have deleted item retention turn...

Subform not empty
I have a form (Access 2000) with a combo used to choice a value necessary to filter the data displayed in a subform. Every time I open the form, the subform is not empty but displays the data corresponding to the last value selected in the combo the preceding time I used the form. What I have to do to obtain that when I open the form the subform is empty ? Thank you Gianluigi Gianluigi: You don't say how you are filtering the subform, but I'd suggest you do it like this: 1. The combo box in the parent form should be unbound, i.e. its ControlSource property is l...