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: Mon, 30 Jun 2008 13:45:00 -0700,    group: microsoft.public.dotnet.xml        back       


Big picture questions - cleanest method for creating an XML file   
I am not accustomed to creating xml files programmatically.  The big picture 
is this: This will be in VB/VS 2005/ winforms.  I have a DTD, a sample XML, 
and an outside data source I will use to populate the XML.  In general I 
think I know how to create elements and attributes and I'm sure I can hack 
something together but I'm wondering if I'm missing (or forgetting) a better 
way (other than a long line of hard-coded CreateElement commands).  
Suggestions please.

-----

A related problem: the XML header, for lack of a better term.  If we assume 
creation of an XmlDocument object from scratch, how do I add the header 
elements?  I cannot find any discussion of this.  (Feel free to correct my 
terminology.)

This is what I'm referring to -

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE SOME TEXT "DTDName.dtd">
<?xml-stylesheet href="SampleXml.xslt" type="text/xsl" ?>
date: Mon, 30 Jun 2008 13:45:00 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML file   
As to the header you shouldn't need to add it. It is created when the 
document is serialised and isn't always needed, it depends on the encoding 
used.
I agree that creating documents by dozens of CreateXXX statements is not 
nice.
How changeable are the documents. I often start with a template, either a 
string constant, in a resource file or an actual file and load this first. 
Then I alter it as needed.


-- 

Joe Fawcett (MVP - XML)

http://joe.fawcett.name

"B. Chernick"  wrote in message 
news:D332B170-4DDF-4D4B-9F8E-A4B233E7C652@microsoft.com...
>I am not accustomed to creating xml files programmatically.  The big 
>picture
> is this: This will be in VB/VS 2005/ winforms.  I have a DTD, a sample 
> XML,
> and an outside data source I will use to populate the XML.  In general I
> think I know how to create elements and attributes and I'm sure I can hack
> something together but I'm wondering if I'm missing (or forgetting) a 
> better
> way (other than a long line of hard-coded CreateElement commands).
> Suggestions please.
>
> -----
>
> A related problem: the XML header, for lack of a better term.  If we 
> assume
> creation of an XmlDocument object from scratch, how do I add the header
> elements?  I cannot find any discussion of this.  (Feel free to correct my
> terminology.)
>
> This is what I'm referring to -
>
> <?xml version="1.0" encoding="utf-8" ?>
> <!DOCTYPE SOME TEXT "DTDName.dtd">
> <?xml-stylesheet href="SampleXml.xslt" type="text/xsl" ?>
>
date: Tue, 1 Jul 2008 10:24:37 +0100   author:   Joe Fawcett am

Re: Big picture questions - cleanest method for creating an XML file   
B. Chernick wrote:
> I am not accustomed to creating xml files programmatically.  The big picture 
> is this: This will be in VB/VS 2005/ winforms.  I have a DTD, a sample XML, 
> and an outside data source I will use to populate the XML.  In general I 
> think I know how to create elements and attributes and I'm sure I can hack 
> something together but I'm wondering if I'm missing (or forgetting) a better 
> way (other than a long line of hard-coded CreateElement commands).  
> Suggestions please.

If you convert the DTD into a schema then you can use XML 
serialization/deserialization:
http://msdn.microsoft.com/en-us/library/90c86ass(VS.80).aspx
You can use the xsd.exe tool to create .NET classes from the schema.

If you have relational data then you can also consider to populate a 
DataSet and use its WriteXml method.

> This is what I'm referring to -
> 
> <?xml version="1.0" encoding="utf-8" ?>

That is the XML declaration, it is created by the WriteStartDocument 
method of XmlWriter
http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writestartdocument.aspx 
or using CreateXmlDeclaration
http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createxmldeclaration.aspx 
in the DOM model.

> <!DOCTYPE SOME TEXT "DTDName.dtd">

