How to create a node-typed XmlValue from a String with Java?

Hi all,
It's already been a while since I'm trying to get how to construct a node-typed XmlValue from a String value but I keep getting different exceptions no matter what method I try.
I started with the first way that came to my mind:
XmlValue value = new XmlValue("<element/>"); //Even though the String represents a valid xml node, calling value.isString() returns true.
then I thought ok, so I should maybe use the typed constructor:
XmlValue value = new XmlValue(XmlValue.NODE, "<element/>"); //_It does not work either, calling value.isNull() returns true.
I also tried with the rest of types (XmlValue.DOCUMENT, XmlValue.DOCUMENT_NODE, XmlValue.ELEMENT_NODE.....) and it did not work either with any of these.
Fiinally I saw that you can construct a new XmlValue from a XmlDocument but I cannot get a XmlDocument unless I phisically create one, which obviously wont be a very good idea.
So I'm definitely stuck with these, I would really appreciate if someone could tell me how to do this...
Thanks in advance,
Pablo Pareja
PS: I'm using Berkeley dbxml 2.5.13

Hi Pablo,
        XmlDocument doc = manager.createDocument();
        doc.setContent("<bla/>");
        XmlValue val = new XmlValue(doc);
        System.out.println(val.getType() == XmlValue.NODE);
        System.out.println(val.asString());Try this. It doesn't create physically (that is in the container) a document. The output of this piece of program:
true
<bla/>Hope it helps
Vyacheslav

