Re: Read XML value

From: Nick Malik (nickmalik_at_hotmail.nospam.com)
Date: 08/12/04


Date: Thu, 12 Aug 2004 14:40:18 GMT

In addition to just reading a value, and in addition to the comments of
Chris, I'd suggest you can use the XSD.EXE tool that comes with the .net
framework sdk. This tool can take a well-formed xml and produce a schema.
You can edit the schema (graphically) to make sure it is what you want. You
can then use the same tool to create a class that maps to that schema.

Then, it's a simple act of deserializing your data into the class. After
that, you can read EVERY value simply from an object.

It's pretty sweet.

--- Nick

<google_groups3@hotmail.com> wrote in message
news:3e3ab30.0408110821.7b6c39b5@posting.google.com...
> OK, this is driving me nuts but it must be easier than it seems to me.
> Below is an XML file I have been given. I can write to it fine but I
> just cannot work out the code for reading a value. So, can anyone
> show me how?? I want to read the value "RefreshInterval"
>
> <?xml version="1.0" ?>
> - <!-- XML File -->
> - <MyApp>
> - <Configuration>
> - <Folders Count="4">
> <F0>c:\Testing\Upload</Src0>
> <F1>c:\Testing\Download</Src1>
> <F2>c:\Downloads</Src2>
> <F3>c:\Debug</Src3>
> </SourceFolders>
> - <AutoRefresh>
> <RefreshInterval>15</RefreshInterval>
> </AutoRefresh>
> </Configuration>
> </SafeGuard>
>
> I have googled my ass off but not found an example that works. So, by
> posting my XML file I am hoping that someone can show me how to read
> that value.
>
> TIA
>
> p.s. sorry if this has been asked a million times!



Relevant Pages

  • Re: Decimal Type in a XSD Schema and problems with DataAdapter
    ... for the element in the schema) if you want the empty elements to valdiate ... against the schema. ... the type of guarantyPercent is decimal. ... > In the XML file the guarantyPercent can be empty: ...
    (microsoft.public.dotnet.xml)
  • Re: InvalidOperationException: ReadElementContentAsString method is not supported on node type None
    ... I want to import a user uploaded XML file into a database. ... XmlReaderSettings readerSettings = new XmlReaderSettings; ... now I have an XmlReader object with a schema so I check for validation. ...
    (microsoft.public.dotnet.xml)
  • Re: How to cast in an xml based dataset SELECT method?
    ... How do I force the strong-typed dataset using an existing schema? ... here is the top portion of the XML file I am bringing into the ... When you read an XML file in this manner, how do you cast the columns ... to another type for a SELECT filter expression? ...
    (microsoft.public.dotnet.general)
  • Re: Converting a Schema message to a string message and vice-versa
    ... it will create a schema for you. ... Now, to put a string in to the tag, use an expression shape with code like ... > In Biztalk 2004 I simply want to have a receive location folder to ... > drop an xml file into, and Biztalk pass this xml to the web method ...
    (microsoft.public.biztalk.general)
  • Re: cant create schema for qualified attributes in element with default namespace
    ... in your XML file you are using namespace prefix e3 without defining ... > I'm trying to regnerate the xsd I already have because I changed the xml> file on which the schema was based. ... > where the attributes are in a different name space to the element (NB> element prefix is now e3), but on creating the schema for this doc, I am> simply told e3 is an undeclared namespace. ...
    (microsoft.public.dotnet.xml)