473,386 Members | 1,908 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,386 software developers and data experts.

Getting nodes with or without namespaces.

ru
Hello,

I'm having trouble trying to write a generic solution for
parsing xml files. The xml-files I recieve can have
namespaces or not, depending on the source - however, the
treestructure is the same for all. An extra difficulty is
that it is not certain that if a xml-file has namespaces,
all nodes will use the namespaceprefix: some will and
some will not. Adding namespaces to the namespacemanager
is no problem.
How do I know if a certain node uses a namespace prefix?
Is there a property I can check?

thanks,
ru
Nov 11 '05 #1
2 1260
ru wrote:
How do I know if a certain node uses a namespace prefix?
Is there a property I can check?


You didn't tell us which API you are using. But I believe you are
looking for Prefix property. XmlReader, XmlNode and XPathNavigator all
expose namespace prefix via Prefix property.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
ru
You're right - I've been looking too long...
Thanks.
-----Original Message-----
ru wrote:
How do I know if a certain node uses a namespace prefix? Is there a property I can check?
You didn't tell us which API you are using. But I

believe you arelooking for Prefix property. XmlReader, XmlNode and XPathNavigator allexpose namespace prefix via Prefix property.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

.

Nov 11 '05 #3

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

Similar topics

3
by: Tjerk Wolterink | last post by:
Hello i have xml code like this: <page:page xmlns:page="namespacefor page"> <page:section> <page:header> <b>Hello</b>There </page:header> <page:content> --- HTML CODE like: <i>Y</i>es i...
7
by: F. Da Costa | last post by:
Hi, I' looking to retrieve ProdName1 form the <tr> below. <tr id="1-1-1" class="even"> <td> <div class="tier4"> <a href="#" class="leaf"></a> ProdName1 </div>
2
by: Maersa | last post by:
hi, i'm trying to add "attributes" to some nodes and it works at design time but fails at runtime. XmlDocument doc = new XmlDocument(); XmlElement elem = doc.CreateElement( "root" );...
2
by: robin_hoods | last post by:
I'm having the following problem I want to create a XML document like <?xml version="1.0" encoding="utf-8"?> <RedlineXML xmlns="urn:autodesk.com:dsd:RedlineXML_v_002.xdr"...
1
by: Guy | last post by:
Hi, I have an XML file which its content can't be altered as a source. My solution should be able to produce some kind of pointers (in a seperate file) to specific nodes (or even...
3
by: Lee Alexander | last post by:
I want to find out all the namespaces for an assembly and convert them into a tree that I can then traverse for use in an autocomplete popup. Now I figure I can do it by running over all the...
3
by: 0to60 | last post by:
Please help! I'm using the following code to get an XML doc: string str = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=12345&city=addison"; System.Net.HttpWebRequest request =...
1
by: Paul J. Lucas | last post by:
I have code that builds a DOM using the Java org.w3c.dom API and it adds an extra attribute to one of the elements that I don't want. Not only that, the value it adds is wrong. The code to...
1
by: duane.lortie | last post by:
I'm writing a routine that fetches XML and attempts to parse some values from it. A condensed entry node of the XML looks like this .. <entry> <title>Some title</title> <author>...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.