How to create xml elements with special chars


Hi,

newbie that i am in .Net, i'm trying to add "D/T" as a new element in C#
:
XmlElement elemAttr =
(XmlElement)m_xmlDoc.AppendChild(m_xmlDoc.CreateElement("D/T" ) );

but the framework throws an XmlException ...

how do i overcome this ? do i have to parse the string for special chars
myself ?

please advise,

thanks , nim_co.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
0
nim_co (3)
12/8/2003 9:44:03 AM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
505 Views

Similar Articles

[PageSpeed] 27

I don't think that you can.  The XML standard limits the characters you can
use (http://www.w3.org/TR/xml11/#dt-element).  Just like a compiler would
not allow the character "/" within a variable name.

Why would you want to do that anyway?  If you could do what you want, you
would potentially confuse other standards like XPath which uses that symbol.
If you need special characters for presentation purposes, I would suggest
you rely on your code or move that information to an attribute or element
content.

"Nimrod Cohen" <nim_co@hotmail.com> wrote in message
news:ulytR$WvDHA.2712@TK2MSFTNGP11.phx.gbl...
>
>
> Hi,
>
> newbie that i am in .Net, i'm trying to add "D/T" as a new element in C#
> :
> XmlElement elemAttr =
> (XmlElement)m_xmlDoc.AppendChild(m_xmlDoc.CreateElement("D/T" ) );
>
> but the framework throws an XmlException ...
>
> how do i overcome this ? do i have to parse the string for special chars
> myself ?
>
> please advise,
>
> thanks , nim_co.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


0
peter4320 (19)
12/8/2003 10:11:46 AM
* Nimrod Cohen wrote in microsoft.public.dotnet.xml:
>newbie that i am in .Net, i'm trying to add "D/T" as a new element in C#
>:
>XmlElement elemAttr =
>(XmlElement)m_xmlDoc.AppendChild(m_xmlDoc.CreateElement("D/T" ) );
>
>but the framework throws an XmlException ...

Since "D/T" is not a legal XML element name.

>how do i overcome this ? do i have to parse the string for special chars
>myself ?

It is (or should be) impossible to overcome this.
0
bjoern1 (135)
12/8/2003 5:08:26 PM
Reply:

Similar Artilces:

Creating a group of cells. Need Help Please.
Havn't used excel in a while and I need to create a group of cell corresponding to an input of a min and a max. Here are the details. On one sheet I have a box where you enter th min and a box where you enter the max. In another sheet I want column starting at A2 to output (MIN,A2+1000,A3+1000,....MAX) ho would I do this -- Thundersix ----------------------------------------------------------------------- Thundersixx's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3055 View this thread: http://www.excelforum.com/showthread.php?threadid=50207 Name the...

Any XML Naming Conventions?
Does the use of DTD, XML Schema and similar constructs adopt the use of C# naming conventions? If so how do I make the distinction of how to apply C# conventions with XML elements, attributes and so on? Any referrals to resources that discuss or document XML Naming Conventions? -- <%= Clinton Gallagher, "Twice the Results -- Half the Cost" Architectural & e-Business Consulting -- Software Development NET csgallagher@REMOVETHISTEXTmetromilwaukee.com URL http://www.metromilwaukee.com/clintongallagher/ clintonG wrote: > Does the use of DTD, X...

Combining cells to create a formula
Hi, I have two cells that I want to combine to have a working formula B1 = sum B2 = d3 b3 = =b1&"("&b2&")" D3 = 10 The result in b3 is : sum(d3) How do I get this to result in the actual value in D3. I know I can simply write =D3, but the actual reason for combining the two cells is more complicated than explained here. Thanks Hi I think you are perhaps looking for the Indirect function =INDIRECT("D"&ROW(3:3)) would return the value contained in D3 As you copy down, the formula would alter to 4, 5 etc. represent D4, D5 etc. -- Regards R...

create a mass of mailboxes
hi and thanks in advance for your help, I've an exchange 2003 and I have to create a great number (3000) of account and mailboxes. I want to use a script to create them starting from a xls or csv file. There are same script that create the account in a progressive way but I can't use them. Is there something different to use? lucadb Try this link and refer to the section "Active Directory tools and application programming interfaces" http://www.microsoft.com/technet/prodtechnol/exchange/guides/e2k3InterOpMig/39d728f1-62e1-44aa-93c8-930fed46f4e1.mspx "lucadb"...

How to create a CustomerID field for custom entities
Hi, The customerid field is used in opportunity and case and it allows you to select an account or contact, Great. I want to create this field in a form for a new entity i have made, but i cant work out how. Please help. Hi Michael, Customer is special composite type which is not available for custom entities in CRM 3. You will need to add two separete lookup fields for account and contact. -- uMar Khan :: MS CRM MVP CRM Freelance Consultant Email :: imumar at gmail dot com Blog :: http://umarkhan.wordpress.com MVP :: https://mvp.support.microsoft.com/default.aspx/profile/umar.khan &...

How do I send a welcome message to a new created mailbox automatically?
My exchnage send a message automatically but I need to change the message where do I change it? Thanks, Ron On Tue, 21 Jun 2005 16:35:53 -0700, "Ron" <rony@geotestinc.com> wrote: >My exchnage send a message automatically but I need to change the message >where do I change it? > >Thanks, >Ron > Exchange doesnt do that unless you have something scripted. If you are referring to the welcome message in Outlook, its called welcome.msg , but I dont think its been used since Outlook 2002. So where would I plug in the script? Also I searched for welcome.ms...

Creating a template using Publisher
I need help creating a neighborhood directory template using Publisher and merging an Excel spreadsheet into it. It keeps printing multiple pages of the first page after I merge. What version Publisher? If you have 2003 use the catalog merge for your directory. http://office.microsoft.com/en-us/assistance/CH010504381033.aspx Otherwise you need to setup your page as though it is labels. Determine the size of the area you need for each entry, select labels in page setup, type the size you determined in the page setup. Adjust the gaps and margins when you are ready to print (2000 and bel...

Creating a "Do_Not_Reply" e-mail address
I need to create a do-not-reply@domain.com address that any user that I give permission to on the domain can send as by putting the above address in the "From:" field of their Outlook client and the external recipient will receive this and only see that it came from the do-not-reply address and not the send on behalf of user. Also what would be the best way to block or not receive the e-mails even if an external user does reply to it? On Fri, 13 Apr 2007 20:56:22 -0700, "D-a-n_L" <dlajoie@hotmail.com> wrote: >I need to create a do-not-reply@domain.com addr...

Creating a Microsoft Words document from an existing Excel spreads
Hi all, I need your kind guidance on how to create a new microsoft words document using an existing excel spreadsheet? At present, I have an excel spreadsheet, say "data.xls" containing data for example 6 fields such as COMPANY NAME, DATE, ITEM1, ITEM2, ITEM,3 & QUOTATION TOTAL. Under these 6 fields are some records of my customers. COMPANY NM DATE ITEM1 ITEM2 ITEM3 QUOTATION TTL ---------------- ------- -------- ------- -------- ------------------- ABC Limited 3 Apr xxxxx xxxxx ...

How to get XML data out of an XML file
I am trying to retrieve the Parameters first or second (0, 1 ,2) node from the following XML file: <?xml version="1.0" encoding="utf-8" ?> <Robot xmlns="http://tempuri.org/RobotDefaults.xsd"> <Parameters> <Name>Decker</Name> </Parameters> <Parameters> <Name>A</Name> </Parameters> <Parameters> <Name>B</Name> </Parameters> </Robot> There will be more data than just a name for each Parameters node. Here is my code: Dim node As XmlNode = xmlDocument.SelectSingleNode("/P...

Can I create sub-functions in a cross-functional flowchart?
Trying to create a template for my organization to map processes to. Goal is to map the organization to the 'function bars' in Visio's cross-function flowcharts. However, I would like to create some 'sub-functions' for lower organizational elements (i.e. divisions under a department). Is this possible?? ...

XML as a database that can be written to
Has anyone had any luck using XML as a database that not only can be read, but also written to? What features are available in .NET to do this? I need to do all of this from a Web based application. Am I thinking File System Object? Thanks. mjc wrote: > Has anyone had any luck using XML as a database that not only can be read, > but also written to? That's doable, but you better use real database instead. XML wasn't meant to be used as a database, it's just a data format. -- Oleg Tkachenko [XML MVP] http://blog.tkachenko.com Yes, it can be done and I think its an id...

Problems with loading xml from XmlTextWriter
I use an XmlTextWriter to generate xml data. The declaration is: System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter sw = new System.IO.StringWriter(sb); XmlTextWriter w = new XmlTextWriter(sw); And I write to it using .... w.WriteElementString("foo","bar"); When the creation is done, I need to load it into DOM to select an XmlNode or an XmlElement to apply to another method (which I cannot control). I thought I could do it with: XmlDocument xDoc = new XmlDocument(); xDoc.Load(sb.ToString()); XmlNode node = xDoc.SelectSingleNode(&...

New Named Range Created Each Time Data Imported into Excel via Macro
I have noticed that each time I import data into an Excel spreadsheet via a macro, a new named range (for the same range) is created. This does not pose a problem, but after a while, I'll have a huge number of named ranges that will never be used. Why does Excel name the range and how can I stop this? I noticed in the recorded macro, there was a line .Name = "drd_5". I commented this out to see what would happen, but it just renamed the range "ExternalData_5". The next one was "ExternalData_6", etc. Thanks, Carroll Rinehart You could refresh with differen...

Creating a worksheet in Spanish
Hello, Is there a way to create a worksheet on MS XP Pro running Office 2003 Pro all in Spanish? Thank You Kent Hansen Hi Kent All valid formulas -except the ones from the Analysis Toolpack- will automatically translate to the language of the Excel it's opened in. So any spanish speaking Excel will translate formulas to spanish, no matter which version it was written in. The rest, text constants and such, has to be typed or pasted. Excel will not translate this herself. HTH. Best wishes Harald "Kent" <Kent@discussions.microsoft.com> skrev i melding news:ACCCBA3A-53B4...

5 steps to create a publication,the workplan
I need to know at least 5 steps to creating a workplan in pulisher. homework? 1- turn on computer 2- open Publisher 3- File | New 4- File | Page Setup 5- Design your thing 6- File | Save your thing oops thats 6 "thinking" <thinking@discussions.microsoft.com> wrote in message news:1B4E2A10-BCB0-473D-B52A-EFCBB658D856@microsoft.com... |I need to know at least 5 steps to creating a workplan in pulisher. Thinking? This newsgroup is dedicated to solving problems with MS Office Publisher. Not doing your class assignment. "thinking" <thinking@discussions.micros...

Creating PDF files in MFC
Hi, I want to create PDF files in MFC. Does anyone know how should I do it? Thanks in advance. Check out the following http://sourceforge.net/projects/pdfcreator/ "Shahoo" wrote: > Hi, > I want to create PDF files in MFC. Does anyone know how should I do > it? > Thanks in advance. > > Here's another to try out: "Shahoo" <shahookamangar@gmail.com> wrote in message news:1175272390.190193.274530@n59g2000hsh.googlegroups.com... > Hi, > I want to create PDF files in MFC. Does anyone know how should I do > it? > Thanks in advanc...

LOOK AT- x-PUBS LONDON- XML.....
Hi Have you seen www.x-pubs.com I think it will be very interesting for your audience. X-Pubs is Europes largest XML publishing conference. We have Ann Rockley, JoAnn Hackos, UBM, Mark Logic, XMetal, Idiom all speaking plus a lot more ...

Excel deleting xml item problem
I have an excel macro (in an add-in) that is called by the main excel macro that is deleting various items in an xml file When it gets to the last line as below it generates the following message “An unhandled error occurred: Object variable or with block not set” the variable is dimensioned see Dim statement that I have copied here. This has worked for some time with no problem but suddenly out of the blue generates this error. I have tried replacing the xml file with a copy, also tried replacing the add-in with a copy (in case either have been corrupted). The error desc...

Can I create a CScrollView popup window?
Hi, My application displays video from a firewire camera. The video is displayed in a CScrollView derived window that I create in CMainFrame::OnCreate() like this: m_pImageView = new CImageView; m_pImageView->Create(NULL, NULL, WS_CHILD | WS_VISIBLE, rClient, this, AFX_IDW_PANE_FIRST, NULL)) Now, when the user stops the video, they can click a toolbar button that pops up a CWnd derived window that displays all of the image data on a particular line of video. So, if the camera is spewing out 8-bits per pixel in the 800x600 mode, the popup window would display the 800 bytes associated w...

can CPropertyPage be created without resource template ?
One does not require a resource template in the resources to create a CDialog One can create DLGTEMPLATE object and use it in CDialog::InitModalIndirect( My question is can a CPropertyPage be created without having a template in th resources. Can I tie it with a DLGTEMPLATE ~Amit "Amit" <anonymous@discussions.microsoft.com> wrote in message news:9BC80E8C-1D6C-411F-87C4-66120D09C105@microsoft.com... > > One does not require a resource template in the resources to create a CDialog. > One can create DLGTEMPLATE object and use it in CDialog::InitModalIndirect() > &...

Creating aCRM activity from SFO
I want to send an email that will create an activity for a CRM user. I took an existing e-mail that I had previously sent and clicked on "Promote to CRM activity." I thought this would assign the email as an actrivity to this CRM user. But when I looked in CRM Workplace, the activity did not show up until I looked under "Completed Activities." Why was the e-mail marked as complete? Maybe I don't understand the concept. How do I generate an open activity (something that needs to be followed up on) for a specific user from within SFO? Maybe what I really should be ...

Creating a new OST file when Exhange is in recovery mode
After a member of staff left we created a new user account on the pc and changed Outlook to use it. When connecting to the server we now get a message that Exchange is in recovery mode and asking if we want to connect or work offline. As I have already imported the emails into the new account we no longer need the old cache held in the current OST file. How do we create a new OST file? I did find instructions on Microsoft's Knowledge Base but the advice said to 'Disable Offline Use' however this option was greyed out so it couldn't be selected. We are using Small Bu...

Common uses for XML in an asp web application
I recently created an application that used an xml file to define 4 different groups used for my app, and within each of those groups are <item></item> tags to declare different values that were used to lookup values in a database. This worked pretty well to allow me to dynamically create navigation buttons to perform operations etc.. Now i am trying to think of other common uses for xml that would make my apps even more scalable. I think I could have used xml again in my app for this operation althought i did not because of time constraints: Once records were grabbed from the d...

Procedures in Dex to create iv transfer document
Hi What are the procedures and functions in Dexterity to create a IV Transfer Document? Thanks Hi Cesar Please look in the Software Development Kit (SDK) at the Inventory Transaction Flow documentation. The SDK can be installed from the Tools folder of the second CD of the GP Install CDs or downloaded from PartnerSource or CustomerSource. David Musgrave [MSFT] Senior Development Consultant Escalation Engineer - Great Plains Microsoft Dynamics Support - Asia Pacific Microsoft Dynamics (formerly Microsoft Business Solutions) http://www.microsoft.com/Dynamics mailto:David.Musgrave@onli...