Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

xml string

Posted on 2006-11-28
3
Medium Priority
?
265 Views
Last Modified: 2013-11-19
i want to retrieve the tag value from the xml string without load it into xml document.

Is possible? how?
0
Comment
Question by:Rahamathulla_J
  • 2
3 Comments
 
LVL 23

Expert Comment

by:adathelad
ID: 18026774
Hi Rahamathulla_J,

It can be done either using some string manipulation or potentially complex regular expressions (depending on how complex it needs to be -i.e. do you need to extract a value from a node nested so many levels down  in the document), but is there a reason why you can't load it into an XMLDocument object?

It would save you reinventing the wheel.

0
 
LVL 3

Accepted Solution

by:
ankitbansal earned 750 total points
ID: 18206638
Hey!

If you only need to retrieve name of tags then that can be done by reading the xml as a string.
Read that string fowrard by using IndexOf method of string passing "<" as parameter. This would give you index of starting tag read it till indexof(">") (in this way you will get the tag name), then delete the string read so far... keep repeating this in a loop till end of the string.

You can also use a simple regular expression to search for strings of format "<a-zA-Z>". remember this is not the regular expression but the format that u would search for.

Regards'
Ankit
0
 
LVL 3

Expert Comment

by:ankitbansal
ID: 18206698
here is a regular expression that would match any tag without attribute and starting with a alphabet!

<[A-Za-z][A-Za-z0-9]*>

and this reg exp would match anytag (ofcource without attribute) <[A-Za-z0-9]*>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question