XmlWriter localization

Hi all,

i have to generate a xml file from a product table using the XmlWriter 
Class.
I want to put out de product name for different languages, countries.
The recipient of the generatet xml file espects something like that:

<name xml:lang="en-US">product name</name>
<name xml:lang="de-DE">Produktname</name>

I have no idea how to realize this:(


I hope someone can help me with this issue.

Thanks 


0
9/28/2007 8:53:51 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
719 Views

Similar Articles

[PageSpeed] 24

Hi Peter,

Hmm... did you mean this:

Writer.WriteStartElement("name");
Writer.WriteAttributeString("xml", "lang", string.Empty, "en-En");
Writer.WriteString("product name");
Writer.WriteEndElement();

Regards, Alex
[TechBlog] http://devkids.blogspot.com



> Hi all,
> 
> i have to generate a xml file from a product table using the XmlWriter
> Class.
> I want to put out de product name for different languages, countries.
> The recipient of the generatet xml file espects something like that:
> <name xml:lang="en-US">product name</name>
> <name xml:lang="de-DE">Produktname</name>
> I have no idea how to realize this:(
> 
> I hope someone can help me with this issue.
> 
> Thanks
> 


0
ameleta (7)
9/29/2007 8:32:49 AM
>
> Hmm... did you mean this:
>
> Writer.WriteStartElement("name");
> Writer.WriteAttributeString("xml", "lang", string.Empty, "en-En");
> Writer.WriteString("product name");
> Writer.WriteEndElement();
>
yes, thank you!

now i have the next problem:
i have to generate this:
<custom-attribute xml:lang="de-DE" dt:dt="string" 
name="displayName">Farbe</custom-attribute>

but what i get ist this:
<custom-attribute xml:lang="de-DE" dt="string" 
name="displayName">Farbe</custom-attribute>

using: writer.WriteAttributeString("dt", "dt", String.Empty, "string")

any idea?

thanks in advance, Peter 


0
9/30/2007 9:22:29 PM
Reply:

Similar Artilces:

generating an XmlDocument from an XmlWriter
hi, I would like to make an XmlWriter write directly into an XmlDocument rather than writing it to a stream and then having to load it into a document. in the documentation for XmlWriter it rather tantalizingly says: "... For example, if you are using the XmlWriter to populate an XmlDocument ...." (just google for that phrase to see it in context) which implies that it it possible to do what I want, but I can't see any way of doing that. Andy Andy Fish wrote: > hi, > > I would like to make an XmlWriter write directly into an XmlDocument rather > than writ...

XMLWriter and NumberDecimalSeparator
Hello, All! Is it possible to change parameters of locale for writing XML file (with XMLTextWriter)? I want to change NumberDecimalSeparator from "," to "." Regards, Vyacheslav ...

CRM 3.0 Local Data Group Maintenance
Dear all, I'm missing a tool to maintain local data groups for new users. It's not feasible to manually generate, configure 20+ new datagroups for each new user!!! what can you recommend? will there be a tool from microsoft (CRM 4.0 :-( )? TIA Stefan ...

C++ to read cookies created by local HTML file
HI, I'm using VS2003, C++. I tried to retrieve the cookies which are created by a local HTML file with JavaScript. I read the article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/win inet/managing_cookies.asp and copy the code. Unfortunately, the retrieved cookie strings are always empty. Anyone can shed some light on this or lead me somewhere with C++ CGI code stuff? Thanks in advance. Susan Both InternetGetCookie / InternetSetCookie work as expected, something is wrong with your code. "Susan Kong" <susan@365rainbow.com> wrote in mess...

XmlWriter.WriteAttributeString()
The WriteAttributeString() method(s) of System.Xml.XmlWriter Class is embedding the Value parameter within double quotes. Is it possible to change this behaviour such that the Value is instead put within Single Quotes (Apostrophes)? -- Regards Senthil SS. SenthilSS wrote: > The WriteAttributeString() method(s) of System.Xml.XmlWriter Class is > embedding the Value parameter within double quotes. Is it possible to change > this behaviour such that the Value is instead put within Single Quotes > (Apostrophes)? Take a look at the QuoteChar property. -- Oleg Tkachenko [XML ...

The Local Security Authority cannot be contacted #2
Ok group, I have been researching this problem all morning and can't find a solution. This all of a sudden started happening this morning. I believed it to be a certificate corruption problem, but I removed the certificate with IIS. Disabled the "require 128 bit encryption". So it shouldn't be looking for encryption. But when i go to the OWA site, i get this error with specific people only. I can log in as other people. I created a new account based on our template user, no problems at all. I am just having this with a few people. There are time errors but I don't underst...

XmlWriter localization
Hi all, i have to generate a xml file from a product table using the XmlWriter Class. I want to put out de product name for different languages, countries. The recipient of the generatet xml file espects something like that: <name xml:lang="en-US">product name</name> <name xml:lang="de-DE">Produktname</name> I have no idea how to realize this:( I hope someone can help me with this issue. Thanks Hi Peter, Hmm... did you mean this: Writer.WriteStartElement("name"); Writer.WriteAttributeString("xml", "lang", st...

Call a local function from a property page?
I would like to give my users a "test" button on a property page to allow them to try a set of parameters before commiting to them. How can I call a function from a property page? There would be no interaction with the function but if possible, I would like to get a returned parameter. Ron H. It depends where the function is. If it's in the page class then just call it. If it's in the document class then you'll need a pointer to that. You'll have to give more details if you need further help. "Ron H" <rnh@no.spamm.net> wrote in message news:B...

Single payroll transactions should allow for mult local taxes
Currently if an employee works in more than one state, one of which having a locality with mutliple local taxes, there is no way to enter a single payroll transaction and assign multiple localities. This makes management of local taxes very difficult under certain situations. (Lives in Tenn and works 80% of time there, but 20% in Kentucky in a town with County, City and School local taxes.) ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the mess...

Deserialization Problems Using XmlWriter vs. StringReader
I'm experiencing issues where XmlSerialier.Deserialize throws an exception when attempting to use a MemoryStream built with an XmlWriter vs. a standalone StringReader. It is attempting to deserialize a complex object. Here is what I have: 0. Environment: Visual Studio 2005, VB.Net. I won't go into the gory details of my complex object, just suffice to say that I need to return XML instead of the object directly from the web service. I'm also not including all of the code around things (try..catches, etc.) 1. I've defined a object built by using the Xsd.exe tool against a ...

Transforming to an XmlWriter
The following blog gives a neat example of how to transform directly into a node: http://blogs.msdn.com/xmlteam/ However, the code doesn't seem to work as it is presented in the blog. I have put together the following three test cases to show this. The first two work correctly, the last one doesn't. BTW...the last one is codes according to the blog entry. ------------------------------ System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform(); System.Xml.XmlDocument OutputDoc = null; System.Xml.XmlWriter w = null; ...

3rd party hosting e-mail with local Exchange Server
Good evening! I have a silly question. Here is the situation: A company has an internal Exchange Server (2003 Standard SP2) but also has a third party hosting their e-mail (MX record points to the third party hosting company). Outlook 2003 is configured with two profiles. The first one (default) is a POP3/SMTP profile that points to the hosting company (so, pop.company.com and smtp.company.com) and the second profile is the 'Exchange' profile. The storage location used to be a local "outlook.pst" but this has recently been changed to the user's mailbox. My que...

Beginner Questions on localizing Dialog Data.....
All, I have a app that has one entry point for users to enter their username and password. Currently its a dialog that uses a CString. This app needs to be converted to Chinese and I am having problems with the values coming in. What data type should the text values be for the Dialog Data? Thanks, Chris SolomonMan > What data type should the text values be for the Dialog Data? May be I am missign something, but you already are using a CString for it. Why is it not sufficient? -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com I agree with Ajay. If you're going to use MFC you may...

XmlWriter.WriteString() problem.
According to the Microsoft documentation, the .NET class System.Xml.XmlWriter.WriteString() does the following: "Character values in the range 0x-0x1F (excluding white space characters 0x9, 0xA, and 0xD) are replaced with numeric character entities (&#0; through &#0x1F)." However, when we call WriteString() in an application we have written, we are seeing the following exception being thrown: System.ArgumentException: '', hexadecimal value 0x12, is an invalid character. at System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(Int32 ch, Byte* pDst, Boolean entiti...

XMLWriter and XMLDocument
Okay I am using an XMLDocument object to process several thousands of lodgements (from a database) I am trying to output it from an XML Document to a file using the XmlDocument.WriteTo() method with an XmlWriter. It writes 131kB and then cuts out halfway through an element Is this a limitation of XmlDocument.WriteTo() ? What would be a better way to output it Thanks Ensure you're calling XmlWriter.Close() to cause the buffered writes to be flushed to the underlying stream/textwriter. -- Daniel Cazzulino [MVP XML] Clarius Consulting SA http://weblogs.asp.net/cazzu http://aspnet2.com ...

XmlWriter with ConformanceLevel.Fragment
Hi I keep getting error : WriteStartDocument cannot be called on writers created with ConformanceLevel.Fragment. The code that I have is very simple. SimpleClass c = new SimpleClass(); c.Name = "TestName"; XmlSerializer serializer = new XmlSerializer(typeof(SimpleClass)); MemoryStream stream =new MemoryStream(); XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; settings.ConformanceLevel = ConformanceLevel.Fragment; settings.Encoding = Encoding.ASCII; XmlWriter writer = XmlWriter.Create(stream,settings); serializer.Serialize(write...

XmlWriter newbie question
I'm trying, for the first time, to write XML to a string that will be sent out to a web service. According to the docs I have found... An XmlWriter needs a XmlTextWriter that needs a StreamWriter that needs a stream. (is it really this hard?) So I'm defining... System.IO.Stream astream; TextWriter myw = new StreamWriter(astream); <--this says astream is an unassigned variable XmlTextWriter mytw = new XmlTextWriter(myw); so it won't compile because it says astream is not defined. Are there any examples anywhere on how to write xml to a string, or a stream? -- Regards,...

How to use xmlwriter to add an attribute to any element?
I want to make my XML as such: <parentItem> <childItem attribute="myAttribute">myContent</childItem> </parentItem> I thought I could just do this: objXMLWriter.WriteElementString("childItem", "myContent") objXMLWriter.WriteAttributeString("attribute", "myAttribute") But...I get an error. And I found this that explains why: http://weblogs.asp.net/sonukapoor/pages/204572.aspx However, it only explains why it happens, not how to actually do what I want. From what I can tell, WriteAttributeString can ONLY be applie...

XMLWriter and NumberDecimalSeparator #2
Hello, All! Is it possible to change parameters of locale for writing XML file (with XMLTextWriter)? I want DataSet.WriteXML() to use NumberDecimalSeparator "." instead of "," Regards, Vyacheslav Vyacheslav Lanovets wrote: > I want DataSet.WriteXML() to use NumberDecimalSeparator "." instead of "," I don't think the result of WriteXml depends on the locale (or culture as .NET calls it), for instance the output in the following example is always the same, even if the culture is changed: DataSet dataSet = new DataSet("DoubleT...

Issue with local named relative range
Thanks to the Excel wizards here, I got some great tips back in November with creating a way for a cell to refer to itself (e.g. THIS) or the cell above it in a formula. If the active cell is A2, I can define a name. e.g. CellAbove, that refers to A1 (no dollar signs = relative reference). This was a pleasant surprise for me, as I had not realized nor ever tried to create a named relative range. However, I've now come across an issue with this technique and I hope the wizards will assist once again. It seems that Excel (2003 at least) always places the sheet name in the refere...

XML , text, from xmlwriter.
Is there a simple way to get the text, xml, from an xmlwriter. I have a XML writer that writes to a file, and I want another function to return the text that the xml writer is produced. Any suggestions? MAF wrote: > Is there a simple way to get the text, xml, from an xmlwriter. > > I have a XML writer that writes to a file, and I want another function to > return the text that the xml writer is produced. Use an XmlWriter over a StringWriter e.g. StringWriter stringWriter = new StringWriter(); using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter)) { xmlWrit...

Local Queue
Hello, Just a simple question on Exchange 2003 queue. Basically I want to queue external mail on my exchange servers for 48 hours in preperation for some of my other exchnage servers moving. I have set the Default Local SMTP server to 2 days on the Virtual SMTP server? Is this Correct? Default expiration timeout on SMTP virtual servers is 2 days. Additionally you can adjust the delay timeout as well if you want - notifies senders of delays at end of this interval. -- Bharat Suneja MCSE, MCT www.zenprise.com blog: www.suneja.com/blog ----------------------------------------- "...

find if local variable exists
Hello there I have two procedures which one calls another. Proc1 sometimes declare @@var and sometimes not. I would like to build statement on Proc2 that if @@var exists do one else do another thing. Is there a way to do it without try..catch? > I have two procedures which one calls another. Proc1 sometimes declare > @@var and sometimes not. > > I would like to build statement on Proc2 that if @@var exists do one else > do another thing. > > Is there a way to do it without try..catch? I'm not sure I understand your question. Declared var...

how to write this out using xmlwriter
Hi I have a .net application and am using the xml writer class to create an xml file that opens as an excel file. I am trying to write out the following but am having difficulty. <Row> <Cell ss:StyleID="s87"> <ss:Data ss: Type = "String"> <Font html:Color="#FF0000">M90</Font> <Font>/Thu</Font> </ss:Data> </Cell> This produces a cell with text with part of the text being red the M90 and the other part being black. I also have the following strings set up in my code string sprea...

The Local Security Authority cannot be contacted
I have enabled in Active Directory restricted login to computers for various users allowing them to only log on to their personal workstations. Doing so has made it so they can no longer access the Outlook Web Access. When I set the user to be able to log on to all computers then OWA works fine. Does anyone know how to enable restricted workstation logon and still allow the user to access OWA. I did allow the user logon rights to the mail server, but that didn't work. The error displayed to the user is: The Local Security Authority cannot be contacted. There are no additional errors in the...