Altova Mailing List Archives

Re: Get some value from XML file

From: "David" <david_dvali@-------.--->
Date: 12/4/2004 7:53:00 PM
I want just read the text and use it in my application.
I'm using MS Visual Studio .NET 2003 (C#).

"Martin Honnen" <mahotrash@y...> wrote in message 
> David wrote:
>> I have XML file like this:
>> ==========================================
>> <?xml version="1.0" encoding="utf-8" ?>
>> <Language>
>>  <English>
>>   <Captions>
>>    <Name>Some caption</Name>
>>   </Captions>
>>   <Messages>
>>    <Name>Some message</Name>
>>   </Messages>
>>  </English>
>> </Language>
>> ==========================================
>> I want to read from this XML file "Some message" which is on 
>> Language\English\Messages section.
>> How can I do this?
> An answer depends on the tools you want to use. Are you using MSXML? Or 
> .NET?
> Is the sole thing you want to do extract that text or do you want to 
> change it and save the changes?
> If you use MSXML 3 for instance and want to use script inside of IE you 
> could use
> var xmlDocument = new ActiveXObject('Msxml2.DOMDocument.3.0');
> xmlDocument.async = false;
> var loaded = xmlDocument.load('test2004120401.xml');
> if (loaded) {
>   xmlDocument.setProperty('SelectionLanguage', 'XPath');
>   var messages = 
> xmlDocument.selectSingleNode('Language/English/Messages');
>   alert(messages.text);
> }
> but as said, there are plenty of options depending on what your needs are 
> and what tools/programming languages you want to use.
> -- 
> Martin Honnen


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.