How to insert a node in an Element ?

I have the following XSD :
*<?xml version="1.0" encoding="windows-1252" ?>*
*<schema>*
*     <element name="Donnee">*
*          <complexType>*
*               <sequence>*
*                    <element name="Field1" type="string"/>*
*                    <element name="Field2" type="string"/>*
*                    <element name="ListField" minOccurs="0" maxOccurs="unbounded">*
*                         <complexType>*
*                              <sequence>*
*                                   <element name="SubField1" type="string"/>*
*                                   <element name="SubField2" type="string"/>*
*                              </sequence>*
*                         </complexType>*
*                    </element>*
*               </sequence>*
*          </complexType>*
*     </element>*
*</schema>*
I want to create a new Element following that schema.
Once created (empty), I can fill the "Field1" and "Field2" fields.
But I cannot insert a "FieldList" element !
I tried with Java :
setVariableData("my_variable", "Donnee/ListField[1]/SubField1", "my value"):
But this throw me an error, because this xpath doesn't exists.
I don't see how I can insert a new element...
Thank you for your help.

Hi,
Change you XSD Schema definition as given below:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xmlns.oracle.com/Donnee" targetNamespace="http://xmlns.oracle.com/Donnee" elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:element name="Donnee">
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="Field1" type="xs:string"/>
                    <xs:element name="Field2" type="xs:string"/>
                    <xs:element ref="ListField" minOccurs="0" maxOccurs="unbounded"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="ListField">
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="SubField1" type="xs:string"/>
                    <xs:element name="SubField2" type="xs:string"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
</xs:schema>
Now you can create variables of type ListField, create variables of ListField type and populate them.
Append these variables into parent element Donnee using the append operation. Append operation is available in Assign activity.
Regards,
Dharmendra
http://soa-howto.blogspot.com

