How to get the resulting XML as string

Hello,
I think my question is very simple but i'm new in this area.
What i'm try to do is to parse a XML document with the DOM parser. Then i manipulate the DOM tree. After finishing the process i want to get the resulting XML document as an InputStream to give to another application for storing back into the database.
Until know i print the resulting XML to System.out or I write it to a file.
Do you know where i can find more information about this? Sample code??
Thanks!

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jinyu Wang ([email protected]):
You can try following code. It is not the simplest way, but it works for me:
// Print to temp buffer
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream output = new DataOutputStream(baos);
Xml_doc.print(output);
String outtemp=baos.toString();
System.out.println(outtemp);
include following line for the lib:
import java.io.*;<HR></BLOCKQUOTE>
Many thanks for the reply. It works!

Similar Messages

  • Af:query - How to get the result rowsets

    Hi,
    I have a requirement where i need to search the db rows on and append the results the adf rich table on each search.
    For this i am using af:query component. And trying to get the result rows for the named criteria.
    String mexpr = "#{bindings.DestinDescVOCriteriaQuery.processQuery}";
    processMethodExpression(mexpr, queryEvent, QueryEvent.class);
    ViewCriteriaManager vcm = getDestinDescViewObj().getViewCriteriaManager();
    ViewCriteria vc = vcm.getViewCriteria("DestinDescVOCriteria");
    getDestinDescViewObj().applyViewCriteria(vc);
    AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
    adfFacesContext.addPartialTarget(tblDestinDesc);
    However on each click of search the rows searched in the previous attempt are not retained.
    Can anyone let me know how to get the result from named criteria and append it the table?
    Thanks
    Ajay

    Can anyone help?

  • Call function in background task... How to get the result?

    I want to use Call function in background task parameter.
    But I cannot find the result of this function. (No export parameter, no table result, no exception)
    How to get the result of this function module? Correct or not?

    Hi Heinz,
    You can check the result in SM58 transaction.
    For more information pls. refer this thread :
    No IMPORTING parameters allowed in CALL FUNCTION IN BACKGROUND TASK
    Best regards,
    Prashant

  • How can i do with labview program,when i have 20 different values,and 1 want to add it with constant value.and how to get the results?

    how can i do with labview program,when i have   20 different values,and 1 want to add it with constant value.and how to get the results?

    Why do the 20 values have to be different? The same code should work even if some are equal.
    What do you mean by "get the result"? The result is available at the output terminal and all you need is a wire to get it where you need it. That could be an indicator, another operation, or even a hardware device.
    What is the data type of the 20 values? An array? A cluster? A bunch of scalars? A waveform? Dynamic data?
    LabVIEW Champion . Do more with less code and in less time .

  • How to get the results for given Bind Variable

    Hi
    Can any one help me how to get the result rows from the View Object after executing the view object query by setting bind variable?
    snippet as follows
    viewObject.setNamedWherClauseParams("name","hei");
    viewObject.executeQuery();
    How to get the results from viewObject is my question..?
    Thanks in advance

    Should be something like
    while (vo.hasNext()){
    Row r = vo.next();
    r.getAttribute....
    You might want to read the "most commonly used methods" appendix in the ADF Developer Guide.

  • How to get the results in one line

    Hi
    if i use the script below i get the name of path and then : and in next line i get the results.is there a way to get the results from every path after the : and not in the next line?
    another question - is there a way that the script will not show the server name on every path?
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter
    THC

    If you take you script and pipe it to get member, it will give you a list of various script properties.
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter | get-member
    You will see that the object type returned by "Get-Counter" is Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet.
    TypeName:
    Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet
    Name MemberType Definition
    Equals Method bool Equals(System.Object obj)
    GetHashCode Method int GetHashCode()
    GetType Method type GetType()
    ToString Method string ToString()
    CounterSamples Property Microsoft.PowerShell.Commands.GetCounter.Perfo...
    Timestamp Property datetime Timestamp {get;set;}
    Readings ScriptProperty System.Object Readings {get=$strPaths = ""...
    You can try grabbing different properties, and they will print out differently, displaying the data on the same line in some cases. For example, pipe your output to a "foreach-object" block, and then for each object print out the CounterSamples property.
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances | Get-Counter | foreach-object { ($_).CounterSamples }
    This should all print on one line now. However, you also asked if there was a way to not have the server print out on every line. The way to control the format of these outputs is to use the "format-table" cmdlet. So you would pipe your output to format-table
    and then give it various options. This is how you would pipe it (without any options).
    (Get-Counter -ListSet LogicalDisk).PathsWithInstances |
    Get-Counter | object { ($_).CounterSamples | format-table }#OR USE YOUR ORIGINAL CODE(Get-Counter -ListSet LogicalDisk).PathsWithInstances |
    Get-Counter | format-table }
    Now, it's up to you to give format-table the options you want. With no options, output will look unchanged. To see what options are available to you, use get-help.
    get-help format-table
    I hope this helps!
    Thank for all the info...

  • How to get the viewrow value by string

    Using Jdev11.1.1.5.0-adfbc-ireport3.0.0
    here i'll describe: what i did.
    am using jsff(dynamic region) while hitting the af:tree nodes it will opens. ok fine
    i had somevo with manually wroten query. and query is fine no problem with that
    here i give sample not a original query
    select * from sometable where acctid = :pacctidi drag and drop the pacctid from corresponding execute params vo as selectoncechoice
    static vo
    Data value - account payable , advance
    Data Name - ap,ad
    in that jsff
    *page representation*
    account type :   account payable (ap) - select one choice type
                            advance           (ad) - select one choice type
    like this some select once choice and some inputs.
    Run report - command button
    .jsff code
    <af:selectOneChoice value="#{bindings.ACCT_TYPE.inputValue}"
                              label="Account Type"
                              shortDesc="#{bindings.ACCT_TYPE.hints.tooltip}"
                              id="soc3" required="true"
                              autoSubmit="true"
                              binding="#{backingBeanScope.SUP1040V.soc3}"
                              valuePassThru="true"
                              valueChangeListener="#{backingBeanScope.SUP1040V.ValueChangeListener1}">
            <f:selectItems value="#{bindings.ACCT_TYPE.items}" id="si3"/>
          </af:selectOneChoice>
    <af:commandToolbarButton text="Export in pdf" id="ctb2">
              <af:fileDownloadActionListener method="#{backingBeanScope.SUP1040V.Report}"
                                             />
            </af:commandToolbarButton>.java
         //while hitting the button following logs are appeared i show it as commented format.
        public void Report(FacesContext context, OutputStream out) throws IOException,Exception
                FacesContext ctx = FacesContext.getCurrentInstance();
                HttpServletRequest request =
                    (HttpServletRequest)ctx.getExternalContext().getRequest();
                HttpServletResponse response = 
                    (HttpServletResponse)ctx.getExternalContext().getResponse();
                BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                System.out.println("print binding" +bindings1 );
    //while using sop i get this in my log : :  print binding  ReportsPageFragments_SUP1040VPageDef_WEB_INF_TaskFlows_SUP1040_V_TF_xml_SUP1040_V_TF
                JUCtrlListBinding listBinding1 = (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
                System.out.println("print list bindings" +listBinding1 );
    //while using sop i get this in my log : :  print list  bindings0
                Object selectedValue1 = listBinding1.getSelectedValue();
                System.out.println("print selected value" + selectedValue1);
    //while using sop i get this in my log : :  print selected  valueViewRow [oracle.jbo.Key[AP ]]   
    request.setAttribute("ACCT_TYPE", //here i want the value  "AP" in  String  );
    if i use like this means
    request.setAttribute("ACCT_TYPE", soc1.getValue()  );  i get the index value.
    i need the dataname "ap" so i go above method which say wrotes ...
                request.getRequestDispatcher(response.encodeURL("/sup1040servlet")).forward(request,response);
                System.out.println("hihihihih");
                response.flushBuffer();
                ctx.responseComplete();
        public void ValueChangeListener1(ValueChangeEvent valueChangeEvent) {
            // Add event code here...
            String AcctType = valueChangeEvent.getNewValue().toString();
            System.out.println("AcctType" + AcctType);
            FacesContext contxt = FacesContext.getCurrentInstance();
            valueChangeEvent.getComponent().processUpdates(contxt);
           BindingContainer bindings1 =
           BindingContext.getCurrent().getCurrentBindingsEntry();
           // Get the sepecific list binding
           JUCtrlListBinding listBinding1 =
           (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
           // Get the value which is currently selected
           Object selectedValue1 = listBinding1.getSelectedValue();
           System.out.println(selectedValue1);
        }if i get ap means my report runs. or else it will shows empty page.
    how to get the viewrowimpl class value as string.
    Edited by: ADF7 on Mar 24, 2012 7:27 AM

    ADF7,
    I'm not sure I understand what you are up to.
    As far as I understand you want to get the display value instead of the index
    I use this code
        public void StatusChangedListener(ValueChangeEvent valueChangeEvent)
            BindingContext lBindingContext = BindingContext.getCurrent();
            BindingContainer lBindingContainer = lBindingContext.getCurrentBindingsEntry();
            JUCtrlListBinding list = (JUCtrlListBinding) lBindingContainer.get("Status");
            int newindex = (Integer) valueChangeEvent.getNewValue();
            Object row = list.getDisplayData(); // Wichtig um die liste zu laden!!!!
            Row lFromList = (Row) list.getValueFromList(newindex);
            Object lAttribute = lFromList.getAttribute("Value");
            String newVal = (String) lAttribute;
        }to get the value from a selectOneChoice component...
    Timo

  • How to get the result of a method on a page

    I use JDeveloper 11g
    I want the result of a method (String) in the ApplicationModule on a page (jspx)
    What I have done is:
    1. make a method (getValue) in the ApplicationModule Algemeen (also in Client interface)
    2. make a pagedef-file with executables and bindings, see
    <executables>
    <invokeAction id="doGetValue" Binds="getValue"
    Refresh="renderModel"/>
    <variableIterator id="variables" Refresh="renderModel">
    <variable Type="java.lang.String" Name="getValueReturn"
    IsQueriable="false" IsUpdateable="0"
    DefaultValue="${bindings.getValue.result}"/>
    </variableIterator>
    </executables>
    <bindings>
    <methodAction id="getValue" RequiresUpdateModel="true"
    Action="invokeMethod" MethodName="getValue"
    IsViewObjectMethod="false" DataControl="AlgemeenDataControl"
    InstanceName="AlgemeenDataControl.dataProvider"
    ReturnName="AlgemeenDataControl.methodResults.getValue_AlgemeenDataControl_dataProvider_getValue_result"/>
    <attributeValues IterBinding="variables" id="ValueReturn">
    <AttrNames>
    <Item Value="getValueReturn"/>
    </AttrNames>
    </attributeValues>
    </bindings>
    3. on the page (jspx) I have an outputText-component:
    <h:outputText value="#{bindings.ValueReturn.inputValue}"/>
    But, it does not work, I don't get the result of the method on the screen.
    Who can help me with this?

    Hi,
    Simple example below:
    Suppose you have this method in AppmoduleImpl:
    public void testHello( ) {
    return "Hello";
    1.After you expose this to clientInterface,drop this method on the jspx page as ADF Parameter
    form
    2.Drop the return String as outputText
    3.Run the page,click on the commandButton & the outputText returns 'Hello'
    Regards,
    Shantala

  • How to get the system date format string?

    Hello, everybody!
    I want to create a MaskFormatter with a mask for dates. So, I could suply as the constructor parameter: "##/##/####'. However, what if the year comes first in the current system date format settings, or the month is in the second place or in the first?... So, I can't just suppose that the current locale format for dates is like the one above. So, my question is: is there a way to get the SYSTEM DATE FORMAT STRING in Java? Searching in google I saw that this was already asked in this forum:
    http://forum.java.sun.com/thread.jspa?threadID=301034&messageID=1193794
    but there was no effective answer. Does someone already know how to get this?
    Thank you.
    Marcos

    Hi, not sure, but
    import java.text.*;
    SimpleDateFormat sdf = new SimpleDateFormat();
    System.out.println(sdf.toPattern());
    will output something like dd/MM/yy HH:mm
    hthThank you very much. It worked.

  • How to get the postion of any string

    hi
    like untitle.txt
    how to get the postion of '.'.
    Amit

    Hi Amit,
    Use SEARCH statement to find out a character or a string in a string.
    DATA V_STRING TYPE STRING VALUE 'untitle.txt'.
    SEARCH '.' FOR V_STRING.
    If search is successful then it will return position of character or string into system field SY-FDPOS.
    If your idea is get values of filename and extension by separating period then use simply SPLIT statement.
    SPLIT V_STRING AT '.' INTO V_FILE V_EXT .
    Thanks,
    Vinay
    Edited by: Vinaykumar G on Jul 1, 2008 8:52 PM

  • DbGetQuery = How to get the results to display?

    I am using the following
    sqldata <- dbGetQuery(con," select sysdate from dual")
    How do I get the result to display?
    summary(sqldata) displays the values
    if I do dbSendQuery then fetch show the results
    help(dbSendQuery) and help(dbGetQuery) go to the same page! dbSendQuery
    The documentation says dbGetQuery will connect, get the records and clear; maybe the clear happens before the display?!

    Hello Amin,
    Here is the way to display the result from the query you provided:
    Assign the result of the query to object 'sqldata':
    R> sqldata <- dbGetQuery(con," select sysdate from dual")
    Type the object name at the R prompt:
    R> sqldata
                  SYSDATE
    1 2014-04-28 14:45:14
    Sherry

  • How to get the result set in batches

    I have a query which results into large data. This data i want to display in a group of 20. After every 20 records i want to add header and footer to it.
    Is it possible to get the result set data into batch of 20 ? means can i specify start and end index of query ?
    regards
    Manisha

    What I am saying is that a big query with lots of
    joins will probably be slow, and as such would be a
    ripe candidate for batching the responses, if it were
    not possible to speed/optimize it. Batching is nice
    to look at for the user, but is not a solution for
    performance problems. In essence it is irrelevant
    that it adds a little performance deficit, as it
    appears to be running a lot quicker, and gives more
    feedback to the user.Then let me say it again....
    - "Join" is a term that applies to a method of doing queries in the database....
    - Query 1 which uses a join and returns 15 rows
    - Query 2 which does not use a join and returns 1500 rows.
    Given the above then Query 1 will provide better overall performance for the system than Query 2 in a properly configured database.
    If it doesn't then the database is not set up correctly.
    And again this will be irrespective of whether the query is scrollable or not.

  • How to get the request xml string in Business service.

    Hi
    I have following requirement
    1) XAI inbound service will get a input xml request feed and call the Business Service.
    2) Business service will do some validation and do the insert in the database.
    My BS schema is as below
    <schema pageAction="change">
    <personId mapField="PER_ID"/>
    <personOrBusiness mapField="PER_OR_BUS_FLG"/>
    <name mapField="ENTITY_NAME" mdField="C1_ENTITY_NAME"/>
    <emailAddress mapField="EMAILID"/>
    <city mapField="CITY"/>
    <county mapField="COUNTY"/>
    <postal mapField="POSTAL"/>
    <houseType mapField="HOUSE_TYPE"/>
    <taxVendorGeographicalCode mapField="GEO_CODE"/>
    <isInCityLimit mapField="IN_CITY_LIMIT"/>
    <state mapField="STATE"/>
    <version mapField="VERSION"/>
    <division mapField="CIS_DIVISION"/>
    <accessGroup mapField="ACCESS_GRP_CD"/>
    <address1 mapField="ADDRESS1"/>
    <personCharacteristic type="list" mapList="CI_PER_CHAR">
    <personId mapField="PER_ID"/>
    <characteristicType mapField="CHAR_TYPE_CD"/>
    <characteristicValue mapField="CHAR_VAL"/>
    <effectiveDate mapField="EFFDT"/>
    <adhocCharacteristicValue mapField="ADHOC_CHAR_VAL"/>
    <characteristicValueForeignKey1 mapField="CHAR_VAL_FK1"/>
    <characteristicValueFK2 mapField="CHAR_VAL_FK2"/>
    <characteristicValueFK3 mapField="CHAR_VAL_FK3"/>
    <characteristicValueFk4 mapField="CHAR_VAL_FK4"/>
    <characteristicValueFK5 mapField="CHAR_VAL_FK5"/>
    </personCharacteristic>
    </schema>
    The request XML to BS is as below_
    (support.schema.AbstractSchemaBasedDispatcher) Performing page:change of BusinessService CM_SPRDSHT_BS' (service='CMSPRDHSHTUPLD'), with input request
    <?xml version="1.0" encoding="UTF-8"?>
    <CM_Person>
    <personOrBusiness>P</personOrBusiness>
    <name>Marsh,Corporate</name>
    <emailAddress>[email protected]</emailAddress>
    <city>Tampa</city>
    <country>USA</country>
    <postal>2131</postal>
    <houseType/>
    <taxVendorGeographicalCode/>
    <isInCityLimit/>
    <state>CA</state>
    <version>1</version>
    <division>930</division>
    <accessGroup>***</accessGroup>
    <address1>Address of Khan</address1>
    </CM_Person>
    I can access the values of each xml node in BS with the help of data item.
    I wanted to know how can I get the above request xml string in my Business Service in Java.

    {color:#0000ff}http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#parseInt(java.lang.String)
    http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#valueOf(java.lang.String){color}

  • How to parse the result xml string in BPEL

    Hi,
    This is Ishmayel.v new to BPEL and hava experience in xml parsing, java and webservices.
    Now I am getting the XML file as a result string in BEPL.
    now I want to parse the XML string and insert into the database... If any one has the idea let me know.
    my email id is [email protected]
    Thanks in Advance,
    Regards,
    Ishmayel.

    Your question is not clear.
    You have a client applicaton which invokes a BPEL process and receives XML response from BPEL. Then you want to parse this response XML in your client application?
    Or you are running a BPEL process which invokes a service and receives an XML response. Then you want to parse this XML response in BPEL before your process can proceed?
    I have to assume that you are working with a string and then you want to convert the string into XML, and then parse the XML. If this is the case, then take a look at the ora:parseEscapedXML(contentString) function. You can use this in the expression editor in JDev.

  • How to get the size of a string in bytes

    Morning,
    I’m trying to get the length in bytes of a string, the characters below are 3 byte UTF-8, but when I display
    The length of either int, looks like is double I got 120 and I think it should be 60. Any idea
    String requiredMsg = "όόόόόόόόόόόόόόόόόόόό";
    int byteCountUTF8 = requiredMsg.getBytes("UTF-8").length;
    int byteCountUTF8 = requiredMsg.getBytes().length;
    thanks

    OK, it is not 'o with acute', but rather 'Greek small omicron with tonos'.
    This page may help you sort it out:http://www.fileformat.info/info/unicode/char/3cc/index.htm.
    According to the page and to my tests, this Unicode 03CC has a 2 bytes (not 3) UTF-8 representation.
    String requiredMsg = "\u03CC";
    System.out.println(requiredMsg.getBytes("UTF-16").length);
    System.out.println(requiredMsg.getBytes("UTF-8").length);
    System.out.println(requiredMsg.getBytes().length); // In WindowsResult on my machine:
    4
    2
    1

Maybe you are looking for