Similar Messages

  • How to create a Return Sales order from a PO with Return Items using IDOCS?

    Is it possible to create a Return Sales order in one system with a PO having return Items in the other system using IDOCS.
    What kind of sales documents are created from IDOCS created with PO's having return items ?

    anyone?

  • How to create a node with attributes at runtime in webdynpro for ABAP?

    Hi Experts,
             How to create a node with attributes at runtime in webdynpro for ABAP? What classes or interfaces I should use? Please provide some sample code.
    I have checked IF_WD_CONTEXT_NODE_INFO and there is ADD_NEW_CHILD_NODE method. But this is not creating any node. I this this creates only a "node info" object.
    I even check IF_WD_CONTEXT_NODE but i could not find any method that creates a node with attribute.
    Please help!
    Thanks
    Gopal

    Hi
       I am getting the following error while creating a dynamic context node with 2 attributes. Please help me resolve this problem.
    Note
    The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
    The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
    Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
    Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
    Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
    My code is like the following:
    TYPES: BEGIN OF t_type,
                CARRID TYPE sflight-carrid,
                CONNID TYPE sflight-connid,
             END OF t_type.
      Data:  i_struc type table of t_type,
      dyn_node   type ref to if_wd_context_node,
      rootnode_info   type ref to if_wd_context_node_info,
      i_node_att type wdr_context_attr_info_map,
      wa_node_att type line of wdr_context_attr_info_map.
          wa_node_att-name = 'CARRID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
          insert wa_node_att into table i_node_att.
          wa_node_att-name = 'CONNID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
          insert wa_node_att into table i_node_att.
    clear i_struc. refresh i_struc.
      select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    rootnode_info = wd_context->get_node_info( ).
    rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
                                       attributes = i_node_att
                                       is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
    dyn_node->bind_table( i_struc ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    I am trying to create a new node. That is
    CONTEXT
    - DYNFLIGHT
    CARRID
    CONNID
    As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
    Also I cannot define the structure in the ABAP dictionary because it changes based on condition
    Message was edited by: gopalkrishna baliga

  • How to create ArrayColletion in mx:Script from mx:Model id="results" source="/data/data.xml" /

    How to create ArrayColletion in mx:Script from <mx:Model
    id="results" source="/data/data.xml" />
    Please see my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Model id="results" source="/data/data.xml" />
    <mx:Script>
    import mx.collections.ArrayCollection;
    import mx.utils.ArrayUtil;
    import mx.controls.Alert;
    </mx:Script>
    <mx:ArrayCollection id ="dt1"
    source="{ArrayUtil.toArray(results.result)}"/>
    <mx:Script><![CDATA[
    [Bindable]
    public var expenses:ArrayCollection = dt1;
    [Bindable]
    public var expenses2:ArrayCollection = dt1;
    [Bindable]
    public var dp:ArrayCollection=expenses;
    public function changeDataProvider():void{
    Alert.show(expenses.toString());
    if (dp==expenses){
    dp=expenses2;
    }else{
    dp=expenses;
    ]]></mx:Script>
    <mx:Panel x="10" y="10" width="100%" height="378"
    layout="absolute">
    <mx:ColumnChart dataProvider="{dt1}" x="10" y="10"
    id="myChart" height="318" width="100%">
    <mx:horizontalAxis>
    <mx:CategoryAxis categoryField="month"/>
    </mx:horizontalAxis>
    <mx:series>
    <mx:ColumnSeries displayName="apple" yField="apple"/>
    <mx:ColumnSeries displayName="orange"
    yField="orange"/>
    <mx:ColumnSeries displayName="banana"
    yField="banana"/>
    </mx:series>
    </mx:ColumnChart>
    <mx:Legend dataProvider="{myChart}" x="481" y="10"/>
    </mx:Panel>
    <mx:Button x="284" y="416" label="Change Data" id="bt"
    click="changeDataProvider()" />
    </mx:Application>

    Tracy,
    Thanks. That worked. However I have another related question:
    I convert the xml feed to a XMLListCollection by doing:
    <mx:XMLListCollection id="mission"
    source="{xmlFeed.lastResult.day}"/>
    and
    <mx:XMLListCollection id="mission1"
    source="{xmlFeed.lastResult.day.tBlock}"/>
    On the chart I have
    <mx:ColumnChart id="missionReadiness" height="150%"
    width="100%"
    paddingLeft="2" paddingRight="2"
    showDataTips="true" dataProvider="{mission1}">
    <mx:series>
    <mx:ColumnSeries xField="" yField="@today"
    displayName="Today"/>
    <mx:ColumnSeries xField="" yField="@tomorrow"
    displayName="Tomorrow"/>
    <mx:ColumnSeries xField="" yField="@afterT"
    displayName="After Tomorrow"/>
    </mx:series>
    </mx:ColumnChart>
    the yField works, but for the xField I want to have the @date
    but refers to the parent node, so I am clueless on how to refer to
    it.
    Also, I would like to display on the chart only the values to
    a specific date (like @date="05/17/2007").
    Any suggestions on how to do that?
    Gilbert

  • How to create a group of contact from a multi-selection of mails in a mailbox to answer to all senders?

    How to create a group of contact from a multi-selection of mails in a mailbox to answer to all senders?

    Use Mail Scripts. Its Add Addresses function will collect all the addresses from all selected messages and allow you to select the ones you want to add and allow you to create groups as you go.

  • How to create Event Node in smartform

    Hi Experts,
    could you please tell me how to create event node in smartform
    Thanks in Advance,
    Thanks&Regards
    Geetha

    HI,
    plz explain your problem in deeply.
    And as per me you first create page and righ click on it
    Then create window as per your requirement.
    if you want to put condition ot events true or false Righ click on your window
    then goto flow logic -> Altenative
    You can found 2 events in Condition.
    So you can assign this events.If you want to put condition or event on test then goto Text here in General Attributes in bottom side you can find even on page.
    Try it.

  • How to create automatic creation of BP from customer and vendor master data

    Hi gurus,
    can any one tell how to create automatic creation of BP from customer and vendor master data.
    Please give me the steps.
    Thanks
    Sasikanth.

    HI,
    Goto SPRO\ Cross application components \ Master data synchronization \ Synchronization control.
    Assign account groups of customer and vendors to respective BP grouping. This setting is enough to create BP in background while creating customer / vendor. But the fields groups are very much important, ensure mandatory fields should be sync.
    rgds,
    Srini

  • How to create new node in feature

    Dear Members,
    Culd any one help me out .........
    How to create new node in features..
    Example:  NUMKR
    On defaulting which option to select to create new node?
    Return value
    field for decision operation
    sub feature
    programme
    debugging operation
    error operation
    comment
    How to proceed................????????????

    hi,
    Where you can select the option field for decision operation then select the filed which you want like personal area, subarea, employee group and subgroup.
    and then select the node and then goto create and assign the return value by selecting the option ' Return value'.
    NUMKR -> FILED - PERSKGemployee group)  -> field PERSK(employee sub group) and --> return value.
    thanks,
    Vasu.

  • How do i delete my iCloud account from my iPad with an updated Apple ID?

    How do i delete my iCloud account from my iPad with an updated Apple ID?
    It requires i log into FindMyiPad to delete the iCloud account however the Apple ID has changed therefore the username/password no longer exists.
    This is just sending me in circles to log into to a non-existant apple id with no password to delete my iCloud so i can log in with my updated apple ID.

    Settings/iTunes and App Store log out then log in with new ID.  you might want to change ID in iMessage, FaceTime and Siri and delete the cloud account and create one with new ID.  remember apps are forever linked to the ID used to download them and can only be updated with that ID

  • How can I make a PDF file from each folders with layers, where each page is a each folder?

    How can I make a PDF file from each folders with layers, where each page is a each folder?

    I found an answer to my own question. A work around of sorts.
    Download Photoshop Elements 6 for Macintosh. With PSE6 I made a slide show with 550 images 1920x1200, without thumbs. I ran into one problem making the slide show. My images contained 4 images which had not ben created by Photoshop and could not be included in the slide show. Opening the images in Photoshop CS4 and re-saving them still did not make then acceptable. Not a big deal. I probably could have fixed the four images by stripping all EXIF data before opening them in Photoshop. BTW, PSE6 made the slide show in demo mode.
    I hope the bug in Photoshop CS4 will be fixed in Photoshop CS5.

  • How to create a user in UME Database using web dynpro java custom application

    Hi,
    Can you please suggest me how to create a user in UME Database using web dynpro java custom application.
    My Requirement is user can register his/her user id in SAP Portal 7.3 UME database.
    Please suggest me.
    Thanks and Regards,
    Amit

    Hi Amit,
    Generated Documentation (Untitled)
    This is what you're looking for, there's no real cook-book -- though Amey mentioned there might be some material on SDN, perhaps some tutorials.
    You should be looking into com.sap.security.api.IUserFactory, methods newUser(String) which gives you and IUserMaint and commitUser(IUserMaint, IUserAccount) -- IUserAccount can be obtained using com.sap.security.api.IUserAccountFactory, method newUserAccount(String)
    Hope it helps,
    D.

  • How to get the Values i need from a String???

    hi i need some help on my program,
    I have a Server that actually sent some data to my Client.
    The data consist of some messages and intergers . The whole piece of data is stores as a String message.
    ARRAY 'Monitor Chart' 2 5
    'Total OverFlow' 'Queued' 'Completed' 'Host Resets' 'Errors'''
    0.0 1.0 2.0 3.0 4.0
    'Series1' 11.0 0.6 8.6 11.5 6.6
    'Series2' 12.8 6.7 21.6 11.1 30.0Inside the Client i need to get the values out to showed on my textfields
    Example :
    Tf1 = 11.0
    Tf2 = 0.6
    Tf3 = 8.6
    Tf4 = 11.5
    Tf5 = 6.6
    Question: How to i get the values out from the String???

    using the split() method. i am able to split everything now
    so it appear somthing like this :
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class testing{
         String d1 =     "ARRAY 'Monitor Chart' 1 5";
         String d2 = "'Total OverFlow' 'Queued' 'Completed' 'Host Resets' 'Errors'";
         String d3 = "'' 0.0 1.0 2.0 3.0 4.0 ";
         String d4 = "'Series1' 11.0 0.6 8.6 11.5 6.6 ";
         String d5 = "'Series2' 12.8 6.7 21.6 11.1 30.0 ";
         String data = d1 + d2 + d3 + d4 + d5;     
         public testing(){
              System.out.println(data);
              String[] result = data.split("\\s");
              for(int x=0;x<result.length;x++)
              System.out.println(result[x]);
         public static void main (String args[])throws IOException{
            testing Application = new testing();
    }ARRAY
    'Monitor
    Chart'
    2
    5
    'Total OverFlow'
    'Queued'
    'Completed'
    'Host Resets'
    'Errors'''
    0.0
    1.0
    2.0
    3.0
    4.0
    'Series1'
    11.0
    0.6
    8.6
    11.5
    6.6
    'Series2'
    12.8
    6.7
    21.6
    11.1
    30.0
    but how do i get the values out ??how do i noe it is which index or wad?
    11.0
    0.6
    8.6
    11.5
    6.6

  • How can I share my music library from my iphone with my parents computer?

    How can I share my music library from my iphone with my parents computer?

    Ideally you would share the content from your computer to theirs through Home Sharing
    Understanding Home Sharing
    If all you have is your iphone then this article gives ways of how to get your music from the iPhone onto a computer
    https://discussions.apple.com/docs/DOC-3991

  • How do I print a configuration page from a Mac with Snowleopard?

    How do  I print a configuration page from a Mac with Snowleopard?  Printer is workinhg fine, but I just put in a new cartridge and I'd like to know how many pages I'm printing.
    Dave

    Hi there Dave, aka @dewanio , welcome back
    I saw that you are looking to print off a configuration page.
    The printer itself will print a test page however, the model depends on how it will print. Let me know which printer you have and I will get back to you!
    Thanks!
    R a i n b o w 7000I work on behalf of HP
    Click the “Kudos Thumbs Up" at the bottom of this post to say
    “Thanks” for helping!
    Click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution!

  • How do I insert and delete pages from a pdf with acrobat 10X?

    How do I insert and delete pages from a pdf with acrobat 10X?

    Alternatively, be sure your page thumbnails panel is open, and click on the icon highlighted in this image, just under the heading.
    You will see a dropdown with the options you need.

Maybe you are looking for