473,976 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML namespaces and VB.Net - System.XML.XMLD ocument

I posted this a few days ago and didn't get any response.
I try again but ask it a little differently.

I'm recieving any XML document from a client and I need to
convert it to an ASCII delimited string to input into a
legacy system. I've put together a VB.Net class that does
this using DOM commands such as SelectSingleNod e(). It
works fine but I've noticed that it can not read past
inbedded namespaces that are found throghout the
document. I don't use namespaces in my own XML document
so I do not know how to make this work or if I can. The
system they are using seems to be using an old scheme
definition that is .xml and not .xsd. I think I'm working
with something that I am not fimilar enough with to know
exactly how to approach this. To work around this
namespace problem, I've written some not-so-great
functions that strip out the namespaces using string
manipulation. I really don't like this approach because
it is not as dynamic as I would like it to be.

Does anyone know why my SelectSingleNod e statements can
not read past these namespace attributes on different
nodes throughout the XML document? Is there a way that I
can get it to just ignore these? I don't need them or
want them. I would like to write a routine that just
ignores them or to simple removes all of the namespaces
out of the XML document. Maybe I should be approaching
this differently. If you have any ideas, please let me
know.

Here is a sample of a node in the XML document with a
namespace. I can not use the SelectSingleNod e() to read
anything until the profile node. Any ideas why? Should I
be able to do this? I'm using the System.XML.XMLD ocument
and SelectSingleNod e() command to read the profileID
element and I can not find it... unless I remove the
namespace.

<ResProfiles>
<ResProfile>
<Profile xmlns="profile. fidelio.1.2"
profileType="GU EST">
<profileID>7349 133</profileID>
<creatorCode>DA LLAS</creatorCode>

I would really appreciate any guidance or suggestions.

Thanks for your time....

Greg Rothlander
Nov 11 '05 #1
1 11370
Problems understanding XPath and namespaces are the most frequently
recurring questions on this newsgroup.

A brief overview of querying namespaced documents is available at

http://samples.gotdotnet.com/quickst...NameSpace.aspx

while a more in depth overview of XPath and XML namespaces is at

http://msdn.microsoft.com/library/en...ml05202002.asp

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Greg Rothlander" <j.**********@a tt.net> wrote in message
news:00******** *************** *****@phx.gbl.. .
I posted this a few days ago and didn't get any response.
I try again but ask it a little differently.

I'm recieving any XML document from a client and I need to
convert it to an ASCII delimited string to input into a
legacy system. I've put together a VB.Net class that does
this using DOM commands such as SelectSingleNod e(). It
works fine but I've noticed that it can not read past
inbedded namespaces that are found throghout the
document. I don't use namespaces in my own XML document
so I do not know how to make this work or if I can. The
system they are using seems to be using an old scheme
definition that is .xml and not .xsd. I think I'm working
with something that I am not fimilar enough with to know
exactly how to approach this. To work around this
namespace problem, I've written some not-so-great
functions that strip out the namespaces using string
manipulation. I really don't like this approach because
it is not as dynamic as I would like it to be.

Does anyone know why my SelectSingleNod e statements can
not read past these namespace attributes on different
nodes throughout the XML document? Is there a way that I
can get it to just ignore these? I don't need them or
want them. I would like to write a routine that just
ignores them or to simple removes all of the namespaces
out of the XML document. Maybe I should be approaching
this differently. If you have any ideas, please let me
know.

Here is a sample of a node in the XML document with a
namespace. I can not use the SelectSingleNod e() to read
anything until the profile node. Any ideas why? Should I
be able to do this? I'm using the System.XML.XMLD ocument
and SelectSingleNod e() command to read the profileID
element and I can not find it... unless I remove the
namespace.

<ResProfiles>
<ResProfile>
<Profile xmlns="profile. fidelio.1.2"
profileType="GU EST">
<profileID>7349 133</profileID>
<creatorCode>DA LLAS</creatorCode>

I would really appreciate any guidance or suggestions.

Thanks for your time....

Greg Rothlander

Nov 11 '05 #2

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

Similar topics

3
2410
by: Colin Green | last post by:
I have come across what seems like a failing in the .Net XML classes. Many people have posted requesting how to write an XPath query with namespace prefixes that works. The solution shown in all the posts I have seen is of the form: --------------------------------------------- XmlDocument doc = new XmlDocument(); doc.Load(@"c:\foobar.xml"); XmlNamepaceManager nmMgr = newNamespaceManager(doc); nmMgr.AddNamespace("abc", "www.my.uri");
6
5181
by: Daniele | last post by:
Hi all, We are developing a .net application that can accept xml documents. Every xml document can match a single schema, or it may be composed by multiple different elements and each of these can match a different xsd schema. Is there a way to retrieve the namespace collection of all the document namespaces for which there is at least one element in the document?
2
9153
by: Carlo Garcia | last post by:
Hi I am having trouble with namespaces: Using the .NET System.XML classes, whenever I run an xpath on a file with a namespace, the xpath query returns nothing, but when I remove the namespace from the xml file I am quering, the xpath query works. I am trying to run a SelectSingleNode(xpath) function on an XmlNode, but when the source xml file has a default namespace, for example:
1
1775
by: helpful sql | last post by:
Hi all, I load an xml file into XmlDocument object and would like to get a list of namespaces used in the file. How can I get a list of namespaces used in xml file? Thanks.
19
16290
by: David Thielen | last post by:
Hi; If there are no namespaces this works fine for me. But if the xml has namespaces, then I get either no node back or an exception. Here is the sample xml: <root xmlns="http://www.test.org" xmlns:sns="http://www.test.org/sub" xmlns:mns="http://www.test.org/mini"> <data>
1
4378
by: Peter Ravnholt | last post by:
Hello all, It seems that digitally signing XML documents using the SignedXml class has a bug - or at least a behavior I cannot explain. The problem occurs when I sign XML documents containing namespace prefixes and namespace references and then validate it. The validation always fails (returns false) in this case. When I remove the namespace prefixes and namespace references from the XML, signing and validating works fine.
6
3021
by: AMDRIT | last post by:
Hello Everyone, I am having an issue with xml and namespaces, at least I think it is namespaces. When I use namespaces, I cannot use SelectSingleNode / SelectNodes as they always return 0/Nothing respectively. Anyone have any thoughts? Thanks in advance VB.Net 2005
4
2367
by: =?Utf-8?B?Q2Fpcm4=?= | last post by:
I am new to Xpath but wish to parse an XML document for nodes which contain a child node with a particuale value. Please does anybody have any clues as to why I never get any returns in the root node list after the select call. With thanks. The code I have looks like this ( subject to a bit of desperate hacking)
1
1989
by: gotclout | last post by:
I've generated an XML document, and throughout the document the namespaces are displayed for each element. I would like to have all of the namespaces declared at the top of the document, and whenever the namespaces are referenced later in the document have an empty string appear "". Having the namespaces appear at all times is messy and clutters the document. How can I achieve this? I am using System.Xml.XmlDocument, System.Xml.NameTable nt,...
0
10349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10162
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10078
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8454
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7601
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5149
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 we have to send another system
3
3756
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.