[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: convert string to xml record

Subject: Re: convert string to xml record
From: Ming <myu@xxxxxxxx>
Date: Thu, 16 May 2002 11:02:55 -0600
convert string to xml
Hi,

First, thank all who helped me on this topic. After reading your
suggestions and search the archive and the web, I finally find the solution
although may not be the best one. Just to share with everyone. The original
codes I found is on this site:

http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88894/adx04xsl.htm

This is what I did. I downloaded the xml parser package from oracle site
and use their DOMParser package and here is my java method used to parse
the string:

import java.util.*;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import java.io.StringReader;
import oracle.xml.parser.v2.*;

   public static NodeList parseXml (String s) {
        DOMParser d = new DOMParser();
        try {
                d.parse( new StringReader(s) );
                return ((XMLDocument)d.getDocument()).selectNodes("/");
        } catch (Exception e) {
                return (new XMLDocument()).getChildNodes();
        }
   }

Hope this will help someone.

Ming


Stuart Celarier wrote:

> The only XSLT 1.0 way that I know how to do that is with the document()
> function, assuming that the string can be addressed with a URI. That
> means that string can be served up as a URL from a web server, or the
> string can be in a file on the file system, or even a fragment within a
> file.
>
> Individual XSLT vendors may implement extension functions if you can tie
> your application to a specific XSLT processor. I can't make specific
> recommendations but look for such parsing functions in Saxon, Xalan,
> etc. I am not aware of any such extension functions for MSXML or MS
> .NET.
>
> Cheers,
> Stuart
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.