Process xml string on url

Hi,
I need to build a page that will do the following and I'm
hoping for some
guidance..
remote client open URL
http://domain.com/getdata.cfm
remote client check that the port is open then send xml
string
the page needs to process the xml string
example: <data>
<id>1</id>
<event>sales</event>
</data>
after process send back a respond...
I don't know where to begin doing something like this... any
suggestions
would be greatly appreciated!

I tried that, and it in fact is a string. I also renamed my
function correctly (i.e. loadMovie), but I'm still getting the
'undefined' issue for the URL. I've tried to comment a little more
in the text below. The problem seems to be in the last 4 or 5 lines
where I'm trying to use a variable string to define the url instead
of a hard coded string with " quotes ".
Thanks again! :)
// Create new XML Object and set ignoreWhite true
book_xml = new XML();
book_xml.ignoreWhite = true;
// Setup load handler which just invokes another function
// which will do the parsing of our XML
book_xml.onLoad = function(sucess) {
if (sucess) {
processBook(book_xml);
// Load up the XML file into Flash
book_xml.load('book.xml');
// This is the function that will be called when
// our XML document is loaded succesfully
function processBook(xmlDoc_xml) {
// xmlDoc_xml is now a reference to the XML
// object where our information is stored
// the content of the first three variables below display
fine because the variables are
// linked to a dynamic text field. The 4th is not working
since I am using it to define
// the URL in the loadmovie function below.
topictxt1_var =
(xmlDoc_xml.firstChild.firstChild.firstChild.firstChild.nodeValue);
bodytxt1_var =
(xmlDoc_xml.firstChild.firstChild.firstChild.nextSibling.firstChild.nodeValue);
instructions_var =
(xmlDoc_xml.firstChild.firstChild.firstChild.nextSibling.nextSibling.firstChild.nodeValue );
media_var =
(xmlDoc_xml.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChi ld.nodeValue);
//The problem here is that the variable media_var contains
the string "images/award.jpg" without the quotes.
//In the loadmovie function needs the quotes " at the
beginning and end of the string images/award.jpg to define the URL.
//This works>> loadMovie("images/award.jpg", image_mc);
//This doesn't
loadMovie(media_var, image_mc);

Similar Messages

  • How to get XMP MetaData as an XML String in a process?

    Hi there,
    I have a process where I would like to export a documents XMP MetaData, manipulate the XMP MetaData and then import the MetaData again to the document.
    I thougt first I will use the service Name "XMPUtilityService" with the Service Operation "Export XMP" to export the XMP MetaData as a document.
    Hoewer I am not sure how to manipulate the output document from the Export XMP service.
    When I print out the document.toString() in a execute Script Service I get the following:
    <document state="active" senderVersion="0" persistent="false" senderPersistent="false" passivated="false" senderPassivated="false" deserialized="false" senderHostId="null" callbackId="0" senderCallbackId="0" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="3440" contentType="null" length="-1"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><senderGl obalBackendId/><inline><?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="A...</inline><senderPullServantJndiName/><attributes/></document>
    Actually I expected something like this:
    <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-jc006 DEBUG-1.0, 2009 Jun 23 11:07:21-PDT">
       <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
          <rdf:Description rdf:about=""
                xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
             <pdf:Producer>Adobe LiveCycle PDF Generator ES2</pdf:Producer>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmp="http://ns.adobe.com/xap/1.0/">
             <xmp:ModifyDate>2010-04-20T20:43:59+02:00</xmp:ModifyDate>
             <xmp:MetadataDate>2010-04-20T20:43:59+02:00</xmp:MetadataDate>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
             <xmpMM:DocumentID>uuid:0cf2c6c6-2fba-2b39-5fb6-33ad8ccf58aa</xmpMM:DocumentID>
             <xmpMM:InstanceID>uuid:187bc5a2-acb0-2fa9-711d-33ad8ccf58aa</xmpMM:InstanceID>
          </rdf:Description>
       </rdf:RDF>
    </x:xmpmeta>
    <?xpacket end="w"?>
    What do I need to do to get the XMPMeta data as an XML String from a document within a process?
    Thanks in advance!
    Paul

    Hi,
    thanks for the answer.
    I know that I can retrieve the XMPUtilityMetadata object, but this object provides only access to a few information suche as creator, subject, producer, etc.
    However I would like to retrieve the whole XML String of the XMP Metadata.
    How is this possible?
    Thanks.
    Paul

  • How to process a large XML string passed to a LONG variable?

    I am attempting to extract and loop through some XML that is stored in a variable (v_xml_string) that is defined as LONG data type. However, I am receiving an ORA-01460: unimplemented or unreasonable conversion requested when the string value exceeds 20 records in the XML layout below. When I performed a LENGHTB on a sample XML string containing 19 records (just below the threshold of erroring), I get 3895, which I'm assuming is in BYTES...this is not near the 32,760 byte limit of PL/SQL variables defined as LONG. I suppose my other alternative is that I use CLOB datatype instead of LONG.
    XML layout:
    <?xml version="1.0"?>
    <DocumentElement>
      <tblElections>
        <EmpID>872G4</EmpID>
        <MgrNTID>JohnDoe</MgrNTID>
        <Entity>050595</Entity>
        <AddlAmt>1000</AddlAmt>
        <CheckedForSave>Y</CheckedForSave>   
      </tblElections>
    </DocumentElement>sample of code where error appers to be occurring:
    DECLARE
      v_xml_string LONG;
    BEGIN
        FOR v_xml_rec IN (SELECT t.COLUMN_VALUE.extract('/tblElections/EmpID/text()') .getStringVal() EmpID,
                                 t.COLUMN_VALUE.extract('/tblElections/MgrNTID/text()') .getStringVal() MgrNTID,
                                 t.COLUMN_VALUE.extract('/tblElections/FAEntity/text()') .getStringVal() FAEntity,
                                 t.COLUMN_VALUE.extract('/tblElections/AddlSLEAAmt/text()') .getStringVal() AddlSLEAAmt,
                                 t.COLUMN_VALUE.extract('/tblElections/CheckedForSave/text()') .getStringVal() CheckedForSave
                            FROM TABLE(xmlsequence(XMLTYPE(v_xml_string) .extract('/DocumentElement/tblElections'))) t)
        LOOP
    ... <do some stuff here>
       END LOOP;
    END;

    Strings in SQL are limited to 4000 in length, the long variable will work up to 32K as long as it is not used in SQL, if it goes over 4000 you will get the error.
    SQL> declare
      2    l long;
      3  begin
      4    l := rpad('x',32000,'x');
      5    dbms_output.put_line('length is : ' || to_char(length(l)));
      6  end;
      7  /
    length is : 32000
    PL/SQL procedure successfully completed.
    SQL> edi
    Wrote file afiedt.sql
      1  declare
      2    l long;
      3    n number;
      4  begin
      5    l := rpad('x',32000,'x');
      6    select length(l) into n from dual;
      7    dbms_output.put_line('length is : ' || to_char(n));
      8* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-01460: unimplemented or unreasonable conversion requested
    ORA-06512: at line 6
    SQL> edi
    Wrote file afiedt.sql
      1  declare
      2    l long;
      3    n number;
      4  begin
      5    l := rpad('x',4000,'x');
      6    select length(l) into n from dual;
      7    dbms_output.put_line('length is : ' || to_char(n));
      8* end;
    SQL> /
    length is : 4000
    PL/SQL procedure successfully completed.
    SQL> edi
    Wrote file afiedt.sql
      1  declare
      2    l long;
      3    n number;
      4  begin
      5    l := rpad('x',4001,'x');
      6    select length(l) into n from dual;
      7    dbms_output.put_line('length is : ' || to_char(n));
      8* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-01460: unimplemented or unreasonable conversion requested
    ORA-06512: at line 6
    SQL>

  • Error processing XML request, java.lang.IllegalArgumentException

    Hi all,
    In my code I can successfully connect to server and send the content which is an XML content:
    param = java.net.URLEncoder.encode(s, "UTF-8");
    java.io.PrintWriter out = new java.io.PrintWriter(connection.getOutputStream());
    out.print(param);
    Read the response from server:
    java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(connection.getInputStream()));
    while((input = in.readLine()) != null)
    response += input + "\r";
    System.out.println("Client : received : "+response);
    Following is the response I receive from server:
    Client : received : <html><h1>Error processing XML request</h1>java.lang.IllegalArgumentException: No xml request posted</html>
    Has anybody know what the problem is? Why this error is issued?
    Any help is greatly appreciated.

    Dear legosa,
    Thanks so much for the replies. What you wrote makes absolute sence, w/o flush() or close(), it seems that I'm sending only balnk to output!
    I don't know how can I fix the 500 Internal Server Error; below is my complete code that does this part, can you tell me if you see sth. wrong in this code?
    param = java.net.URLEncoder.encode(aTrans.xmlDoc, "UTF-8");
    url = new URL("https://xml.test.surepay.com");
    connection = (HttpURLConnection)url.openConnection();                    
    connection.setDoInput(true);
    connection.setDoOutput(true);
    connection.setUseCaches(false);
    connection.setRequestMethod("POST");
    connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
    String sLen = "" + param.length();
    connection.setRequestProperty("Content-length", sLen);
    connection.setRequestProperty("Accept", "text/plain");
    connection.connect();
    System.out.println("Client : Connected");
    java.io.PrintWriter out = new java.io.PrintWriter(connection.getOutputStream());
    System.out.println("Client : Writing Content");
    out.print(param);
    out.close();
    System.out.println(connection.getURL());          
    System.out.println(connection.getResponseCode() + " " + connection.getResponseMessage());
    System.out.println(connection.getURL());
    System.out.println("Client : Waiting for response from Server");
    java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(connection.getInputStream()));
    System.out.println("Client : Opened input stream");
    while((input = in.readLine()) != null)
    response += input + "\r";
    System.out.println("Client : received : "+response);

  • Exception Description: Unable to process XML tag [driver-class] with value

    Hi
    I'm newbie with TopLink. I try to write a litle application with TopLink:
    - First, I create a session.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <toplink-sessions version="11g Technology Preview 3 (11.1.1.0.0)" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <session xsi:type="database-session">
    <name>dbsession</name>
    <event-listener-classes/>
    <logging xsi:type="toplink-log"/>
    <primary-project xsi:type="xml">META-INF/tlMap.xml</primary-project>
    <login xsi:type="database-login">
    <platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
    <user-name>dev</user-name>
    <password>F6A3DA7BA187330D4E11A713C42FF833</password>
    <sequencing>
    <default-sequence xsi:type="table-sequence">
    <name>Default</name>
    </default-sequence>
    </sequencing>
    <driver-class>oracle.jdbc.OracleDriver</driver-class>
    <connection-url>jdbc:oracle:thin:@//10.10.10.31:1521/devdb1</connection-url>
    <bind-all-parameters>false</bind-all-parameters>
    <struct-converters/>
    </login>
    </session>
    </toplink-sessions>
    - Second, I create a Java Application ( Application1.java):
    package project2;
    import java.sql.ResultSet;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Vector;
    import oracle.toplink.queryframework.DataModifyQuery;
    import oracle.toplink.queryframework.SQLCall;
    import oracle.toplink.queryframework.StoredProcedureCall;
    import oracle.toplink.sessions.DatabaseSession;
    import oracle.toplink.sessions.Session;
    import oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader;
    import oracle.toplink.tools.sessionmanagement.SessionManager;
    import oracle.toplink.util.SessionFactory;
    public class Application1 {
    public Application1() {
    public static void main(String[] args) {
    // new Application1();
    String statement = "SELECT motdepasse,login FROM bou_courtier";
    SessionManager sessionmanager = SessionManager.getManager();
    System.out.println("test");
    // SessionFactory sessionfactory = new SessionFactory("META-INF/sessions.xml","dbsession");
    DatabaseSession session = (DatabaseSession)sessionmanager.getSession(new XMLSessionConfigLoader(),"dbsession",Thread.currentThread().getContextClassLoader());
    // Session session = sessionfactory.acquireSession();
    System.out.println("test");
    SQLCall sqlcall = new SQLCall(statement);
    session.executeNonSelectingCall(sqlcall);
    ResultSet rs = sqlcall.getResult();
    try {
    while(rs.next()){
    String strPass = rs.getString(1);
    String strLogin = rs.getString(2);
    System.out.println("Password :"+strPass+"---"+"Login :"+strLogin);
    } catch (SQLException e) {
    // TODO
    - Third, I build and run Application1.java in Jdevelopper 11g preview 3. Sadly, the result is a error:
    Exception in thread "main" Local Exception Stack:
    Exception [TOPLINK-9003] (Oracle TopLink - 11g Technology Preview 3 (11.1.1.0.0) (Build 071207)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: Unable to process XML tag [driver-class] with value [oracle.jdbc.OracleDriver].
    Internal Exception: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
         at oracle.toplink.exceptions.SessionLoaderException.failedToLoadTag(SessionLoaderException.java:83)
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildDatabaseLoginConfig(TopLinkSessionsFactory.java:408)
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildLogin(TopLinkSessionsFactory.java:336)
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildDatabaseSessionConfig(TopLinkSessionsFactory.java:182)
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildSession(TopLinkSessionsFactory.java:168)
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildTopLinkSessions(TopLinkSessionsFactory.java:117)
         at oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader.load(XMLSessionConfigLoader.java:239)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:448)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:311)
         at project2.Application1.main(Application1.java:33)
    Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildDatabaseLoginConfig(TopLinkSessionsFactory.java:405)
         ... 8 more
    Process exited with exit code 1.
    Can you help me to debug this error. Many thanks
    user615555

    The internal error: "java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver"
    is stating it can't find your driver jar file on the classpath. You'll need to check that you've included your Database driver in the list of libraries on your classpath.
    Best Regards,
    Chris

  • Processing XML files that contain Special Characters

    Hello:
    Before I explain my problem I think I should briefly explain what I am trying to do. I have a JSP page that invokes a Java method (the code is attached). This java method takes in an XML file and an XSLT file. It parses the XSLT and also the XML file. If the parsing went through fine, it then processes the XML file and applies the XSLT to the XML file and returns a XMLDocumentFragment Object back to JSP and the JSP renders it.
    This mechanism works well. However off late I have encountered a few XML files containing characters such as &Ecirc (Capital E with circumflex accent). Whenever my Java method tries to parse/process this .xml file it gives me the following error.
    ORG.oclc.da.utilities.ifs.ReportException: An Error Occured While Parsing the Report: Missing entity 'Ecirc'.     at ORG.oclc.da.archive.userinterface.ReportHelper.retrieveReport(Unknown Source)     at /ViewReport.jsp._jspService(/ViewReport.jsp.java:87) (JSP page line 65)     at com.orionserver[Oracle9iAS (1.0.2.2) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:54)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpApplication.serviceJSP(HttpApplication.java:5458)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.JSPServlet.service(JSPServlet.java:31)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    It seems like the Oracle Parser/XSLT Processor (oracle.xml.parser.v2.DOMParser) I am using is not able to handle special characters such &Ecirc. I was wondering if there is anyway around this problem.
    Attached is the Java Method that handles both the parsing and processing of the XML file.
    /** The method parses the Report Data and applies the Style Sheet to this data
    * @param The InputStream (Report Contents - .xml file), Name of the StyleSheet that needs to be applied
    * @return A sub-section of the report data (DOM DocumentFragment is returned)
    private XMLDocumentFragment parseReport(InputStream reportStream,String strStyleSheet) throws Exception
    DOMParser parser;
    XMLDocument xml, xsldoc, out;
    URL urlStyleSheet;
    //Get the URL for the Style Sheet
    urlStyleSheet = new URL(strStyleSheet);
    //Create an instance of the Dom Parser
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    //Parse the XSL document and create a DOM Object
    parser.parse(urlStyleSheet);
    xsldoc = parser.getDocument();
    //Parse the report document (a .xml) and create a DOM Object
    parser.parse(reportStream);
    xml = parser.getDocument();
    // instantiate a stylesheet
    XSLStylesheet xsl = new XSLStylesheet(xsldoc, urlStyleSheet);
    XSLProcessor processor = new XSLProcessor();
    // display any warnings that may occur
    processor.showWarnings(true);
    // processor.setErrorStream(System.err);
    // Process XSL
    XMLDocumentFragment result = processor.processXSL(xsl, xml);
    return result;
    If you have any suggestions please let me know. If you need more information I will be to furnish it.
    thanks
    Mathangi

    Hello,
    I just had the same problem, you need to include the approprate entity sets so that the xsl parser will recognize them (and you won't
    get the "missing entity" error:
    if you already haven't you need to add a DOCTYPE processing instruction for your dtd, to the top of your xml files to be parsed, for ex.:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "file:///mydir/mydtd.dtd">
    then in "mydtd.dtd", add references to these 3 entity sets (if you have a dtd - if not then create one just with these entries):
    <!ENTITY % HTMLlat1 PUBLIC
    "-//W3C//ENTITIES Latin 1 for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
    %HTMLlat1;
    <!ENTITY % HTMLspecial PUBLIC
    "-//W3C//ENTITIES Special for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
    %HTMLspecial;
    <!ENTITY % HTMLsymbol PUBLIC
    "-//W3C//ENTITIES Symbols for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
    %HTMLsymbol;
    Or, grab the ".ent" files from the www.w3.org site and put them on your server in the dtd dir, and change the "http:... reference, to
    "file:...", it will be faster to parse (that's what I did). FYI, "Ecirc" is in xhtml-lat1.ent.
    Also, after I did this,I developed another problem where my xsl parser and xmlmarkup tag-converting function converts certain
    html entities to their octal counterparts, and I don't want this and don't know how to stop it (I have a posting out for this also).
    Additionally, thanks for posting your parseReport method, it just so happens that I was looking for a way to do something like that,
    it should be helpful to me.
    -JK
    Hello:
    Before I explain my problem I think I should briefly explain what I am trying to do. I have a JSP page that invokes a Java method (the code is attached). This java method takes in an XML file and an XSLT file. It parses the XSLT and also the XML file. If the parsing went through fine, it then processes the XML file and applies the XSLT to the XML file and returns a XMLDocumentFragment Object back to JSP and the JSP renders it.
    This mechanism works well. However off late I have encountered a few XML files containing characters such as J (Capital E with circumflex accent). Whenever my Java method tries to parse/process this .xml file it gives me the following error.
    ORG.oclc.da.utilities.ifs.ReportException: An Error Occured While Parsing the Report: Missing entity 'Ecirc'.     at ORG.oclc.da.archive.userinterface.ReportHelper.retrieveReport(Unknown Source)     at /ViewReport.jsp._jspService(/ViewReport.jsp.java:87) (JSP page line 65)     at com.orionserver[Oracle9iAS (1.0.2.2) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:54)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpApplication.serviceJSP(HttpApplication.java:5458)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.JSPServlet.service(JSPServlet.java:31)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    It seems like the Oracle Parser/XSLT Processor (oracle.xml.parser.v2.DOMParser) I am using is not able to handle special characters such J. I was wondering if there is anyway around this problem.
    Attached is the Java Method that handles both the parsing and processing of the XML file.
    /** The method parses the Report Data and applies the Style Sheet to this data
    * @param The InputStream (Report Contents - .xml file), Name of the StyleSheet that needs to be applied
    * @return A sub-section of the report data (DOM DocumentFragment is returned)
    private XMLDocumentFragment parseReport(InputStream reportStream,String strStyleSheet) throws Exception
    DOMParser parser;
    XMLDocument xml, xsldoc, out;
    URL urlStyleSheet;
    //Get the URL for the Style Sheet
    urlStyleSheet = new URL(strStyleSheet);
    //Create an instance of the Dom Parser
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    //Parse the XSL document and create a DOM Object
    parser.parse(urlStyleSheet);
    xsldoc = parser.getDocument();
    //Parse the report document (a .xml) and create a DOM Object
    parser.parse(reportStream);
    xml = parser.getDocument();
    // instantiate a stylesheet
    XSLStylesheet xsl = new XSLStylesheet(xsldoc, urlStyleSheet);
    XSLProcessor processor = new XSLProcessor();
    // display any warnings that may occur
    processor.showWarnings(true);
    // processor.setErrorStream(System.err);
    // Process XSL
    XMLDocumentFragment result = processor.processXSL(xsl, xml);
    return result;
    If you have any suggestions please let me know. If you need more information I will be to furnish it.
    thanks
    Mathangi

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • How to get an XML string from a Java Bean without wrting to a file first ?

    I know we can save a Java Bean to an XML file with XMLEncoder and then read it back with XMLDecoder.
    But how can I get an XML string of a Java Bean without writing to a file first ?
    For instance :
    My_Class A_Class = new My_Class("a",1,2,"Z", ...);
    String XML_String_Of_The_Class = an XML representation of A_Class ?
    Of course I can save it to a file with XMLEncoder, and read it in using XMLDecoder, then delete the file, I wonder if it is possible to skip all that and get the XML string directly ?
    Frank

    I think so too, but I am trying to send the object to a servlet as shown below, since I don't know how to send an object to a servlet, I can only turn it into a string and reconstruct it back to an object on the server side after receiving it :
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class Servlet_Message        // Send a message to an HTTP servlet. The protocol is a GET or POST request with a URLEncoded string holding the arguments sent as name=value pairs.
      public static int GET=0;
      public static int POST=1;
      private URL servlet;
      // the URL of the servlet to send messages to
      public Servlet_Message(URL servlet) { this.servlet=servlet; }
      public String sendMessage(Properties args) throws IOException { return sendMessage(args,POST); }
      // Send the request. Return the input stream with the response if the request succeeds.
      // @param args the arguments to send to the servlet
      // @param method GET or POST
      // @exception IOException if error sending request
      // @return the response from the servlet to this message
      public String sendMessage(Properties args,int method) throws IOException
        String Input_Line;
        StringBuffer Result_Buf=new StringBuffer();
        // Set this up any way you want -- POST can be used for all calls, but request headers
        // cannot be set in JDK 1.0.2 so the query string still must be used to pass arguments.
        if (method==GET)
          URL url=new URL(servlet.toExternalForm()+"?"+toEncodedString(args));
          BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
        else     
          URLConnection conn=servlet.openConnection();
          conn.setDoInput(true);
          conn.setDoOutput(true);           
          conn.setUseCaches(false);
          // Work around a Netscape bug
          conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
          // POST the request data (html form encoded)
          DataOutputStream out=new DataOutputStream(conn.getOutputStream());
          if (args!=null && args.size()>0)
            out.writeBytes(toEncodedString(args));
    //        System.out.println("ServletMessage args: "+args);
    //        System.out.println("ServletMessage toEncString args: "+toEncodedString(args));     
          BufferedReader in=new BufferedReader(new InputStreamReader(conn.getInputStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
          out.flush();
          out.close(); // ESSENTIAL for this to work!          
        return Result_Buf.toString();               // Read the POST response data   
      // Encode the arguments in the property set as a URL-encoded string. Multiple name=value pairs are separated by ampersands.
      // @return the URLEncoded string with name=value pairs
      public String toEncodedString(Properties args)
        StringBuffer sb=new StringBuffer();
        if (args!=null)
          String sep="";
          Enumeration names=args.propertyNames();
          while (names.hasMoreElements())
            String name=(String)names.nextElement();
            try { sb.append(sep+URLEncoder.encode(name,"UTF-8")+"="+URLEncoder.encode(args.getProperty(name),"UTF-8")); }
    //        try { sb.append(sep+URLEncoder.encode(name,"UTF-16")+"="+URLEncoder.encode(args.getProperty(name),"UTF-16")); }
            catch (UnsupportedEncodingException e) { System.out.println(e); }
            sep="&";
        return sb.toString();
    }As shown above the servlet need to encode a string.
    Now my question becomes :
    <1> Is it possible to send an object to a servlet, if so how ? And at the receiving end how to get it back to an object ?
    <2> If it can't be done, how can I be sure to encode the string in the right format to send it over to the servlet ?
    Frank

  • Convert XML string into XML

    Hi All,
    Can you please let me know for any sample code in xslt/java mapping for converting XML string into XML. We use SAP Pi 7.0
    My XML string starts like this
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <ns0:MT_ReceiverFileStructure <namespace>"><Output><?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<xsl>"?><Tarih_Date Tarih="11.09.2014" Date="09/11/2014>
       Thanks,
       Pavithra

    Thanks Praveen. It worked.
    However, the xml i have is an extract from a exchange rate URL and it has the reference to a xsl in it as below
    <?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<ABC.xsl>"?>.
    So there is an error in sxmb_moni. Is it possible to remove this.

  • Passing XML String via HTTP Sender

    Hello everyone,
    currently we try to find a solution on the following requirement - maybe you have useful advice for us:
    8 different business documents can be sent via a web-interface to SAP XI via the http sender adapter. We already have a customized JCo Class that takes only one input parameter (containining the XML string of the business document).
    I think the easiest way would be to receive the XML string from the web-interface and pass it directly on to the JCo-Class in a Java Mapping.
    Is it possible to create a generic message type for all 8 types of XML documents that contains just one element holding the XML as string? By doing so we could use the same URL for all 8 different XML types and pass it directly on as input paramenter to the JCo Class.
    Do you have any idea how to do this?
    Thank you very much.

    Does the HttpURLConnection conn send the string along with the headerYes.

  • A class to format an XML string into indented xml code

    I am looking for a class or a piece of code to format an XML string into indented xml code
    for example: an XML string as follows
    <servlet><servlet-name>Login</servlet-name>servlet-class>ucs.merch.client.system.LoginServlet</servlet-class></servlet><servlet-mapping><servlet-name>Login</servlet-name>
    to format into :
    <servlet>
    <servlet-name>Login</servlet-name>
    <servlet-class>ucs.merch.client.system.LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Login</servlet-name>
    <url-pattern>/Login</url-pattern>
    </servlet-mapping>
    e-mail : [email protected]

    Xerces has a class called OutputFormat
    If you have your XML document in memory, you can format it using the method setIndenting(true) on the OutputFormat class. The following is an example:
    assuming xmlDoc is our document and fileName is the name of the file we wish to write to:
    OutputFormat format = new OutputFormat(xmlDoc);
    // setup output file name
    PrintWriter printwriter = new PrintWriter(new FileWriter(fileName, false));
    // construct an XMLSerializer for writing the document
    XMLSerializer serializer = new XMLSerializer( printwriter, format );
    // Ensure output is indented correctly...
    format.setIndenting(true);
    // set serializer as a DOM Serializer
    serializer.asDOMSerializer();
    // serialize the document
    serializer.serialize(xmlDoc);
    hope this helps!
    Rob.

  • Using XML String in the Scheduler Adapter in the Receive port

    I have a requirement where I have to query the view in the Oracle database,and the View is like this
    EmpNumber | Name | TermDate
    E001 | ABC | (null)
    E002 | DEF | 13-DEC-14
    E003 | GHI | (null)
    E004 | JKL | 11-NOV-14
    E005 | MNO | (null)
    E005 | PQR | 10-DEC-14
    I am going to use the Scheduler adapter in the receive port.It should select the Records with the TermDate null and TermDate 7days ago from today. So here is how I want the selected records to be
    EmpNumber | Name | TermDate
    E001 | ABC | (null)
    E002 | DEF | 13-DEC-14
    E003 | GHI | (null)
    E005 | MNO | (null)
    In the other forum I found the sql command to do this is,
    select * from EMP where TERMDATE is null or TERMDATE >= trunc(sysdate) - 7;
    But I am not sure if the XML String in the Scheduler Adapter is correct
    <ns0:Select xmlns:ns0="http://Microsoft.LobServices.OracleDB/2007/03/View/EMP"><ns0:COLUMN_NAMES>*</ns0:COLUMN_NAMES><ns0:FILTER>TERMDATE IN ('null','TERMDATE >= trunc(sysdate) - 7')</ns0:FILTER></ns0:Select>
    Any help will be greatly appreciated. Thanks

    Thanks Suleiman.
    I am using the WCF-Custom Adapter to get the data from the Oracle database. And I am using the Scheduler adapter because to get data on a daily basis.In one of our other application we have used the query statement in the Scheduler adapter
    Like,
    <ns0:Select xmlns:ns0="http://Microsoft.LobServices.OracleDB/2007/03/View/VW_EMP_DEPT"><ns0:COLUMN_NAMES>*</ns0:COLUMN_NAMES><ns0:FILTER>PROCESS IN ('A','B','C')</ns0:FILTER></ns0:Select>
    and it works really fine, it just select the records with the Process A or B or C. I dont know how can I select now with respect to data that is 7 days ago from today.Help me with it.

  • XML String as input parm for WS?

    Hi All.
    This has probably been asked and answered a few times, but I can't seem to find a exact answer to my scenario:
    I have a java method that accepts a string as a input parm. However, the string will contain a fully formatted XML string eg:
    <?xml version=\"1.0\" standalone=\"yes\"?>
    <CAMPUS_UPD>
    <MSG_SEQ_NO>NATX_00000000000000200609141569398</MSG_SEQ_NO>
    <EVENT_NAME>CAMPUS_UPD.UPD</EVENT_NAME>
    <STATUSCODE>000</STATUSCODE>
    <CAMPUS_KODE>01</CAMPUS_KODE>
    <CAMPUS_NAME>STELLENBOSCH</CAMPUS_NAME>
    </CAMPUS_UPD>
    I'm basically going to put this XML string directly onto a InterConnect AQ Table for consumption by Interconnect.
    Now naturally I get a VERY strange set of errors when I actually try to call the WS with this XML String.
    <HTML><HEAD><TITLE>Web Service</TITLE></HEAD><BODY><H1>Bad Request</H1><PRE>Error parsing envelope: (4, 30) PI with the name 'xml' can occur only in the beginning of the document.</PRE></BODY></HTML>
    If I remove the first line of the XML string, the error message changes to:
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://sun.oic.ws/types/"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>caught exception while handling request: deserialization error: unexpected XML reader state. expected: END but found: START: KAMPUS_UPD</faultstring></env:Fault></env:Body></env:Envelope>
    Any Ideas/suggestions/wild speculations/URL's etc.
    Kind Regards
    Elmar Matthee
    University of Stellenbosch
    South Africa

    Hi Eric/all.
    Just thought I'd give a follow up on my progress.
    Got the web services working and finally able to test via Jdev. Seems the problem was with the proxy server settings of jdeveloper itself. I had localhost specified as an ip NOT to use a proxy server for, but when the test code got generated it used the actual ip of my machine (where the application server is also running) to access the web service, and thats where it got stuck.
    I actually sent along the embedded xml string in a string parameter directly to the the web service, and it worked like a charm (as opposed to testing it via the application server administration web page where I had to translate the < and > characters. So quite chuffed with that.
    Today I'm researching a) What happens when you have a complex data type (i.e. a java class containing 3 fields like username/fullname/age) from a web service. When I test it via the application server web page, I get the actual fields with their names and values in an xml type format back, but when I test it via java, i get a reference to the object. Now I could cast the result back into the class definition that I used when creating the web service, but what if I don't know what that is (i.e. someone else somewhere wrote the WS, and I have no idea about implementation)?
    b) related to a) is how to convert the complex data type return value into an XML string before sending the reply (or maybe even a pure String containing the XML data). I.e. instead of sending a Person class, I send back an XML data type containing the relevant data with tags and all. I'm a bit worried about this, because it looks as if the data is alreaddy actually coming back in an XML format, its just that the java test program doesn't see it that way, and I'm loath add the extra overhead if it isn't needed.
    c) related to both a) and b). How the @$#@ does one actually use/call a web service in a simple .jsp page? Seemingly a simple question, but thus far, the answer eludes me. :)
    Any thoughts/comments/ideas/wild speculations/urls welcome.
    Kind Regards.
    Elmar

  • Getting a complete portion of an XML String (With tag names)

    Im working on an application that processes a huge amount of xml strings. Im using xpath since it makes it much easier to select and navigate through the tags. The only thing I can't do is get a complete portion of an XML string, for example, if i have
    <article>
    <articlebody>
    </articlebody>
    <references>
    <reference id="1"> ... </reference>
    <reference id="1"> ... </reference>
    <reference id="1"> ... </reference>
    </references>
    </article>
    I need to get the complete <reference> portion to parse later, so i need the following string:
    <references>
    <reference id="1"> ... </reference>
    <reference id="1"> ... </reference>
    <reference id="1"> ... </reference>
    </references>
    How can i do this using xpath? is it even possible? if not how else can i do it? (don't want to use regular expressions and string manipulation)
    Thanks for you help

    Im not sure if this really qualifies as using DOM, but this is all i do to get the data i want from the files (when i only want to get the text value of an element:
    InputSource inputSource = new InputSource(new StringReader(metadata));
    return xpath.evluate(expression, inputSource, returnType);where metadata is a String containing meta data, and return type is usually string or number.
    Im using Java 5 and
    Could you please explain a little more how to do this?
    Thank you

  • Can't get unparsed (XML string) BPEL response in servlet

    (Reposted from "OC4J and Java EE" forum)
    I'm trying to invoke a two-way BPEL process from within a servlet like so:
            NormalizedMessage requestMessage = new NormalizedMessage();
            requestMessage.addPart("payload", requestXml);
            Locator lctr = new Locator(domainId, password);
            IDeliveryService dService = (IDeliveryService) lctr.lookupService(IDeliveryService.SERVICE_NAME);
            NormalizedMessage responseMessage = dService.request(bpelId, operationId, requestMessage);I would like to retrieve the unparsed XML String response. I thought that would be possible using the following:
            String responsePayload = responseMessage.getPayloadString();but that returns null. responseMessage.getPayload() returns a Map from which I can successfully obtain the payload XMLElement, so the BPEL process is definitely working.
    Any ideas why getPayloadString is not working as I expect it to? SOA suite is version 10.1.3.1. Thanks!

    hmm, if you poke around in decomiled version of DeliveryBean and NormalizedMessage, you can see that NormalizedMessage mPayloadString is not set by anybody, may be that is the cause.
    Probably you can write your own function:
    e.g. something like:
    NonSyncStringBuffer buf = new NonSyncStringBuffer();
    Iterator it = mPayload.keySet().iterator();
    buf.append("<part>");
    int i = 0;
    for(int size = mPayload.size(); size > 0;)
    String key = (String)it.next();
    if(i > 0)
    buf.append(", ");
    buf.append(key).append('=').append(mPayload.get(key));
    size--;
    i++;
    buf.append('</>');
    return buf.toString();

Maybe you are looking for

  • IMovie Text and Presets Not Working?

    iMovie 11 isn't working properly. The text(Titles) shows up fine on preview but once you're out of the editing thing it shows the text plus random black backgrounds on it. Also, with some of the presets (the animated clips in iMovie) won't work prope

  • S-Video out - final answer?

    I read through everything and wasn't able to find an answer ... Assuming I have a top quality/exact DVD quality movie stored on my Mac, will I be able to watch it on my TV using the S-video adapter? Will it be exactly as if I were watching the DVD fr

  • Will this tiger woods pga '12 work on lion ??

    heres the link!! Thanks!! http://www.amazon.com/Tiger-Woods-PGA-TOUR-12/dp/B005IRLHBG/ref=sr_1_12?ie=UTF8& qid=1316123742&sr=8-12

  • Need help for a school project

    I am new to Oracle/Sql and the last part of my project requires that I use a Stored Procedure to access info from an AUTHORS table. I have followed the guidelines in the assignment but for some reason the Stored procedure is not working. If someone c

  • Save book as xml

    Hi all, here is a strange(?) behaviour of FM8: If a book is saved as XML, the behaviour is In FM7.x: The book file is saved in several xml files - one for each component (which is correct).The .fm and backup.fm files remain untouched (which is correc