That is a document type declaration, created using WriteDocType
http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writedoctype.aspx
of XmlWriter or using CreateDocumentType
http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createdocumenttype.aspx
method of XmlDocument.

> <?xml-stylesheet href="SampleXml.xslt" type="text/xsl" ?> 

That is a a processing instruction with the name 'xml-stylesheet' and 
the data 'href="SampleXml.xslt" type="text/xsl"' so you create it using 
WriteProcessingInstruction of XmlWriter
http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writeprocessinginstruction.aspx
or using CreateProcessingInstruction
http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createprocessinginstruction.aspx
of XmlDocument.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Tue, 01 Jul 2008 14:21:05 +0200   author:   Martin Honnen

Re: Big picture questions - cleanest method for creating an XML fi   
I don't mean to be rude but I'm afraid I didn't understand much your reply.  

This, so far as I know, is not a standard Dot Net situation. The purpose of 
the program, if it ever gets written, is to extract data from an Excel 
spreadsheet and plug it into a standalone XML file.   I'm afraid I've been 
given very little of the big picture.  I think it eventually gets fed into 
some mainframe system.

"Joe Fawcett" wrote:

> As to the header you shouldn't need to add it. It is created when the 
> document is serialised and isn't always needed, it depends on the encoding 
> used.
> I agree that creating documents by dozens of CreateXXX statements is not 
> nice.
> How changeable are the documents. I often start with a template, either a 
> string constant, in a resource file or an actual file and load this first. 
> Then I alter it as needed.
> 
> 
> -- 
> 
> Joe Fawcett (MVP - XML)
> 
> http://joe.fawcett.name
> 
> "B. Chernick"  wrote in message 
> news:D332B170-4DDF-4D4B-9F8E-A4B233E7C652@microsoft.com...
> >I am not accustomed to creating xml files programmatically.  The big 
> >picture
> > is this: This will be in VB/VS 2005/ winforms.  I have a DTD, a sample 
> > XML,
> > and an outside data source I will use to populate the XML.  In general I
> > think I know how to create elements and attributes and I'm sure I can hack
> > something together but I'm wondering if I'm missing (or forgetting) a 
> > better
> > way (other than a long line of hard-coded CreateElement commands).
> > Suggestions please.
> >
> > -----
> >
> > A related problem: the XML header, for lack of a better term.  If we 
> > assume
> > creation of an XmlDocument object from scratch, how do I add the header
> > elements?  I cannot find any discussion of this.  (Feel free to correct my
> > terminology.)
> >
> > This is what I'm referring to -
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <!DOCTYPE SOME TEXT "DTDName.dtd">
> > <?xml-stylesheet href="SampleXml.xslt" type="text/xsl" ?>
> > 
> 
> 
>
date: Tue, 1 Jul 2008 05:45:02 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML fi   
Thanks for your response.  I think you may have answered several other 
questions I've been wondering about.  However in this particular situation, I 
don't believe converting the DTD to an xsd is an option.  The output has to 
go to some legacy system that I don't have control over (so far as I know).

