DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sat, 11 Aug 2007 17:15:17 -0600,    posted on: microsoft.public.dotnet.xml        back       

Thread Index
  1    Rick
          2    Martin Honnen
                 3    Rick


xpathnavagator no xml declaration   
Net 2.0

I'm using xml to store company configuration settings in a BLOB database 
field.

I create an xPathNavigator like this:

Dim doc As XmlDocument = New XmlDocument

Dim strXml As String = (-read the xml string from the db)

Dim sr As New System.IO.StringReader(strXml)

doc.Load(sr)

xnav = doc.CreateNavigator

And then use the xnav to read and set fields from the application.

When I save the xml string back to the database, I loose the xml declaration 
"<?xml version="1.0" encoding="UTF-8" ?>" with xnav.outerxml.

Is there some way to get the xml string WITH the xml declaration?



Rick
Date:Sat, 11 Aug 2007 17:15:17 -0600   Author:  

Re: xpathnavagator no xml declaration   
Rick wrote:

> Net 2.0
> 
> I'm using xml to store company configuration settings in a BLOB database 
> field.
> 
> I create an xPathNavigator like this:
> 
> Dim doc As XmlDocument = New XmlDocument
> 
> Dim strXml As String = (-read the xml string from the db)
> 
> Dim sr As New System.IO.StringReader(strXml)
> 
> doc.Load(sr)
> 
> xnav = doc.CreateNavigator
> 
> And then use the xnav to read and set fields from the application.
> 
> When I save the xml string back to the database, I loose the xml declaration 
> "<?xml version="1.0" encoding="UTF-8" ?>" with xnav.outerxml.
> 
> Is there some way to get the xml string WITH the xml declaration?


The XPath data model does not know about XML declarations so the 
XPathNavigator does not have them. With .NET the DOM model contains an 
XML declaration so you should use doc.OuterXml (or use the Save method 
of the XmlDocument doc) if you want an XML declaration.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
Date:Sun, 12 Aug 2007 13:38:57 +0200   Author:  

Re: xpathnavagator no xml declaration   
Thanks Martin,

Perhaps I will leave it as it is without the xml declaration since it is 
only for internal use and there seems to be no problem reading/writing to 
the saved document.

Rick

"Martin Honnen"  wrote in message 
news:ervCjVN3HHA.5116@TK2MSFTNGP04.phx.gbl...

> Rick wrote:
>> Net 2.0
>>
>> I'm using xml to store company configuration settings in a BLOB database 
>> field.
>>
>> I create an xPathNavigator like this:
>>
>> Dim doc As XmlDocument = New XmlDocument
>>
>> Dim strXml As String = (-read the xml string from the db)
>>
>> Dim sr As New System.IO.StringReader(strXml)
>>
>> doc.Load(sr)
>>
>> xnav = doc.CreateNavigator
>>
>> And then use the xnav to read and set fields from the application.
>>
>> When I save the xml string back to the database, I loose the xml 
>> declaration "<?xml version="1.0" encoding="UTF-8" ?>" with xnav.outerxml.
>>
>> Is there some way to get the xml string WITH the xml declaration?
>
> The XPath data model does not know about XML declarations so the 
> XPathNavigator does not have them. With .NET the DOM model contains an XML 
> declaration so you should use doc.OuterXml (or use the Save method of the 
> XmlDocument doc) if you want an XML declaration.
>
> -- 
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/ 
Date:Sun, 12 Aug 2007 06:46:18 -0600   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us