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

Reparsing existing XML element

Forgive me if this has been asked before, but I haven't found anything
useful in my searches.
I have an XML document generated from an external program that I can't
change the output format on. Most of the output is great, but one
specific element, needs to be parsed into about a dozen smaller
elements based on a delimiter. I'm unsure how to do this effectively.
Any help would be much appreciated.

Dec 13 '05 #1
3 1024
ti********@gmail.com wrote:
Forgive me if this has been asked before, but I haven't found anything
useful in my searches.
I have an XML document generated from an external program that I can't
change the output format on. Most of the output is great, but one
specific element, needs to be parsed into about a dozen smaller
elements based on a delimiter. I'm unsure how to do this effectively.
Any help would be much appreciated.


What language do you need to do this in?
In XSLT, have a look at substring-before and recursive templates.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

Dec 13 '05 #2
I was looking at doing it in XSLT, but open to other options.
Thanks for the input.

Dec 14 '05 #3
Hello Peter,

Your problem is that you have a text block in your XML output that
should be transformed to XML elements ? And you need to scan each
separator for extracting the whole data ? Is it what you mean ?

XSLT was not really adapted to scan text values, but I think you could
try with a named template using a parameter.

Here a sample code :

<xsl:template name="parsing">
<xsl:param name="line"></xsl:param>
<xsl:if test="$line<>''">
<xsl:call-template name="parsing">
<xsl:with-param name="line">
<xsl:value-of select="substring-after( $line, 'YOUR_SEP' )"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
Best regards,

A.Brillant
EditiX - XML Editor and XSLT Debugger
http://www.editix.com

Peter Flynn wrote:
ti********@gmail.com wrote:

Forgive me if this has been asked before, but I haven't found anything
useful in my searches.
I have an XML document generated from an external program that I can't
change the output format on. Most of the output is great, but one
specific element, needs to be parsed into about a dozen smaller
elements based on a delimiter. I'm unsure how to do this effectively.
Any help would be much appreciated.

What language do you need to do this in?
In XSLT, have a look at substring-before and recursive templates.

///Peter

Dec 16 '05 #4

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

Similar topics

0
by: Jean-Marc Vanel | last post by:
Hello I want to validate against an XML Schema from a DOM Document object without reparsing. If the XML Schema is also from a DOM Document it would be even better. I work with Java. It seems...
1
by: Animanera | last post by:
Is there a way to extend an existing DTD (adding only new elements) OR I've to create a NEW DTD containing both new and old elements? Thank you very much in advance. Bye, Animanera. :)
0
by: AD. | last post by:
Hi all, I was wondering if anyone had any insights for me. I'm helping out some of our developers with the style sheets for a web app. One thing they are trying to achieve is getting rid of...
0
by: KemperR | last post by:
Dear Experts, I'm new to docbook and have sucessfully started to get into customisation layers. Therefore I changed the dtd as recomended. But I got stuck at the simple point when I want to add...
4
by: Grant | last post by:
Gday, I am using the sample code at: http://support.microsoft.com/default.aspx?scid=kb;en-us;317666 to modify an existing XML document. The XML document looks like the following: ...
1
by: onemonk | last post by:
hi guys... I hav this problem, I am planning to write html form values to xml file and... the problem is... When I am entering data... its recording only the latest entry.. by overwriting the...
7
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one...
1
by: Rajarshi | last post by:
Hi, I'm using ElementTree for some RSS processing. The point where I face a problem is that within an <item></itemI need to add another child node (in addition to <linketc) which is a well-formed...
1
by: ofuuzo1 | last post by:
Hi, Is there anyway I can append a new element to an existing xml without first loading the existing file into a variable, adding the new element into the variable and saving it by overwriting the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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,...

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.