Producing XML streams

I have got as far as generating XML from a database, and I can quite happily write it out to a file using a Serializer, but I want to produce it in a way that another part of my application can receive as SAX i.e., as an InputSource. Anyone know how to do this? I think perhaps I need to use piped Readers?
Cheers

I'd say you should implement your own XMLReader, and folks can attach ContentHandlers to your reader to parse the data.
When they call parse on your reader, start spewing startDocument, startElement, endElement, etc, etc, method calls into their content handler.

Similar Messages

  • Webservice Consume Proxy error : XML stream: 'document not wellformed'.

    Dear All ,
      I facing problem when i try to test my service consumer .
      Its end with error message :
      Error when processing Web service call
      Error when calling SOAP Runtime functions: CX_SXML_PARSE_ERROR:An exception with the type CX_SXML_PARSE_ERROR  occurred, but was
      An exception with the type CX_SXML_PARSE_ERROR occurred, but was neither handled locally, nor declared in a RAISING clause
      Error while parsing an XML stream: 'document not wellformed'.
      Need your help guys.
    Thanks,
    Ikrar
    Edited by: ikrarSAP on Jun 17, 2011 2:34 PM

    Hi,
                                    Actually i dont have any idea on BOBJ. But this kind error usually occurs in the following cases:
    The parameters you called from web service do not match with parameters using by tables at R/3. So, it can not parse.
    A Web service's WSDL file is not well-formed because of an element specifying two attributes with the same name, the client application produces this error.
    Either there is indeed an issue with how the XML is being encoded and then decoded on other end or there's a step that is being missed somewhere.
    Thanks & Regards,
    Sai Kiran Rao.

  • JAXP 1.4 in JDK 1.5? javax.xml.stream.FactoryFinder$ConfigurationError

    hello,
    i'm forced to develop in jdk 1.5 and need to use package javax.xml.stream (StAX), which is not included in jaxp1.3 (in jdk 5), so there is a need to somehow integrate jaxp 1.4 to jdk5.
    first thing i've tried was getting jaxp 1.4 src and include a buildpath to my project to it. problem is, that javax.xml.stream.XMLOutputFactory.newInstance() throws exception javax.xml.stream.FactoryFinder$ConfigurationError: Provider com.sun.xml.internal.stream.XMLOutputFactoryImpl not found
    thanks in advance

    problem solved

  • XML stream utf-8 encoding

    Hi folks,
    I'm trying to establish a CSTRING XML stream with utf-8 encoding. I've only managed to do this in XSTRING so far.
    If i use this coding, i get a binary output.
      DATA: gt_result TYPE TABLE OF string,
             l_result type string.
      constants: encoding type string value 'UTF-8'.
      data:  g_ixml type ref to if_ixml.
      data:  g_stream_factory type ref to IF_IXML_STREAM_FACTORY.
      data:  g_encoding type ref to if_ixml_encoding.
      g_ixml = cl_ixml=>create( ).
      g_stream_factory = g_ixml->CREATE_STREAM_FACTORY( ).
      g_encoding = g_ixml->create_encoding( character_set = 'utf-8'
                                            byte_order = 0 ).
      data:  resstream type ref to if_ixml_ostream.
      resstream = g_stream_factory->create_ostream_cstring( l_result ).
      call method resstream->set_encoding
        EXPORTING
          encoding = g_encoding.
    * XML Transformieren
      CALL TRANSFORMATION id_indent
        SOURCE     itab = it_Itab
        RESULT XML resstream.
    * Temporär, XML File erzeugen
      refresh gt_result.
      APPEND l_result TO gt_result.
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename         = 'c:test.xml'
        CHANGING
          data_tab         = gt_result
        EXCEPTIONS
          file_write_error = 1.
    Without this expression :
    g_encoding = g_ixml->create_encoding(
                 character_set = 'utf-8' byte_order = 0 ).
    I get a cstring stream, but in utf-16.
    My question now is, how do I manage to get a utf-8 encoded stream in cstring?
    Thanks for your help.
    Cheers
    Daniel

    This is the solution:
    METHOD TRANSFORM_XML.
      TYPE-POOLS TRUXS.
    *********************** XML ***********************************
      DATA: GT_RESULT TYPE TABLE OF STRING,
             L_RESULT TYPE ETXML_LINE_STR.
      CONSTANTS:  ENCODING     TYPE STRING VALUE 'UTF-8'.
      DATA:  G_IXML TYPE REF TO IF_IXML.
      DATA:  G_STREAM_FACTORY TYPE REF TO IF_IXML_STREAM_FACTORY.
      DATA:  G_ENCODING TYPE REF TO IF_IXML_ENCODING.
      G_IXML = CL_IXML=>CREATE( ).
      G_STREAM_FACTORY = G_IXML->CREATE_STREAM_FACTORY( ).
      G_ENCODING = G_IXML->CREATE_ENCODING( CHARACTER_SET = ENCODING
                                            BYTE_ORDER = 0 ).
      DATA:  RESSTREAM TYPE REF TO IF_IXML_OSTREAM.
      RESSTREAM = G_STREAM_FACTORY->CREATE_OSTREAM_XSTRING( L_RESULT ).
      CALL METHOD RESSTREAM->SET_ENCODING
        EXPORTING
          ENCODING = G_ENCODING.
    * XML Transformieren
      CALL TRANSFORMATION ID_INDENT
        SOURCE     ITAB = IT_ITAB
        RESULT XML RESSTREAM.
    * XString to String
      CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
        EXPORTING
          IM_XSTRING  = L_RESULT
          IM_ENCODING = 'UTF-8'
        IMPORTING
          EX_STRING   = E_XML.
    * Temporär, XML File erzeugen
      refresh gt_result.
      APPEND e_xml TO gt_result.
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename         = 'c:test.xml'
        CHANGING
          data_tab         = gt_result
        EXCEPTIONS
          file_write_error = 1.
    ENDMETHOD.
    How can I give the 10 points to myself?
    Cheers
    Daniel

  • Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/stream

    I am trying to develop a web service client for amazon webservice.but i am getting this error while running the app. Can anyone please help me. I have installed the JWSDP and but could not understand why i have to locate all the jar files in the classpath?Please help.
    ===== error=========================================
    C:\abr\classes>java -classpath c:\abr\test.jar;C:\abr\jaxrpc-api.jar;C:\abr\jaxrpc-impl.jar;C:\abr\jaxrpc-spi.jar;c:\abr\classes\amazon.jar;C:\abr\mail.jar;C:\a
    br\saaj-api.jar;C:\abr\activation.jar;c:\abr\FastInfoset.jar;%classpath% Client
    [b]Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/stream/XMLS
    treamWriter
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.
    java:672)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:87)
    at amazon.AmazonSearchPort_Stub.authorSearchRequest(AmazonSearchPort_Stu
    b.java:988)
    at Client.main(Client.java:21)

    I'm assuming you're using JWSDP 1.6 as I see Fastinfoset.jar in your list. You are missing some jar files in your classpath there. The best way to know what you need is to look at the release notes for JWSDP 1.6. Since you're building a web serivce start with the table in there and lookup JAX-RPC. It'll show you what jar files are needed and what other libraries are needed. Now depending on what you're doing you don't really need all those.
    For sure you're missing jsr173_api.jar which is where I believe that class you need is located. This is in the JWSDP_1_6\sjsxp\lib directory. You will probably need the other jar thats in there too. Best bet is to follow the dependancy chart in the release notes.
    This should get you going.
    Ryan

  • XML stream and stored as an output XML file

    Dear ALL,
    Could you help me in such situation?
    I need create XML file. I have DTD file. I create XML stream and stored as an output XML file. But all the data of my XML file stored in one line.
    How I can create my XML file according to DTD file?
    Thanks a lot.
    Best regards,
    Igor

    hi
    good
    go through this links,hope these would help you to solve your problem
    http://rustemsoft.com/JSPsample.htm
    http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.etools.xmlbuilder.doc/tasks/txmltask.htm
    thanks
    mrutyun^

  • At com.sun.xml.stream.xerces.util.SymbolTable.hash(SymbolTable.java:222)

    Hi all,
    I'm trying to use a gSOAP server and a jax-ws client.
    I did a first test with WSDLReader to ask the wsdl from the gSOAP server and read it to display all informations.
    It was ok !
    Now I try to call a method whit this code :
              URL url = new URL("http://localhost:" + port + "/BenchOperations?wsdl");
              QName qname = new QName("http://www.Bench.toto.com", "BenchOperations");
              Service service = Service.create(url, qname); // EXCEPTION
              BenchPortType interfaceDeService = service.getPort(BenchPortType.class);
              TimeRequest timeRequest = new TimeRequest();
              timeRequest.setSleepDuration(sleep);
              TimeResponse timeResponse = interfaceDeService.time(timeRequest);but I have this exception on "Service.create" :
    Exception in thread "main" java.lang.NullPointerException
            at com.sun.xml.stream.xerces.util.SymbolTable.hash(SymbolTable.java:222)
            at com.sun.xml.stream.xerces.util.SymbolTable.addSymbol(SymbolTable.java:143)
            at com.sun.xml.stream.XMLReaderImpl.getNamespaceURI(XMLReaderImpl.java:1238)
            at javax.xml.stream.util.StreamReaderDelegate.getNamespaceURI(StreamReaderDelegate.java:94)
            at com.sun.xml.ws.wsdl.parser.ParserUtil.getQName(ParserUtil.java:66)
            at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parsePortTypeOperationInput(RuntimeWSDLParser.java:689)
            at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parsePortTypeOperation(RuntimeWSDLParser.java:662)
            at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parsePortType(RuntimeWSDLParser.java:636)
            at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parseWSDL(RuntimeWSDLParser.java:297)
            at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parseWSDL(RuntimeWSDLParser.java:253)
            at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:131)
            at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:239)
            at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:201)
            at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:172)
            at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
            at javax.xml.ws.Service.<init>(Service.java:56)
            at javax.xml.ws.Service.create(Service.java:697)
            at com.thalesgroup.bench.client.Client.startClient(Client.java:25)
            at com.thalesgroup.bench.client.Client.<init>(Client.java:20)
            at com.thalesgroup.bench.client.Client.main(Client.java:16)I don't understand why ! This excpetion show that the client is trying to parse something (that's why I did the first test) and there is a nullPointer.
    Thanks a lot for your help
    Ob�

    Hi all,
    I compared the wsdl sent by the gSOAP server and the jax-ws server and there are not similar !
    this can explain that I have a nullPointerExcpetion when I use a gSOAP server
    How I can do ? Why the wsdl sent are not the same ?
    Thanks for your help
    Ob�lix

  • Urgent help for processing XML stream read from a JAR file

    Hi, everyone,
         Urgently need your help!
         I am reading an XML config file from a jar file. It can print out the result well when I use the following code:
    ===============================================
    InputStream is = getClass().getResourceAsStream("conf/config.xml");
    BufferedReader br = new BufferedReader(new InputStreamReader(is));
    String line;
    while ((line = br.readLine()) != null) {
    System.out.println(line); // It works fine here, which means that the inputstream is correct
    // process the XML stream I read from above
    NodeIterator ni = processXPath("//grid/gridinfo", is);
    Below is the processXPath() function I have written:
    public static NodeIterator processXPath(String xpath, InputStream byteStream) throws Exception {
    // Set up a DOM tree to query.
    InputSource in = new InputSource(byteStream);
    DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
    dfactory.setNamespaceAware(true);
    Document doc = dfactory.newDocumentBuilder().parse(in);
    // Use the simple XPath API to select a nodeIterator.
    System.out.println("Querying DOM using " + xpath);
    NodeIterator ni = XPathAPI.selectNodeIterator(doc, xpath);
    return ni;
    It gives me so much errors:
    org.xml.sax.SAXParseException: The root element is required in a well-formed doc
    ument.
    at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213
    at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XM
    LDocumentScanner.java:570)
    at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.endO
    fInput(XMLDocumentScanner.java:790)
    at org.apache.xerces.framework.XMLDocumentScanner.endOfInput(XMLDocument
    Scanner.java:418)
    at org.apache.xerces.validators.common.XMLValidator.sendEndOfInputNotifi
    cations(XMLValidator.java:712)
    at org.apache.xerces.readers.DefaultEntityHandler.changeReaders(DefaultE
    ntityHandler.java:1031)
    at org.apache.xerces.readers.XMLEntityReader.changeReaders(XMLEntityRead
    er.java:168)
    at org.apache.xerces.readers.UTF8Reader.changeReaders(UTF8Reader.java:18
    2)
    at org.apache.xerces.readers.UTF8Reader.lookingAtChar(UTF8Reader.java:19
    7)
    at org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.disp
    atch(XMLDocumentScanner.java:686)
    at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
    canner.java:381)
    at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.
    java:195)
    at processXPath(Unknown Source)
    Thank you very much!
    Sincerely Yours
    David

    org.xml.sax.SAXParseException: The root element is required in a well-formed document.This often means that the parser can't find the document. You think it should be able to find the document because your test code could. However if your test code was not in the same package as your real (failing) code, your test is no good because getResourceAsStream("conf/config.xml") is looking for that file name relative to the package of the class that contains that line of code.
    If your test code wasn't in any package, put a slash before the filename and see if that works.

  • Reading a text file and producing XML

    Is there a tool out there or integrated to JDev where I can take a text file with certain text strings in it and produce XML?
    M

    You can use the components in the Oracle XDK for Java for this. JDeveloper ships with a version of the Oracle XDK for Java, but the latest release is always at http://otn.oracle.com/tech/xml
    Steve Muench
    Development Lead, Oracle XSQL Pages Framework
    Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
    Author, Building Oracle XML Applications
    null

  • Problem in javax.xml.stream package

    i am getting some trouble while using the import statement for following package:-
    import javax.xml.stream.*;
    I have j2sdk1.4.2 installed in my system. I am using NetBeans 3.6 IDE.
    Should i copy some jars in order to resolve this issue. You can send me the steps at:- [email protected]
    Please help me.
    Regards
    Sks

    Have not been able to find anything in the bug database.
    I am alittle worried that the StAX - 1.0.1 (http://stax.codehaus.org) has a method with the same signature that does something very different.

  • Oracle apps are producing XML output in the C Mgrs that the user can't read

    Hi all,
    please help on the below issue.
    Oracle apps (AP & others) are producing XML output in the Concurrent Managers that the user cannot read. There are two flavors, as an error message: The XML page cannot be displayed Cannot view XML input using XSL style
    sheet.
    The following tags were not closed: XLAACCPB, LIST_APPLICATION. Error processing resource ''https://xxxxxxxxxxxxxxx... as well as the XML text itself: - 200 Payables 200 Payables Y 1 xxxx US EXPENSE GL 2011-07-15T00:00:00.000+00:00 N No Y Y N D No Detail Y Yes Y N No - - 200 Payables - - 95293 The journal import request 39073188 has failed for the ledger xxxx US EXPENSE GL.
    Thanks in advance
    Kumar

    please help on the below issue.Please post the details of the application release, database version and OS.
    Oracle apps (AP & others) are producing XML output in the Concurrent Managers that the user cannot read. There are two flavors, as an error message: The XML page cannot be displayed Cannot view XML input using XSL style sheet. What is the exact/complete error message?
    Please check the OPP log file for details about the error.
    Troubleshooting Oracle XML Publisher For The Oracle E-Business Suite [ID 364547.1]
    Unable to Display XML Page - "Cannot view XML input using XSL style sheet" [ID 730610.1]
    Unable To Review XML Output From Application : "Cannot view XML input using XSL style sheet" [ID 437749.1]
    Thanks,
    Hussein

  • Javax.xml.stream.XMLInputFactory problems with &

    Hi all
    I am using javax.xml.stream.XMLInputFactory to create an XMLStreamReader, which reads XML in from a database.
    The problem is that when it encounters & entities, it is replacing them simply with &. When I then go to transform the XML with an XSL stylesheet, it fails with a parser error due to the presence of unescaped & characters.
    Looking at the API documentation, I thought that setting the property javax.xml.stream.isReplacingEntityReferences to false would solve the problem, but it isn't. The line of code I am using is as follows: -
    inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences", new Boolean(false));
    Any further ideas as to what I am doing wrong or what else I should be doing?
    Many thanks for reading and considering my post.
    Kind Regards
    Jon

    Thanks for your continued posts guys...
    Quote from DrClap: "So if you consider this to be a problem, you are most likely misunderstanding. Or is there a reason why you feel you have to know how the text was represented in the document it came from?"
    Right, just to clarify, this is what I'm trying to do...
    1. XML, complete with properly escaped characters (&, etc) is sitting in the database.
    2. Next, I am attempting to read the XML into memory character for character via an XMLInputStream and so I still want &, etc, not just &.
    3. Finally, I apply stylesheet to XML Now I do want the parser to decode the & into &. The problem is that it has already been done in 2 (above) so the parser in 3 falls over.
    Thanks for pointing out that javax.xml.stream.XMLInputFactory is not a standard class DrClap - looks like it's back to the drawing board for me!!
    Thanks
    Jon

  • Parse XML streams via ABAP program or class

    Hi all,
    because of a new requirement we would like to create characteristics from a XML file by using the following structure.  
    xmlns:gdt="http://sap.com/xi/SAPGlobal/Global" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    We do not use SAP XI but I would like to parse the XML stream from a file in order to have the information available in a ABAP program. For this reason I'm looking for a standard SAP ABAP program or class to read and parse such a XML file. 
    I would appreciate if somebody have more details on this topic.

    Check this out.
    XML to ABAP
    Regards,
    Rich Heilman

  • Mapping XML stream to C structure using XSLT ?

    Can I use XSLT to map an XML stream to a C structure ?. is there any samples ?
    Raees

    Can I use XSLT to map an XML stream to a C structure ?. is there any samples ?
    Raees

  • Create XML stream and stored as an output XML file

    Dear ALL,
    Could you help me in such situation?
    I need create XML file. I have DTD file. I create XML stream and stored as an output XML file. But all the data of my XML file stored in one line.
    How I can create my XML file according to DTD file?
    Thanks a lot.
    Best regards,
    Igor

    hi
    good
    go through this links,hope these would help you to solve your problem
    http://rustemsoft.com/JSPsample.htm
    http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.etools.xmlbuilder.doc/tasks/txmltask.htm
    thanks
    mrutyun^

Maybe you are looking for

  • Rotation is not working in mail

    The rotation in my iPad is working all right, except on the Mail. On every other app it works. ***?

  • APEX 3.0.1 /Vista Premium   install failing:

    Hi Can anyone assist me with this ... I get following error when running chart_demo app. fm."Release 3.0 New Feature Demos" page under APEX 3.0.1 and Vista Premium: "A script in this movie is causing Macromedia Flash Player 7 to run slowly. If it con

  • Export(Backup) of Variants.

    Hi, I want to export using R3trans or transport, selection variants and ALV layout variants in SAP systems. I did search sdn and found that we can use program RSTRANSP to create transport for a program and its variants, but i am looking for an option

  • Convert to a symbol problem

    What is happening is, when i convert my button to a symbol it disappears on my stage its invisible. This make's it very difficult for me to see the overall design because i can't see it.. Does anyone know the solution how i can fix this?

  • After getting Firefox 9.0 my emails are extremely hard to open; it worked fine before I updated.

    Cursor lags and moves in jerks. Email opens very slowly, and only after multiple fast clicks. Impossible to reply to emails.