473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XmlNamespaceManager problem with Office OpenXML format

Hi,

I'm trying to read a simple Word 2007 document with the contents of
"This is a test."

Could someone please enlighten me about why the following code doesn't
work...

Dim strXMLDocument As String = "<?xml version=""1.0""
encoding=""UTF-8"" standalone=""yes""?><w:document
xmlns:ve=""http://schemas.openxmlformats.org/markup-compatibility/2006""
xmlns:o=""urn:schemas-microsoft-com:office:office""
xmlns:r=""http://schemas.openxmlformats.org/officeDocument/2006/relationships""
xmlns:m=""http://schemas.openxmlformats.org/officeDocument/2006/math""
xmlns:v=""urn:schemas-microsoft-com:vml""
xmlns:wp=""http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing""
xmlns:w10=""urn:schemas-microsoft-com:office:word""
xmlns:w=""http://schemas.openxmlformats.org/wordprocessingml/2006/main""
xmlns:wne=""http://schemas.microsoft.com/office/word/2006/wordml""><w:body><w:p
w:rsidR=""003B4AAB"" w:rsidRDefault=""003B4AAB""><w:r><w:t>This is a
test.</w:t></w:r></w:p><w:sectPr w:rsidR=""003B4AAB""
w:rsidSect=""003B4AAB""><w:pgSz w:w=""11906"" w:h=""16838""/><w:pgMar
w:top=""1440"" w:right=""1440"" w:bottom=""1440"" w:left=""1440""
w:header=""708"" w:footer=""708"" w:gutter=""0""/><w:cols
w:space=""708""/><w:docGrid
w:linePitch=""360""/></w:sectPr></w:body></w:document>"

Dim xmdTest As New XmlDocument
xmdTest.LoadXml(strXMLDocument)

Dim nt As New NameTable
Dim nsManager As New XmlNamespaceManager(nt)
nsManager.AddNamespace("w",
"http://schemas.openxmlformats.org/wordprocessingml/2006/3/main")

For Each xmnSomething As XmlNode In
xmdTest.SelectNodes("/w:document/w:body/w:p/w:r/w:t", nsManager)
Console.WriteLine(xmnSomething.InnerText)
Next

Thanks,

Peter

Nov 10 '06 #1
1 2002
<pe******@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,

I'm trying to read a simple Word 2007 document with the contents of
"This is a test."

Could someone please enlighten me about why the following code doesn't
work...
xmlns:w=""http://schemas.openxmlformats.org/wordprocessingml/2006/main""
nsManager.AddNamespace("w",
"http://schemas.openxmlformats.org/wordprocessingml/2006/3/main")
John
Nov 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: reezaali | last post by:
Hi All I keep getting back VINET and not Lilas...can someone point me in the right direction? Thanks a lot DECLARE @idoc int DECLARE @doc varchar(1000)
1
by: Dan via .NET 247 | last post by:
Hi All, Is it possible to serialize an instance of XmlNamespaceManager? I'd like to use it to manage a collection of namespaces and savethat collection for later use but when attempting to...
1
by: Victor Hadianto | last post by:
Hi All, I have the following code: <snip> XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(@"<?xml version=""1.0"" encoding=""UTF-8""?> <myConfig:myConfig...
0
by: Micke | last post by:
On a code behing page to an aspx page I want to open a xml file in Excel and save it as an Excel file. I have following code that is working: Dim oExcel As New Excel.Application Dim oBook As...
3
by: Chad | last post by:
I've run into a problem where I create a DataTable, Create an Integer column and assign the value DBNULL.Value to it. When I use the ds.GetXML to get the XML represnetation of this table, if the...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
9
by: John Kotuby | last post by:
Hi all... While looking around for tools to create Excel files from either HTML pages or the Data I use to assemble them, I got an interesting response from a vendor. I have looked at Apose, and...
4
by: =?Utf-8?B?UHJpeWE=?= | last post by:
Hi, I'm developing a webservice whicg reads data from a database and exports to a excel sheet. This applciation works if i have MS Office installed in my system . Since i'm unable to install MS...
4
by: wellscrambled | last post by:
Folks, Probably don't have the right forum here, but this is all a bit new to me. I have a web site that sends me a daily email with an excel spreadsheet attachment that contains some customer...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.