Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / February 2008

Tip: Looking for answers? Try searching our database.

Adding newline hex character to XmlText node in XmlDocument

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fabian - 20 Feb 2008 15:20 GMT
When I create a XmlText node containing the new line hex character "
" it is
masked to "
" when I save the document object to a file. I guess this is
due to the fact that the "&" character is reserved. How can I write a "
"?

Thanks in advance for your help,

Fabian
Peter Flynn - 20 Feb 2008 15:33 GMT
> When I create a XmlText node containing the new line hex character "
> " it is
[quoted text clipped - 4 lines]
>
> Fabian




///Peter
Signature

XML FAQ: http://xml.silmaril.ie/

Fabian - 21 Feb 2008 07:43 GMT
Hi Peter,

"
" results in "
". So this can't be the solution. Do you
perhaps have a different idea?

Thx,

Fabian
Martin Honnen - 21 Feb 2008 12:48 GMT
> When I create a XmlText node containing the new line hex character "
> " it is
> masked to "
" when I save the document object to a file. I guess this is
> due to the fact that the "&" character is reserved. How can I write a "
"?

Sorry, it is not clear what the problem is.
You say the new line character is masked as "
", then you ask 'how
can I write a "
"'.
If you already have "
", why do you ask how to write it?

It might be that you have typed something different into the web
interface but the above is what we see here in the newsgroup.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

Fabian - 22 Feb 2008 07:48 GMT
Hi Martin,

>It might be that you have typed something different into the web
> interface but the above is what we see here in the newsgroup.

You're right, the web interface also masks the ampersand. So basically the
problem is that I want to put write a \t and a \r\n into a
<xsl:text></xsl:text> node. The XmlDocument class' write method just inserts
a tab or line feed into the xml (resp. xsl) file which in the end produces
the right result in the xsl transform but doesn't make the xsl file look as I
want it to look like. This also happens if I insert the hex character "\xa"
instead of the \n. So I would like to have the newline written explicitely as
it's masked equivalent instead of having a newline in the xls file's text.

Thanks,

Fabian
Martin Honnen - 22 Feb 2008 15:13 GMT
> You're right, the web interface also masks the ampersand. So basically the
> problem is that I want to put write a \t and a \r\n into a
[quoted text clipped - 4 lines]
> instead of the \n. So I would like to have the newline written explicitely as
> it's masked equivalent instead of having a newline in the xls file's text.

With .NET 2.0 and XmlWriterSettings with NewLineHandling =
NewLineHandling.Entitize you can have \r entitized as &#D; (& # D; for
the web interface) but it does not do the same for \n or \t. If you want
to achieve that for those characters too then I think you have to
implement your own XmlWriter that does the encoding as needed. You can
then pass such an XmlWriter to the Save method of your XmlDocument instance.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.