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

Read/Search XML in ASP?

80
Hi All.

I am having trouble getting the right code to work with XML.. I have this file:

Expand|Select|Wrap|Line Numbers
  1.   <?xml version="1.0" encoding="ISO-8859-1" ?> 
  2. - <products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PriceList.xsd">
  3.   <group name="" /> 
  4. - <group name="Software">
  5. - <product id="5063441">
  6.   <name>Some Soft</name> 
  7.   <stock>Yes</stock> 
  8.   <weight>0.5</weight> 
  9.   <model>65045809</model> 
  10.   <shortDescription>SomeSoft...</shortDescription> 
  11.   <manufacturerName>Adobe</manufacturerName> 
  12.   <manufacturerURL>http://www.adobe.com/</manufacturerURL> 
  13.   <price>4754545</price> 
  14.   </product>
This file contains 10.000 Products like the one above, and I need to search it trough and extract its elements.

I have tried looking around the web for solutions but it seems that this (I would imagine - easy task) arent that simple..
Aug 18 '10 #1
2 1523
Pheddy
80
Maybe someone could help me to a working and updated guide somewhere?

Thanks again.
Aug 19 '10 #2
azrar
11
I recommend reading up on XPath so you know how to target the data you want in an XML file.

http://www.w3schools.com/XPath/default.asp

Here's an example of how to implement xpath in ASP:
Expand|Select|Wrap|Line Numbers
  1. <%
  2. set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
  3. xmlDoc.async = False
  4. xmlDoc.LoadXML xml_data
  5.  
  6. set nodes = xmlDoc.selectNodes("/products/product[@id='5063441']") '- this is xpath
  7.  
  8. For Each n in nodes
  9.  '-- do stuff here
  10. Next
  11.  
  12. set nodes=nothing
  13. set xmlDoc = nothing
  14. %>
Aug 19 '10 #3

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

Similar topics

6
by: Alan | last post by:
I want to search a string in a file, but I don't know the position, how can I search the string and stop at that line containing that string ? for example, I want to seach the string ".ABC" in a...
4
by: Nikos | last post by:
Hi... I would like to search for a hex string (for example: "E903") inside a binary file... Although I open the file correctly, how do I search hex values? Thanks in advance! Nikos
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
4
by: visionstate | last post by:
Hi there, I'm fairly new to access and the way it works and I have been building a relatively simple database. It is basically a database where staff members can search for what training they (or...
4
by: Dameon | last post by:
Hi All, I have a process where I'd like to search the contents of a file(in a dir) for all occurences (or the count of) of a given string. My goal is to focus more on performance, as some of the...
3
markmcgookin
by: markmcgookin | last post by:
Hi Folks, I have a VB app, and I have been working at it for a while, and I am now at the stage where I want to create a search function. Now don't be scared! It is in the .Net compact framework,...
7
by: CAH | last post by:
Hi I need to make at multilanguage language site, and for that I need to identify the users, and register there choice off language. For that i imagine using cookies, since this is the only way...
1
by: nganglove | last post by:
C++ string search -------------------------------------------------------------------------------- Hello, please can any one help me? I am given an assigment in C++ to read a text file and...
9
by: DarthPeePee | last post by:
Hello Everyone, I posted yesterday about a password strength meter I am working on. Currently I have a function that checks if common passwords are used in the password itself (eg: qwerty,...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
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?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.