XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
michael haskellSubject: Get Value from non-standard xml
Author: michael haskell
Date: 02 Sep 2008 04:28 AM
Hi All,

I'm working with xml that doesn't follow the standard of enclosing value's within child elements, rather an object is defined, then under it are name and value pairs. Below is an example of what I'm working with:

<dynamic-metadata>
<name>lastupdate</name>
<value>08/25/2008</value>
<name>type</name>
<value>map</value>
<name>contact</name>
<value>joe@gmail.com</value>
</dynamic-metadata>

I have no control over the xml formatting and would like to extract the value of a given tag.

The way I've been approaching it is as follows in pseudo code.

foreach child
if name is "lastupdate"
index = name position
endif
return valueof index+1

I'm learning xsl and haven't had success, coming form a java background, if there is a simpler approach, I've read positions vary greatly depending on the context, and I know the only way to have a variable change is within a foreach loop, let me know.

Thanks in advance.

Posttop
Elias HuterSubject: Get Value from non-standard xml
Author: Elias Huter
Date: 02 Sep 2008 07:00 AM
Is it always Name/Value/Name/Value/... ? Or is there a chance <dynamic-metadata> has other childs, <Name> or <Value> are there twice or the sequence is somehow else mixed?

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.