Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 3 Jul 2008 07:33:02 -0700,    group: microsoft.public.dotnet.xml        back       


Is this scenario possible?   
I've included an xml and a dtd file in my Resources folder (This is a 
Winforms VB project in VS2005.)  I'm planning on using the xml in Resources 
as a 'template', just load it and change values.  The beginning code is:

  Dim xDoc As New XmlDocument
  xDoc.LoadXml(My.Resources.NameOfXMLFile)
  ... do some stuff to XDoc

Given that, is it possible to use a DTD in Resources to validate the XML?  

(I admit I'm having some trouble following the documentation on this point.)
date: Thu, 3 Jul 2008 07:33:02 -0700   author:   B. Chernick

Re: Is this scenario possible?   
B. Chernick wrote:
> I've included an xml and a dtd file in my Resources folder (This is a 
> Winforms VB project in VS2005.)  I'm planning on using the xml in Resources 
> as a 'template', just load it and change values.  The beginning code is:
> 
>   Dim xDoc As New XmlDocument
>   xDoc.LoadXml(My.Resources.NameOfXMLFile)
>   ... do some stuff to XDoc
> 
> Given that, is it possible to use a DTD in Resources to validate the XML?  

That should be possible by using a custom implementation of XmlResolver 
that ensures that the system identifier is resolved by loading the DTD 
from the resource.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Thu, 03 Jul 2008 16:42:06 +0200   author:   Martin Honnen

Re: Is this scenario possible?   
That's just it.  The basic ref states that it 'Resolves external XML 
resources named by a Uniform Resource Identifier (URI). '  Does this apply to 
this situation?  

"Martin Honnen" wrote:

> B. Chernick wrote:
> > I've included an xml and a dtd file in my Resources folder (This is a 
> > Winforms VB project in VS2005.)  I'm planning on using the xml in Resources 
> > as a 'template', just load it and change values.  The beginning code is:
> > 
> >   Dim xDoc As New XmlDocument
> >   xDoc.LoadXml(My.Resources.NameOfXMLFile)
> >   ... do some stuff to XDoc
> > 
> > Given that, is it possible to use a DTD in Resources to validate the XML?  
> 
> That should be possible by using a custom implementation of XmlResolver 
> that ensures that the system identifier is resolved by loading the DTD 
> from the resource.
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
>
date: Thu, 3 Jul 2008 10:08:08 -0700   author:   B. Chernick

Re: Is this scenario possible?   
B. Chernick wrote:
> That's just it.  The basic ref states that it 'Resolves external XML 
> resources named by a Uniform Resource Identifier (URI). '  Does this apply to 
> this situation?  


Based on your previous post where you have
   <!DOCTYPE BDD SYSTEM "EAI.dtd">
the EAI.dtd is a (relative) URI that needs to be resolved to load the 
external DTD. If you put that into a .NET assembly as a resource then 
you need to provide a custom implementation of XmlResolver so that the 
XML parser finds the DTD in the assembly.
See 
http://www.hanselman.com/blog/LoadingXmlSchemaFilesOutOfAssemblyResources.aspx 
for an example, it deals with schemas but the mechanism is the same 
whether the parser needs to access a referenced DTD or a referenced schema.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Fri, 04 Jul 2008 13:13:22 +0200   author:   Martin Honnen

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us