This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: convert string to xml record


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]