Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Reparsing existing XML element

Reply
Thread Tools

Reparsing existing XML element

 
 
timbrigham@gmail.com
Guest
Posts: n/a
 
      12-13-2005
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.

 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      12-13-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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/

 
Reply With Quote
 
 
 
 
timbrigham@gmail.com
Guest
Posts: n/a
 
      12-14-2005
I was looking at doing it in XSLT, but open to other options.
Thanks for the input.

 
Reply With Quote
 
JAPISoft
Guest
Posts: n/a
 
      12-15-2005
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">
<xslaram name="line"></xslaram>
<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:
> (E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
reloading .rb files / reparsing? dc Ruby 1 02-03-2007 04:35 PM
Why no existing Java type to existing XML schema binding support? nrm Java 3 04-10-2006 04:52 PM
Validate Document object against Schema without reparsing the xml veerleverbr@hotmail.com Java 2 06-28-2005 07:42 AM
Schema validate from DOM Document without reparsing Jean-Marc Vanel XML 0 06-24-2003 11:43 AM



Advertisments