473,395 Members | 2,468 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,395 software developers and data experts.

read nodelist from xml in asp.net problem

well i have an xml file :

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="ISO-8859-7"?>
  2. <RealEstate xmlns="http://bankofgreece.gr/dom/real_estate/v1">
  3.   <Header>
  4.     <SenderId>999</SenderId>
  5.     <SenderName>Eurobank</SenderName>
  6.     <ReferencePeriod>2008-1</ReferencePeriod>
  7.   </Header>
  8.   <Data>
  9.     <Property>
  10.       <PropertyId>R2_1342_19509</PropertyId>
  11.       <PropertyType>1</PropertyType>
  12.       <PropertyLocation>
  13.         <Street>ΤΡΑΠΕΖΟΥΝΤΟΣ 12-0</Street>
  14.         <PostCode>14565</PostCode>
  15.         <Municipality>kazaman</Municipality>
  16.         <District>ΑΝΑΤΟΛΙΚΗΣ ΑΤΤΙΚΗΣ</District>
  17.       </PropertyLocation>
  18.       <DateOfEvaluation>2008-01-21</DateOfEvaluation>
  19.       <PropertyAge>
  20.         <YearOfPermit>
  21.         </YearOfPermit>
  22.         <YearOfCompletion>0</YearOfCompletion>
  23.       </PropertyAge>
  24.       <FloorNumber>2</FloorNumber>
  25.       <PropertySpaceInformation>
  26.         <LandArea>
  27.         </LandArea>
  28.         <MainSpaceArea>470,00000</MainSpaceArea>
  29.         <AuxiliarySpaceArea>40,00000</AuxiliarySpaceArea>
  30.       </PropertySpaceInformation>
  31.       <StoreRoomsAndParkingSpaces>
  32.         <NumberOfStoreRooms1>0</NumberOfStoreRooms1>
  33.         <TotalAreaOfStoreRooms1>0,00000</TotalAreaOfStoreRooms1>
  34.         <NumberOfParkingSpaces1>0</NumberOfParkingSpaces1>
  35.         <TotalAreaOfParkingSpaces1>0,00000</TotalAreaOfParkingSpaces1>
  36.         <NumberOfStoreRooms2>0</NumberOfStoreRooms2>
  37.         <NumberOfParkingSpaces2>0</NumberOfParkingSpaces2>
  38.       </StoreRoomsAndParkingSpaces>
  39.       <OtherPropertyFeatures>
  40.         <ExcellentQualityOfConstruction>0</ExcellentQualityOfConstruction>
  41.         <ExcellentPositionViewEnviroment>
  42.         </ExcellentPositionViewEnviroment>
  43.         <RecentlyRenovated>0</RecentlyRenovated>
  44.         <DepreciatedDistrict>
  45.         </DepreciatedDistrict>
  46.       </OtherPropertyFeatures>
  47.       <PropertyValueInformation>
  48.         <LandAssessedValue>0,00000000000</LandAssessedValue>
  49.         <PropertyTotalAssesedValue>1280000,0000</PropertyTotalAssesedValue>
  50.         <StoreRoomsAssesedValue>0,0000</StoreRoomsAssesedValue>
  51.         <ParkingSpacesAssesedValue>0,0000</ParkingSpacesAssesedValue>
  52.         <TotalConstructionCost>0,00000000000</TotalConstructionCost>
  53.       </PropertyValueInformation>
  54.       <TotalAdministrativeValue />
  55.       <LoanInformation>
  56.         <LoanType />
  57.         <DateOfFirstDisbursement />
  58.         <ApprovedLoanAmount />
  59.         <TotalAmountDisbursed />
  60.         <MortgagePrenotationValue />
  61.       </LoanInformation>
  62.     </Property>
  63. <Data>
  64. <RealEstate>
  65.  

well i have a problem when i try to read a nodelist <Data> because of <RealEstate xmlns="http://bankofgreece.gr/dom/real_estate/v1">
but when i it is like <RealEstate > it works fine i can read all nodelist as expected . how can i solve this little problem any idea????
Jan 8 '09 #1
3 2939
jkmyoung
2,057 Expert 2GB
Namespace problem. Are you using SelectNodes? eg, what is the exact problem you are having?

Eg, in .NET you would need to use a namespace manager.
http://msdn.microsoft.com/en-us/library/4bektfx9.aspx
Jan 14 '09 #2
yes i am using select nodes , ok i coded it with namespacemanager as above:


[SIZE=2]xmldoc.LoadXml(theXMLString)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] nsmanager [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] XmlNamespaceManager(xmldoc.NameTable)
nsmanager.AddNamespace([/SIZE][SIZE=2][COLOR=#a31515]"dt"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#a31515]"http://bankofgreece.gr/dom/real_estate/v1"[/COLOR][/SIZE][SIZE=2])
list = xmldoc.SelectNodes([/SIZE][SIZE=2][COLOR=#a31515]"//dt:Data"[/COLOR][/SIZE][SIZE=2], nsmanager)[/SIZE]
[SIZE=2][/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]but my question how can i do with some other way , because if the namespace is different of a uploaded XML document this code will not work.. my question is if there is any programaticaly way to avoid any namespace of uploaded XML document and select nodes without any problem???
[/SIZE]
Jan 16 '09 #3
jkmyoung
2,057 Expert 2GB
The xpath becomes something like
"*[local-name() = 'RealEstate']/*[local-name()='Header']"

Why would your namespace differ? Is there no defined schema for your input?
Jan 16 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Howard Jess | last post by:
Given the html at the end of this message, I see how a DOM NodeList exhibits its "live" behavior; that is, adding elements to a document can change any NodeList variables, when there's *no* code...
6
by: Paul M | last post by:
hi there, i have an xml file, but am not too sure how to read all these elements using vb.net code. any help would be greatly appreciated:)) <---------CODE---------------> <?xml...
8
by: Øyvind Jægtnes | last post by:
I'm playing around a bit with XPath and nodelist and i want to extract some info from a RSS feed. The one that i am testing at can be viewed at http://slashdot.org/index.rss Ok.. heres the deal:...
1
by: Chucker | last post by:
I would like to select some nodes from a very large XML document and then apply a stylesheet to the dom fragment / nodelist that is the result of my XPath-Query. It seems to me now that I have...
2
by: Jill | last post by:
Hi I am using ms acces 2002 to read an xml file. I am using the DOM object in ms access - version xml 4 with service pack 2. here is the start of the code below. But I am having trouble reading...
3
by: Philip Wagenaar | last post by:
I have an XML document that looks like <request> <login> <username>myuser</username> <password>mypass</password> </login> </request> How do I get the values of username and password into a...
1
by: DP413 | last post by:
Hey guys need your help :) I'm trying to clone a nodelist in a bookmarklet so that I can use document.write to output each item in the nodelist to the browser. Right now I'm basically grabbing...
2
by: carlback | last post by:
I have a function were the input parameter can either be an string,array,dom node or NodeList (getElementsByTagName()) and I have somthing like this function which works great for what I want in...
2
by: sndive | last post by:
i extract class object from an instance of NodeList (minicompat.py) like so PyObject *pclass = PyObject_GetAttrString( nodelistinsance, "__class__"); but PyObject_GetAttrString(pclass,...
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: 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
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...
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...

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.