473,382 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

XML namespaces and VB.Net - System.XML.XMLDocument

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 SelectSingleNode(). 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 SelectSingleNode 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 SelectSingleNode() to read
anything until the profile node. Any ideas why? Should I
be able to do this? I'm using the System.XML.XMLDocument
and SelectSingleNode() 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="GUEST">
<profileID>7349133</profileID>
<creatorCode>DALLAS</creatorCode>

I would really appreciate any guidance or suggestions.

Thanks for your time....

Greg Rothlander
Nov 11 '05 #1
1 11336
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.**********@att.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 SelectSingleNode(). 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 SelectSingleNode 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 SelectSingleNode() to read
anything until the profile node. Any ideas why? Should I
be able to do this? I'm using the System.XML.XMLDocument
and SelectSingleNode() 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="GUEST">
<profileID>7349133</profileID>
<creatorCode>DALLAS</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
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...
6
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...
2
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...
1
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
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"...
1
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...
6
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...
4
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.