(I would have to translate the DTD manually, right?  There's no wizard or 
utility for such a conversion?   If I am not mistaken, DTDs obsolete and 
there's little or no support for them in Dot Net?)

"Martin Honnen" wrote:

> B. Chernick wrote:
> > I am not accustomed to creating xml files programmatically.  The big picture 
> > is this: This will be in VB/VS 2005/ winforms.  I have a DTD, a sample XML, 
> > and an outside data source I will use to populate the XML.  In general I 
> > think I know how to create elements and attributes and I'm sure I can hack 
> > something together but I'm wondering if I'm missing (or forgetting) a better 
> > way (other than a long line of hard-coded CreateElement commands).  
> > Suggestions please.
> 
> If you convert the DTD into a schema then you can use XML 
> serialization/deserialization:
> http://msdn.microsoft.com/en-us/library/90c86ass(VS.80).aspx
> You can use the xsd.exe tool to create .NET classes from the schema.
> 
> If you have relational data then you can also consider to populate a 
> DataSet and use its WriteXml method.
> 
> > This is what I'm referring to -
> > 
> > <?xml version="1.0" encoding="utf-8" ?>
> 
> That is the XML declaration, it is created by the WriteStartDocument 
> method of XmlWriter
> http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writestartdocument.aspx 
> or using CreateXmlDeclaration
> http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createxmldeclaration.aspx 
> in the DOM model.
> 
> > <!DOCTYPE SOME TEXT "DTDName.dtd">
> 
> That is a document type declaration, created using WriteDocType
> http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writedoctype.aspx
> of XmlWriter or using CreateDocumentType
> http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createdocumenttype.aspx
> method of XmlDocument.
> 
> > <?xml-stylesheet href="SampleXml.xslt" type="text/xsl" ?> 
> 
> That is a a processing instruction with the name 'xml-stylesheet' and 
> the data 'href="SampleXml.xslt" type="text/xsl"' so you create it using 
> WriteProcessingInstruction of XmlWriter
> http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writeprocessinginstruction.aspx
> or using CreateProcessingInstruction
> http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createprocessinginstruction.aspx
> of XmlDocument.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
>
date: Tue, 1 Jul 2008 05:50:00 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML fi   
B. Chernick wrote:

> (I would have to translate the DTD manually, right?  There's no wizard or 
> utility for such a conversion?   If I am not mistaken, DTDs obsolete and 
> there's little or no support for them in Dot Net?)

There are tools like Xml editors 
(http://www.stylusstudio.com/dtd/convert_dtd_to_schema.html) or Trang 
(http://www.thaiopensource.com/relaxng/trang.html) that can translate a 
DTD to a W3C schema.

As for .NET, it has support for validating an XML document against a DTD 
but besides that its API are pretty much focussed on W3C XML schemas.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Tue, 01 Jul 2008 15:10:37 +0200   author:   Martin Honnen

Re: Big picture questions - cleanest method for creating an XML fi   
> As for .NET, it has support for validating an XML document against a DTD 
> but besides that its API are pretty much focussed on W3C XML schemas.
Pretty much as I suspected.  Getting approval for 3rd party tools is 
problematic as well, especially for adhoc projects. :-)

On an earlier point, the use of WriteDocType, I am ready to tear my hair 
out.  I have this code and I cannot get it to work.  I keep getting the error 
'The '' character, hexiadecimal value 0x20, cannot be included in a name.'  
Frankly I'm out of my league here.  I cannot find any reference for the error 
or WriteDocType that I can understand.  Here's my test code:

 Dim w As XmlWriter = XmlWriter.Create("Out.xml")
 w.WriteStartDocument()
 w.WriteDocType("SOME TEXT", Nothing, Nothing, "DTDName.dtd")
 w.Close()

I've tried a number of variations on that including """DTDName.dtd""".  What 
do I have to do to get this one simple line of xml out to the file?  
<!DOCTYPE SOME TEXT "DTDName.dtd">

Thanks

"Martin Honnen" wrote:

> B. Chernick wrote:
> 
> > (I would have to translate the DTD manually, right?  There's no wizard or 
> > utility for such a conversion?   If I am not mistaken, DTDs obsolete and 
> > there's little or no support for them in Dot Net?)
> 
> There are tools like Xml editors 
> (http://www.stylusstudio.com/dtd/convert_dtd_to_schema.html) or Trang 
> (http://www.thaiopensource.com/relaxng/trang.html) that can translate a 
> DTD to a W3C schema.
> 
> As for .NET, it has support for validating an XML document against a DTD 
> but besides that its API are pretty much focussed on W3C XML schemas.
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
>
date: Tue, 1 Jul 2008 07:30:02 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML fi   
B. Chernick wrote:

>  Dim w As XmlWriter = XmlWriter.Create("Out.xml")
>  w.WriteStartDocument()
>  w.WriteDocType("SOME TEXT", Nothing, Nothing, "DTDName.dtd")

Well the first argument is the root element name and an element name is 
not allowed to contain a space so you need to decide which root element 
name you want (e.g. "some-name" or "some_name") and write that out. You 
can't use "SOME TEXT" as the space is not allowed.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Tue, 01 Jul 2008 16:47:07 +0200   author:   Martin Honnen

Re: Big picture questions - cleanest method for creating an XML fi   
The actual sample xml I was originally given has a line of:

<!DOCTYPE BDD SYSTEM "EAI.dtd">

Are you saying that this violates XML standards in general?

(Actually I should explain that for some reason I was convinced that the 
last parm of the line was the problem.  I didn't realize it was the first.  
This works:         w.WriteDocType("BDD-SYSTEM", Nothing, Nothing, "EAI.dtd")

but results in <!DOCTYPE BDD-SYSTEM [EAI.dtd]>    Why the brackets and is 
there any way to get rid of them?)

"Martin Honnen" wrote:

> B. Chernick wrote:
> 
> >  Dim w As XmlWriter = XmlWriter.Create("Out.xml")
> >  w.WriteStartDocument()
> >  w.WriteDocType("SOME TEXT", Nothing, Nothing, "DTDName.dtd")
> 
> Well the first argument is the root element name and an element name is 
> not allowed to contain a space so you need to decide which root element 
> name you want (e.g. "some-name" or "some_name") and write that out. You 
> can't use "SOME TEXT" as the space is not allowed.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
>
date: Tue, 1 Jul 2008 08:17:01 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML fi   
B. Chernick wrote:
> The actual sample xml I was originally given has a line of:
> 
> <!DOCTYPE BDD SYSTEM "EAI.dtd">
> 
> Are you saying that this violates XML standards in general?

No, it does not. The "BDD" is the root element name and "EAI.dtd" is the 
system identifier.

> (Actually I should explain that for some reason I was convinced that the 
> last parm of the line was the problem.  I didn't realize it was the first.  
> This works:         w.WriteDocType("BDD-SYSTEM", Nothing, Nothing, "EAI.dtd")
> 
> but results in <!DOCTYPE BDD-SYSTEM [EAI.dtd]>    Why the brackets and is 
> there any way to get rid of them?)

Use
   w.WriteDocType("BDD", Nothing, "EAI.dtd", Nothing)
to produce the line you posted above. The "SYSTEM" string will be 
automatically added as you pass in a third argument string, the system 
identifier.
See also the online documentation
http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writedoctype.aspx
or your local MSDN copy which explains the four arguments.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Tue, 01 Jul 2008 18:15:44 +0200   author:   Martin Honnen

Re: Big picture questions - cleanest method for creating an XML fi   
"B. Chernick"  wrote in message 
news:255E5673-B26C-4A0E-9D63-D7CEBB4D419B@microsoft.com...
>I don't mean to be rude but I'm afraid I didn't understand much your reply.
Okay
>
> This, so far as I know, is not a standard Dot Net situation.
Seems like a perfectly normal scenario

The purpose of
> the program, if it ever gets written, is to extract data from an Excel
> spreadsheet and plug it into a standalone XML file.   I'm afraid I've been
> given very little of the big picture.  I think it eventually gets fed into
> some mainframe system.
>

You said you wanted a way to avoid creating the whole file by hand, the file 
matches a known schema. So I suggested that start with an XML template that 
matched the schema and then make alterations to it based on the external 
data.


-- 

Joe Fawcett (MVP - XML)

http://joe.fawcett.name
date: Tue, 1 Jul 2008 17:28:05 +0100   author:   Joe Fawcett am

Re: Big picture questions - cleanest method for creating an XML fi   
Thanks for the help.  The call is finally doing what I need.  I don't see how 
I could have ever gotten that from that documentation.  

"Martin Honnen" wrote:

> B. Chernick wrote:
> > The actual sample xml I was originally given has a line of:
> > 
> > <!DOCTYPE BDD SYSTEM "EAI.dtd">
> > 
> > Are you saying that this violates XML standards in general?
> 
> No, it does not. The "BDD" is the root element name and "EAI.dtd" is the 
> system identifier.
> 
> > (Actually I should explain that for some reason I was convinced that the 
> > last parm of the line was the problem.  I didn't realize it was the first.  
> > This works:         w.WriteDocType("BDD-SYSTEM", Nothing, Nothing, "EAI.dtd")
> > 
> > but results in <!DOCTYPE BDD-SYSTEM [EAI.dtd]>    Why the brackets and is 
> > there any way to get rid of them?)
> 
> Use
>    w.WriteDocType("BDD", Nothing, "EAI.dtd", Nothing)
> to produce the line you posted above. The "SYSTEM" string will be 
> automatically added as you pass in a third argument string, the system 
> identifier.
> See also the online documentation
> http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.writedoctype.aspx
> or your local MSDN copy which explains the four arguments.
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
>
date: Tue, 1 Jul 2008 09:39:02 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML fi   
"So I suggested that start with an XML template that matched the schema and 
then make alterations to it based on the external data."

Thanks but once again, I have no idea what you just said.  I have no idea 
what an XML Template is either or how to use it, and the only reference I can 
find in Help has something to do with SQL Server.  Is there an actual demo 
you can point me to that illustrates your suggestion?  Perhaps this is purely 
a matter of terminology.

(Unfortunately my job requires me to bounce between many different 
technologies and XML is one that I have not had the time or need to focus on 
for long.)

Thanks.

"Joe Fawcett" wrote:

> "B. Chernick"  wrote in message 
> news:255E5673-B26C-4A0E-9D63-D7CEBB4D419B@microsoft.com...
> >I don't mean to be rude but I'm afraid I didn't understand much your reply.
> Okay
> >
> > This, so far as I know, is not a standard Dot Net situation.
> Seems like a perfectly normal scenario
> 
> The purpose of
> > the program, if it ever gets written, is to extract data from an Excel
> > spreadsheet and plug it into a standalone XML file.   I'm afraid I've been
> > given very little of the big picture.  I think it eventually gets fed into
> > some mainframe system.
> >
> 
> You said you wanted a way to avoid creating the whole file by hand, the file 
> matches a known schema. So I suggested that start with an XML template that 
> matched the schema and then make alterations to it based on the external 
> data.
> 
> 
> -- 
> 
> Joe Fawcett (MVP - XML)
> 
> http://joe.fawcett.name
> 
> 
>
date: Tue, 1 Jul 2008 10:36:05 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML fi   
B. Chernick wrote:
> "So I suggested that start with an XML template that matched the schema and 
> then make alterations to it based on the external data."
> 
> Thanks but once again, I have no idea what you just said.  I have no idea 
> what an XML Template is either or how to use it, and the only reference I can 
> find in Help has something to do with SQL Server.  Is there an actual demo 
> you can point me to that illustrates your suggestion?  Perhaps this is purely 
> a matter of terminology.

Imagine you need to create XHTML documents, instead of starting from 
scratch and each time creating the html element, the head element, the 
body element you could simply create an XHTML document already 
containing the html, the head, and the body element and use that as a 
"template", meaning you would use System.Xml.XmlDocument and load that 
"template" document and then use the DOM to manipulate it as needed 
(e.g. add the title, add headings, add paragraphs) and save as needed.

That is all what Joe tried to suggest, at least if I understand him 
correctly. So the XML "template" is nothing but an XML file with the 
structure you need for all your XML documents you want to create.


-- 

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

Re: Big picture questions - cleanest method for creating an XML fi   
Ok.  Now I think I see.  In a manner of speaking, I've already done that.  
It's easy enough to load an existing file.  You mean load the doc and search 
for the various elements in order to change their values?

(I use bits and pieces of XML technology as needed and I try to learn new 
things but I feel there is some central concept I have yet to discover, let 
alone master.  Business as usual.)

As long as we are on the subject of 'templates', refresh my memory.   If I 
am creating a VS2005 VB Winforms project, it is possible to include an 
existing XML file as a file of the project.  However I see no simple to 
access it programmatically.  Am I forgetting something?

"Martin Honnen" wrote:

> B. Chernick wrote:
> > "So I suggested that start with an XML template that matched the schema and 
> > then make alterations to it based on the external data."
> > 
> > Thanks but once again, I have no idea what you just said.  I have no idea 
> > what an XML Template is either or how to use it, and the only reference I can 
> > find in Help has something to do with SQL Server.  Is there an actual demo 
> > you can point me to that illustrates your suggestion?  Perhaps this is purely 
> > a matter of terminology.
> 
> Imagine you need to create XHTML documents, instead of starting from 
> scratch and each time creating the html element, the head element, the 
> body element you could simply create an XHTML document already 
> containing the html, the head, and the body element and use that as a 
> "template", meaning you would use System.Xml.XmlDocument and load that 
> "template" document and then use the DOM to manipulate it as needed 
> (e.g. add the title, add headings, add paragraphs) and save as needed.
> 
> That is all what Joe tried to suggest, at least if I understand him 
> correctly. So the XML "template" is nothing but an XML file with the 
> structure you need for all your XML documents you want to create.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
>
date: Wed, 2 Jul 2008 06:13:02 -0700   author:   B. Chernick

Re: Big picture questions - cleanest method for creating an XML fi   
B. Chernick wrote:
> Ok.  Now I think I see.  In a manner of speaking, I've already done that.  
> It's easy enough to load an existing file.  You mean load the doc and search 
> for the various elements in order to change their values?

Yes, or add additional child elements (as in my XHTML example).

> As long as we are on the subject of 'templates', refresh my memory.   If I 
> am creating a VS2005 VB Winforms project, it is possible to include an 
> existing XML file as a file of the project.  However I see no simple to 
> access it programmatically.  Am I forgetting something?

Well whether the XML file is part of the project or not, the APIs to 
access it programmatically are e.g. XmlReader, XPathDocument, 
XmlDocument, XmlSerializer and others.
Or are you talking about adding the XML to an assembly as a resource and 
want to read out the resource?

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Wed, 02 Jul 2008 16:15:20 +0200   author:   Martin Honnen

Re: Big picture questions - cleanest method for creating an XML fi   
I suppose I meant simply adding it as a file, in which case I'd have the 
problem of locating it in order to use those methods you mentioned.

On the other hand, I'm not sure I've ever added an XML file as a resource.  
I'm going to have to try that. 

"Martin Honnen" wrote:

> B. Chernick wrote:
> > Ok.  Now I think I see.  In a manner of speaking, I've already done that.  
> > It's easy enough to load an existing file.  You mean load the doc and search 
> > for the various elements in order to change their values?
> 
> Yes, or add additional child elements (as in my XHTML example).
> 
> > As long as we are on the subject of 'templates', refresh my memory.   If I 
> > am creating a VS2005 VB Winforms project, it is possible to include an 
> > existing XML file as a file of the project.  However I see no simple to 
> > access it programmatically.  Am I forgetting something?
> 
> Well whether the XML file is part of the project or not, the APIs to 
> access it programmatically are e.g. XmlReader, XPathDocument, 
> XmlDocument, XmlSerializer and others.
> Or are you talking about adding the XML to an assembly as a resource and 
> want to read out the resource?
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
>
date: Wed, 2 Jul 2008 07:45:03 -0700   author:   B. Chernick

Google
 
Web ureader.com


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