Similar Messages

  • Could someone help me out how to insert a Node properly into a DOM?

    I am trying to insert a Node built from a String to a DOM.
    Here is how I created the Node
                   Detail = "<Detail><Msg>Detail Message</Msg></Detail>";
                   prolog = "<?xml version="1.0" encoding="UTF-8"?>";
                   Node DetailNode = null;
                   Document DetailDoc = null;
                   if( Detail != null ){
                        Detail = prolog + BiometricDetail;
                        DetailDoc = xp.XML2DOM( BiometricDetail ); // transform a XML String into a DOM.
                        DetailNode = BiometricDetailDoc.getDocumentElement();                    
    Here is how I created the DOM
                   javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
                   javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();
                   Document document = builder.newDocument();
                   Element beeE = document.createElement("BeeSets");
                   Element grpE = document.createElement("Group");          
                   bioE.appendChild( grpE );
                   // the document looks like "<BeeSets><Group></Group><BeeSets>";
                   // After inserting the Node DetailNode, I want it to look like
                   // "<BeeSets><Group><Detail><Msg>Detail Message</Msg></Detail></Group><BeeSets>";
    Now when I tried to insert the node DetailNode to the DOM document, I tried
    1) document.importNode( DetailNode, true );               
    No exception was thrown. But when I transformed the DOM document back to a String, I could not see the information from the newly imported Node DetailNode.
    When I tried
              grpE.insertBefore( BiometricDetailNode, dataE );
    I got the following exception.
         org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
         at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
         at org.apache.xerces.dom.ParentNode.insertBefore(Unknown Source)
         at com.jadcs.bioidentity.role.base.RP.getNodes(RP.java:497)
    2) document.adoptNode( DetailNode );
    I got the following exception.
         java.lang.ClassCastException: org.apache.xerces.dom.DocumentImpl
         at org.apache.xerces.dom.DeferredTextImpl.synchronizeData(Unknown Source)
         at org.apache.xerces.dom.NodeImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ParentNode.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ParentNode.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.CoreDocumentImpl.adoptNode(Unknown Source)
         at com.jadcs.bioidentity.role.base.RP.getNodes(RP.java:509)
    3) detailStr = "<Detail><Msg>Detail Message</Msg></Detail>";
    Element detailE = document.createElement("Detail");
    detailE.setTextContent( detailStr );
    grpE.appendChild( detailE );
    This way gives result like "<BeeSets><Group><Detail><Detail><Flash>On</Flash></Detail></Detail></Group><BeeSets>";
    The content is messed up.
    Could someone help me out at how to insert a Node properly into a DOM? Thank you very much.

    Said another way, importNode actually only makes and returns a copy of the node you gave it (it will be a deep copy only if you pased true as the second parameter), but where the new dom you called import on is owner.
    So what you need to do is more like this:
    Node tempNode = domYouAreAddingTheNodeTo.importNode(node2copy,true); //true if you want a deep copy
    domYouAreAddingTheNodeTo.appendNode(tempNode);You can also traverse to any point in the DOM and insert the node there with the same method, but you always have to import first so that the DOM has a copy of the node that it owns.

  • How to insert data in table UI elements

    Hi Guys,
    Here is my questions. How to insert data in table UI elements.
    Here i try to insert data by using Add button
    data:
        Node_Item                           type ref to If_Wd_Context_Node.
        Node_Item = wd_comp_controller->get_data_node( ).
      data:
        lr_table_line type ref to ITEM.
       lr_table_line = Node_Item->create_element( ).
      field-symbols:
        <ls_table> type any.
      assign lr_table_line->* to <ls_table>.
      Node_Item->bind_element(
        new_item             = <ls_table>
        set_initial_elements = abap_false
        index                = 1 ).
    But i got syntax error the result type of the function method cannot not be converted in to the type of lr_table_line.
    And i set cardinality and selection as 0.n.
    Pls, let me know for the soulutions
    Chandru
    Message was edited by:
            chandrasekar muthuvelraj

    Chadru, another option is for you to bind the table UI field to an internal table and to populate the internal table. Then, automatically, your Table UI field will be populated with the data from the internal table. Here is the code that does that and works for me.  Good luck!
    method FILL_DATA .
    DATA: node_level1 type ref to if_wd_context_node,
          node_level2 type ref to if_wd_context_node,
          node_items type ref to if_wd_context_node,
          stru_ResItems type BAPI2093_RES_ITEM,
          tab_ResItems TYPE TABLE OF BAPI2093_RES_ITEM,
          n type i.
    node_level1 = wd_context->get_child_node( name = 'BAPI_RESERVATION_CRE' ).
    node_level2 = node_level1->get_child_node( name = 'CHANGING' ).
    node_items = node_level2->get_child_node( name = 'RESERVATIONITEMS' ).
    n = 2.
      do n times.
        insert stru_ResItems into table tab_ResItems.
      enddo.
    node_items->bind_table( tab_ResItems ).
    endmethod.

  • How to insert multiple attributes to root elements

    Hi,
    I have to costruct a request to a service in which all the multipul ements shold be populated as attributes.
    The elements should be retrived from response from an intermediate service callout.
    Is there any function to do that..

    Try this. Be careful that your element does not go deeper than 1 desendant or else you will get concatenating data.
    for $mydoc in $root
    return element { node-name($mydoc) } (: element constructor notation :)
    { $mydoc/@*, (:add existing attributes :)
         for $el in $mydoc/* (: element constructor sub-nodes :)
    return attribute {local-name($el)}{data($el)}
    I used http://www.xqueryfunctions.com/xq/functx_add-attributes.html as a guide.

  • How to insert brackets into an XML element value?

    If I have a <file> </file> element in an XML file and I want to insert a filename of the form PED<yyMMdd>232, how do I insert the < and > brackets as an element value inside the <file> tag?
    I use JCreator to edit the xml file and it treats <yyMMdd> as a seperate element instead of being part of the filename.
    Edited by: Weng on Mar 27, 2008 10:06 AM

    You have to escape those characters, like this:
    PED&lt;yyMMdd&gt;232

  • How to insert a text edit UI element  in a table

    hi all,
    I want a text edit UI element in a table .I do not want input field because text entered can be very long and whole text cant be seen then.Is there any way to increase the width of input field if i insert an input field ? or what can be other solution for this?

    Hi Govind,
    You can't insert Text Edit as a cell variant in table. But you can increase the 'Width' property of Input Field, say to 500px or as per your requirement, so that you can display the full text at one go. Or you can bind the 'Width' property to a context and set the width at run time as per the text length.
    Thanks,
    Sumit

  • How to insert 2-D array of elements in excel sheet

    I have a 2-D array of elements. I want to insert this array into an excel sheet and display the data in a graph. I used the example "excel insert table" but the problem with that VI is, it is inserting the elements cell by cell which is taking long time. I am wondering whether there is way to insert a complete column or row into excel sheet at a time.
    Thank you,
    Mudda.

    Hi,
    Try this vi which inserts the table in one operation. You can modify it to suit your purposes.
    Hope this helps.
    Edit: Should note that it works for both string and numeric array inputs.Message Edited by DavidT on 06-29-2005 10:09 AM
    Attachments:
    Excel Insert Table (LV7.1).vi ‏100 KB

  • How to insert a new array of elements to a build array function such that the elements will be given one by one

    i 'am attacing one VI. In this VI i had a for loop into it I need to insert a section of commands only when the case loop selection is on state. How can I do it. Please help me to overcoem this problem
    Attachments:
    sequence post-case for selection.vi ‏15 KB

    Can you elobrate please. When boolean is FALSE then what you want to send otherwise when boolean is true then what you want to send ?
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

  • How to insert function nodes in routing service xsl mapping?

    I have been struggling with this for some days now.
    I have requestId, versionNumber coming in as a part of xml.
    I accept this xml(xsd) in one routing node, But on the way out, I want to assign a value requestId+versionNumber(basically concatenate)+randomNumber to transitionId(a new variable).
    How do I introduce this function node in xsl mapping that can concatenate different values that come through?
    Also, how do I generate random numbers?
    Thanks in advance,
    vena

    This is fairly straight forward.
    First of all create a random number. You can do this inyour translation. On the Component Palette select Advanced Functions. There you have an option generate-id or generate-guid. Either of these will be unique. Drag this to the middle.
    You can now drag this to the transactionid. Now you need to create a concatanation. In the Component palatte go to String and drage concat to the middle. Create a link between this concat and the generate-id function. Now you should be able to drag an link from requestid and versionNumber to the concat. If if they are in the wrong order just cut and past in the code by double clicking the concat icon.
    Hope this helps
    cheers
    James

  • Question regarding DOM, XML and how to insert child nodes...

    Hi,
    I'm a QA student working on some big project.
    Say you have an XML library holding some symbols by their categories, there are many categories, say we have two 'Miscellaneous' and 'Categories'.
    I want to add to both categories another child:
    the problem is that the way it is done now is:
    symbolCategoryItem.appendChild(newSymbolNode)As you probably know, appendChild(newChild) deletes from the tree the newChild if exists, before inserting it again...
    What should I do to avoid it?

    http://www.cafeconleche.org/books/xmljava/chapters/

  • How to edit the node value of a tree in webdynpro java

    Hi ALL
    I have Tree UI element where i got displayed all the nodes by calling the BAPI
    Now my requirement is when i put the cursor at any node in the Tree struture then on click of insert button i need to insert the new node with the text  , the user has to be option to give new text for the new node dynamically  , so while adding the new node in a tree the tree has to choose the text for new node , like how to edit the node of a tree to add new text.
    If any one can send the sample code on the same then it would be great help to me.
    Similar requirement like in table UI Like however we are adding the new row in a table when we click on the insert button then cursor will go to that new row in a table where user can enter his details in the table.. now i am looking for the same requirement in a Tree UI element.
    is it possible the same requirement in tree UI element in webdynpro for Java??
    Thanks
    kallki reddy

    Hi kallki reddy
    In general I think this is not possible in the form you'd like. It seems the Tree control is read-only thing always. It cannot provide editing capabilities.
    Table is different thing. You can select within many different cell editors including Input Fields.
    I guess that you scenario could be implemented not with Tree control, but with Table with Master Column. The master column allows to bring up a hierarchy into a plain table. So it's just a tree inside a table.
    Here you can find further details: [TreeByNestingTableColumn API|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/92/12a74046033913e10000000a155106/content.htm]
    BR, Siarhei

  • How to insert the image or logo into the table as a field in webdynpro abap

    Hi Friends,
    Please tell me how to insert the image or logo into the table as a field in webdynpro abap.........

    Hi Alagappan ,
          In your view layout you take table UI element and then you bind it with some context nodes.
    The attributes of your nodes comes as a field.
    Now in these fields you can set various properties and image is one of them.
    Go to ->
    1. View Layout -> Right Click on ROOTUIELEMENTCONTAINER -> INSERT ELEMENT -> TABLE
    2. Right click on table -> Create Binding.
       Here you have to bind it with the appropriate context node.
    You will get two properties here
    a- Standard Cell Editor :- ( make it image )
    b- Standard properties :- ( If required set image properties ).
    3. If you want put image from out side then import it as a mime object and set the source of your table field ( used as a image )
    also have a look :-
    [Image Properties|http://help.sap.com/saphelp_nw04/helpdata/en/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm]
    Hope this will solve your problem.
    Reply if any case of any issue.
    Thanks & Regards,
    Monishankar C

  • Inserting root node to enable 1...n

    I am doing IDOC - file scenario
    I have a DT already created at the receiver end
    what do I have to do inorder to recieve mutliple instances of IDOC in receiver ( 1.... n  )?
    I am planning to create a root node with 1...1 and make the fileds 0...unbound
    is this gonna work ?
    if yes, please let me know how do I insert a node in the root level
    thanks,
    venkat.

    Hi,
    You cannot directly insert an element at the root level. You have to recreate the whole datatype.
    Regards,
    Sudheer.

  • How to insert records dynamically in a table at run time

    hi, all
      please help me out,
      my problum is how can i insert records from on table to another table at  run time dynamically. Initally the records are coming  from R/3 backend.
    regards

    Hi,
    One way is to first create a Value node (NewNode) with structure binding of that of the model node. Then iterate through the model node, create NewNode elements and set the value from model node elements into it.
    IPrivate<view>.I<model node> mele;
    IPrivate<view>.I<NewNode> nele;
    for(int=0;i<wdContext.node<output>().node<record>().size();i++)
    mele = wdContext.node<output>().node<record>().get<record>ElementAt(i);
    nele = wdContext.node<NewNode>().create<NewNode>Element();
    wdContext.node<NewNode>().addElement(nele);
    nele.set<attr>(mele.get<attr>());
    Second way is to create that NewNode inside the model node and create a supply function.
    Regards,
    Piyush.

  • How to add a node to already existing hierarchy in BW?

    Hi Gurus,
    Can someone please tell me step by step how to add a node to the hierarchy.
    Thank you,
    Olga

    If I need to add an element to the node, I right click on the node and is it 'insert Characteristic'?
    Sorry I must add one more thing.If it is the first time you add an element to the node then right click the folder(node).But if you already have elements in the node then right click any element and choose add element(country,material whatever).If you choose add a characteristic, then you add another type of element(e.g you have materials in the node and add some countries by choosing add a characteristic)
    When I try to add a node, it gives me a list of nodes I can choose from
    In fact when you right click a folder, there must be an option like "Create nodes".Do you right click on a folder, don't you?You create nodes like that.
    Nevertheless, there is one more way to edit or create a hierarchy.You can load a hierarchy from a flat file.But I am not sure it is worth it.If you have lots of elements and nodes then I propose you to go that way.Step by step document:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/601b0771-92c4-2d10-a081-f947a516bd20?QuickLink=index&overridelayout=true

Maybe you are looking for

  • HP Laserjet 4015 can't print via usb

    i have an hp laserjet p4015 printer will not print / usb connected /port dot4 / Windows 7 OS / Error reads Error in the print que / No system changes.  Printer worked in one location and now does not print in new location.  Using 6ft cable.  Help!

  • How to add Mac27" to existing home network? and read files on other PC computers (Window7)

    How to add Mac27" to existing home network? and read files on other PC computers (Window7). type of connection: All computer (PC & Mac) connect to router (ethernet or wireless), then connect to internet. condition: internet works fine on all computer

  • InitializeComponent does not exist in current context

    I've solved every other error in my Windows Forms appl, except this one. Problem calls for a separate class for PresentationGUI. I also have classes for Housing, SingleFamily, MultiUnit and HousingAPP. I haven't created my 'form' yet; there is no des

  • Column name as a variable in a database trigger

    I am trying to code a pre-insert database trigger to format all varchar2 columns entered into the triggering table. I am using a cursor to get all the relevant column names from all_tab_columns, but do not know how to refer to these values in combina

  • Help on setting up VOIP on my E70

    Can anyone please advise how I set VOIP up on my new E70? Also can I access the same SKYPE account as I have on my laptop or do I have to use the another provider? thanks dt7