Add a root node and namespace declaration

According to the requirement,I have a large appended .txt file.
This .txt file is created by appending various xml files (without the namespace and root node).
I need to add a root node and namespace declaration to the large appended .txt file so that it can be read as .xml.
Please provide the pointers for the same.
Thanks & Regards,
Rashi

My appended file looks like following.
<input>
   <Store>
      <StoreHeader>
         <StoreNbr>56</StoreNbr>
         <StoreType>Retail</StoreType>
         <StoreSite>2004</StoreSite>
      </StoreHeader>
      <Transactions>
         <Transaction>
            <Item>A</Item>
            <ItemPrice>4</ItemPrice>
         </Transaction>
         <Transaction>
            <Item>C</Item>
            <ItemPrice>56</ItemPrice>
         </Transaction>
      </Transactions>
   </Store>
</input>
<input>
   <Store>
      <StoreHeader>
         <StoreNbr>123</StoreNbr>
         <StoreType>Retail</StoreType>
         <StoreSite>2004</StoreSite>
      </StoreHeader>
      <Transactions>
         <Transaction>
            <Item>A</Item>
            <ItemPrice>4</ItemPrice>
         </Transaction>
         <Transaction>
            <Item>B</Item>
            <ItemPrice>8</ItemPrice>
         </Transaction>
         <Transaction>
            <Item>C</Item>
            <ItemPrice>56</ItemPrice>
         </Transaction>
      </Transactions>
   </Store>
</input>
Now according to the requirement, I need to add namespace and root node and make it like follows:
<ns0:output xmlns:ns0="http://xxx">
   <input>
   <Store>
      <StoreHeader>
         <StoreNbr>56</StoreNbr>
         <StoreType>Retail</StoreType>
         <StoreSite>2004</StoreSite>
      </StoreHeader>
      <Transactions>
         <Transaction>
            <Item>A</Item>
            <ItemPrice>4</ItemPrice>
         </Transaction>
         <Transaction>
            <Item>C</Item>
            <ItemPrice>56</ItemPrice>
         </Transaction>
      </Transactions>
   </Store>
</input>
<input>
   <Store>
      <StoreHeader>
         <StoreNbr>123</StoreNbr>
         <StoreType>Retail</StoreType>
         <StoreSite>2004</StoreSite>
      </StoreHeader>
      <Transactions>
         <Transaction>
            <Item>A</Item>
            <ItemPrice>4</ItemPrice>
         </Transaction>
         <Transaction>
            <Item>B</Item>
            <ItemPrice>8</ItemPrice>
         </Transaction>
         <Transaction>
            <Item>C</Item>
            <ItemPrice>56</ItemPrice>
         </Transaction>
      </Transactions>
   </Store>
</input>
</ns0:output>

Similar Messages

  • How do i add a root node to a XMLType

    Hi all
    I have a problem inserting a root node in a xml document generated by DBMS_XMLGEN.newcontextfromhierarchy. The function get_site_map_nodes generates a document like this:
    <?xml version="1.0"?>
    <siteMapNode f_page_id="1" title="rot" PATH="1">
    <siteMapNode f_page_id="2" title="1.1" PATH="1.1">
    <siteMapNode f_page_id="4" title="1.1.1" PATH="1.1.1"/>
    </siteMapNode>
    <siteMapNode f_page_id="3" title="1.2" PATH="1.2"/>
    <siteMap/>
    </siteMapNode>
    This is correct but i want to add a root node so the result shows as below:
    <?xml version="1.0"?>
    <siteMap>
    <siteMapNode f_page_id="1" title="rot" PATH="1">
    <siteMapNode f_page_id="2" title="1.1" PATH="1.1">
    <siteMapNode f_page_id="4" title="1.1.1" PATH="1.1.1"/>
    </siteMapNode>
    <siteMapNode f_page_id="3" title="1.2" PATH="1.2"/>
    <siteMap/>
    </siteMapNode>
    </siteMap>
    The problem is that i have no clue how to accomplish this.
    Best regards
    Daniel Carlsson
    PACKAGE BODY PKG_PAGE_STRUCTURE
    IS
    FUNCTION get_level_path (in_page_id IN page_structure.f_page_id%TYPE)
    RETURN VARCHAR2
    IS
    l_path VARCHAR2 (4000) := '';
    BEGIN
    SELECT MAX (SYS_CONNECT_BY_PATH (f_show_order, '.'))
    INTO l_path
    FROM page_structure
    START WITH f_page_id = in_page_id
    CONNECT BY PRIOR f_parent_page = f_page_id;
    l_path := RTRIM (l_path, '.');
    RETURN l_path;
    END get_level_path;
    FUNCTION get_site_map_nodes (in_page_id IN page_structure.f_page_id%TYPE)
    RETURN XMLTYPE
    IS
    qryctx DBMS_XMLGEN.ctxhandle;
    l_xml XMLTYPE;
    BEGIN
    qryctx :=
    DBMS_XMLGEN.newcontextfromhierarchy
    ('select level, xmlelement("siteMapNode", XMLAttributes(f_page_id as "f_page_id",
    f_title_phrase as "title", pkg_page_structure.get_level_path(f_page_id) as path))
    FROM PAGE_STRUCTURE
    START WITH f_page_id = :in_page_id
    connect by f_parent_page = prior f_page_id
    ORDER siblings BY f_show_order'
    DBMS_XMLGEN.setbindvalue (qryctx, 'in_page_id', TO_CHAR (in_page_id));
    l_xml := DBMS_XMLGEN.getxmltype (qryctx);
    DBMS_XMLGEN.closecontext (qryctx);
    RETURN l_xml;
    END get_site_map_nodes;
    END PKG_PAGE_STRUCTURE;
    CREATE TABLE page_structure
    (f_page_id NUMBER(10,0) NOT NULL,
    f_parent_page NUMBER(10,0),
    f_show_order NUMBER(10,0),
    f_title_phrase VARCHAR2(20),
    f_created_by NUMBER(10,0),
    f_created_date DATE,
    f_updated_by NUMBER(10,0),
    f_updated_date DATE)
    INSERT INTO page_structure
    (F_PAGE_ID,F_PARENT_PAGE,F_SHOW_ORDER,F_TITLE_PHRASE,F_CREATED_BY,F_CREATED_DATE,F_UPDATED_BY,F_UPDATED_DATE)
    VALUES
    (1,NULL,1,'rot',1,'30-MAR-2006',NULL,NULL)
    INSERT INTO page_structure
    (F_PAGE_ID,F_PARENT_PAGE,F_SHOW_ORDER,F_TITLE_PHRASE,F_CREATED_BY,F_CREATED_DATE,F_UPDATED_BY,F_UPDATED_DATE)
    VALUES
    (2,1,1,'1.1',1,'30-MAR-2006',NULL,NULL)
    INSERT INTO page_structure
    (F_PAGE_ID,F_PARENT_PAGE,F_SHOW_ORDER,F_TITLE_PHRASE,F_CREATED_BY,F_CREATED_DATE,F_UPDATED_BY,F_UPDATED_DATE)
    VALUES
    (3,1,2,'1.2',1,'30-MAR-2006',NULL,NULL)
    INSERT INTO page_structure
    (F_PAGE_ID,F_PARENT_PAGE,F_SHOW_ORDER,F_TITLE_PHRASE,F_CREATED_BY,F_CREATED_DATE,F_UPDATED_BY,F_UPDATED_DATE)
    VALUES
    (4,2,1,'1.1.1',1,'30-MAR-2006',NULL,NULL)
    /

    Please try below steps.
    1. Complete Prerequisite for adding cluster node
    2. Verify the node is accessible to all other nodes in the cluster. Run the following command from the existing node in the cluster.
    cluvfy stage -pre crsinst -n newNode
    3. Run cluvfy from any existing node
    cluvfy stage -pre nodeadd -n <New Node>
    Note : If cluvfy in above step shows any errors fix those and then proceed with this step
    4. Change Directory to Clusterware Home and execute addNode scripts from any existing node.
    cd $CRS_HOME/oui/bin
    ./addNode.sh -silent "CLUSTER_NEW_NODES={ <NewNode > } CLUSTER_NEW_PRIVATE_NODE_NAMES={ <Interconnect >} CLUSTER_NEW_VIRTUAL_HOSTNAMES={ < Virtual Host Name >}"
    At the end of addNode, script will prompt to run for root.sh on newly added node.
    5. Verify Node is successfully added
    cluvfy stage -post nodeadd -n <NewNode >
    6. Verify CRS Stack is running on the new Node.
    $CRS_HOME/bin/crs_stat -t
    7. To extend the Oracle RAC Installation to include the new Node, run addNode from $ORACLE_HOME/oui/bin from existing node in the cluster
    cd $CRS_HOME/oui/bin
    ./addNode.sh
    When OUI displays the Specify Cluster Nodes to Add to Installation window, select the node to be added, then click Next .
    Verify the summary and run root.sh on new node when it prompts.
    8. Adding New Instance on the New Node
    $CRS_HOME/bin/lsnrctl status
    9.Run $ORACLE_HOME/bin/dbca from any of the existing RAC Instances Oracle Home.
    Select Oracle Real Application Clusters database , and then click Next .
    Select Instance Management , and then click Next .
    Select Add an Instance , then click Next .
    Click Next to accept default instance name or it can be changed.
    Check the summary window.
    Note: Please check these steps in test environment first.
    HTH

  • How to Create Instances in the Transient Root Node and Sub Nodes from Root Node Query Method ?

    Hi All,
    I am Creating a BOPF BO with 3 Nodes,
    Node 1) ROOT -- > contains a query,
    using Root Node I have created Search UIBB Configuration in FBI.
    In testing -- > when i enter Data in the Search Criteria Fields am able to get the details in to the query method
    from Imporing parameter : 'IT_SELECTION_PARAMETERS'.
    HERE I am fetching data from a standard table and trying to fill the data in the Node : 'MNR_SEARCH_RESULT'.
    How to Append data to the Sub node 'MNR_SEARCH_RESULT' when there is no Node instance created in the ROOT Node ?
    For This  I have created an instance in the ROOT Node and Using that I tried to create Instance in the Sub Node 'MNR_SEARCH_RESULT'.
    Below is my code which i have placed in the Query method ..
    DATA : LR_DATA TYPE REF TO ZBO_S_ROOT1.
    DATA : LR_SEARCH_RES TYPE REF TO ZBO_S_MNR_SEARCH_RESULT.
    DATA : LO_CI_SERVICE_MANAGER TYPE REF TO /BOBF/IF_TRA_SERVICE_MANAGER,
            LO_TRANSACTION_MANAGER TYPE REF TO /BOBF/IF_TRA_TRANSACTION_MGR.
       LO_CI_SERVICE_MANAGER = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( IV_BO_KEY = ZIF_BO_TEST_PO_C=>SC_BO_KEY ).
       LO_TRANSACTION_MANAGER = /BOBF/CL_TRA_TRANS_MGR_FACTORY=>GET_TRANSACTION_MANAGER( ).
    CREATE DATA LR_DATA.
    LR_DATA->KEY = LO_CI_SERVICE_MANAGER->GET_NEW_KEY( ).
    LR_DATA->ROOT_KEY   = IS_CTX-ROOT_NODE_KEY.
    LR_DATA->PIPO_MAT_ID = '100100'.
    LR_DATA->PIPO_MAT_DESC = 'MATERIAL'.
    LR_DATA->PIPO_SPRAS = 'E'.
    LR_DATA->PIPO_MATL_TYPE = 'ZPMI'.
    LR_DATA->PIPO_MATL_GROUP = 'ZKK'.
         DATA lt_mod      TYPE /bobf/t_frw_modification.
         DATA lo_change   TYPE REF TO /bobf/if_tra_change.
         DATA lo_message  TYPE REF TO /bobf/if_frw_message.
         FIELD-SYMBOLS: <ls_mod> LIKE LINE OF lt_mod.
        APPEND INITIAL LINE TO lt_mod ASSIGNING <ls_mod> .
        <ls_mod>-node        =   ZIF_BO_TEST_PO_C=>sc_node-ROOT.
        <ls_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
        <ls_mod>-key         = LR_DATA->KEY.
        <ls_mod>-data        = LR_DATA.
    DATA : LT_CHG_FIELDS TYPE /BOBF/T_FRW_NAME.
    DATA : LS_CHG_FIELDS LIKE LINE OF LT_CHG_FIELDS.
    DATA : LV_KEY TYPE /BOBF/CONF_KEY.
    CALL METHOD IO_MODIFY->CREATE
       EXPORTING
         IV_NODE            = ZIF_BO_TEST_PO_C=>sc_node-ROOT
         IV_KEY             = LR_DATA->KEY
         IS_DATA            = LR_DATA
         IV_ROOT_KEY        = IS_CTX-ROOT_NODE_KEY
       IMPORTING
         EV_KEY             = LV_KEY .
    CREATE DATA LR_SEARCH_RES.
    LR_SEARCH_RES->KEY           = LO_CI_SERVICE_MANAGER->GET_NEW_KEY( )..
    LR_SEARCH_RES->PARENT_KEY    = LV_KEY.
    LR_SEARCH_RES->ROOT_KEY    = LV_KEY.
    LR_SEARCH_RES->MATNR    = '123'.
    LR_SEARCH_RES->ERSDA    = SY-DATUM.
    LR_SEARCH_RES->ERNAM    = SY-UNAME.
    **LR_SEARCH_RES->LAEDA    = .
    **LR_SEARCH_RES->AENAM    = .
    **LR_SEARCH_RES->VPSTA    = .
    *LR_SEARCH_RES->LVORM    = .
    LR_SEARCH_RES->MTART    = 'ZPI'.
    LR_SEARCH_RES->MBRSH    = 'ZTP' .
    LR_SEARCH_RES->MATKL    = 'MAT'.
    **LR_SEARCH_RES->BISMT    = ''
    **LR_SEARCH_RES->MEINS    =
    CALL METHOD io_modify->create
               EXPORTING
                 iv_node            = ZIF_BO_TEST_PO_C=>sc_node-MNR_SEARCH_RESULT
                 is_data            = LR_SEARCH_RES
                 iv_assoc_key       = ZIF_BO_TEST_PO_C=>sc_association-root-MNR_SEARCH_RESULT
                 iv_source_node_key = ZIF_BO_TEST_PO_C=>sc_node-root
                 iv_source_key      = LV_KEY
                 iv_root_key        = LV_KEY.
    I am Unable to set data to the Node . I did not get any error message or Dump while executing . when i tried to retrive data I got the details from the node but am unable to view those details in the FBI UI and BOBT UI while testing .
    Please provide your valuable Suggestions.
    Thanks in Adv.
    Thanks ,
    Kranthi Kumar M.

    Hi Kranthi,
    For your requirement you need only two nodes. Root Node and Result node. Use the same structure for both.
    To create Instance while search.
    Create Query method with input type which has the required fields for selection criteria.
    Fetch the data and create instance in the root node.
    Pass the new instance key as exporting parameter form Query Method.
    To Move data from ROOT to Result.
    Create a action at root node.
    Write a code to create new entries in Result node.
    Then configure the Search UIBB and display result in List UIBB. Add button and assign the action MOVE_MAT_2_RESULT.
    Create another List uibb to display data from Result node.
    Connect the UIBBs using wire schema. SEARCH -> LIST(ROOT) ---> LIST(RESULT).
    Give src node association for ROOT to RESULT Configuration.
    Regards,
    Sunil

  • Lining up root node and child nodes in JTree

    I have a JTree that has a root node and n child nodes. There are no sub-levels - it is structured just like AOL instant messenger. What I want to do is have the child node icons line up directly under the root nodes text. For example (if you can read this), where "-" denotes the icon:
    - root
    - child
    - child
    Currently it is something like this:
    - root
    - child
    - child
    I have been messing with the setLeftChildIndent( int ) and setRightChildIndent( int ), but they are not doing much...they seem to not want to only move the leaf nodes but all of the nodes, so its not doing exactly what I want.
    Any ideas? In the meantime I'll be looking more into how exactly those indent mutators work.
    Thanks!

    What you want is to do a setRootVisible(false) on the JTree.
    All your child nodes are then your "root level" folders.
    tree.setRootVisible(true):
    +root
    +--child1
    +--child2
    +--child3
    +----child3a
    +----child3btree.setRootVisible(false):
    +child1
    +child2
    +child3
    +--child3a
    +--child3b

  • Binding properties of a root node and using fx:include.

    I posted a downloadable example of this here:
    https://dl.dropboxusercontent.com/u/8788282/binding-test.zip
    I've noticed some understandable, but less than perfect behaviour with the way FXML initialization is done when using fx:include.  I find it's difficult to bind properties that belong to the root node of the included view without shooting yourself in the proverbial foot.  Here is an example of what I mean:
    sample.Main
    package sample;
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    public class Main extends Application {
        @Override
        public void start(Stage primaryStage) throws Exception {
            Parent root = FXMLLoader.load(getClass().getResource("MainView.fxml"));
            primaryStage.setTitle("Hello World");
            primaryStage.setScene(new Scene(root, 300, 275));
            primaryStage.show();
        public static void main(String[] args) {
            launch(args);
    sample.MainController
    package sample;
    import javafx.fxml.FXML;
    public class MainController {
        @FXML
        void initialize() {
            System.out.println("MainController initialized.");
    sample.MainView (FXML)
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.control.Label?>
    <?import javafx.scene.layout.*?>
    <AnchorPane prefHeight="200.0" prefWidth="200.0"
                xmlns:fx="http://javafx.com/fxml/1"
                xmlns="http://javafx.com/javafx/2.2"
                fx:controller="sample.MainController">
        <children>
            <VBox prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0"
                  AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
                  AnchorPane.topAnchor="0.0">
                <children>
                    <Label text="Main"/>
                    <StackPane prefHeight="150.0" prefWidth="200.0"/>
                    <fx:include fx:id="sub" source="SubView.fxml" visible="false"/>
                </children>
            </VBox>
        </children>
    </AnchorPane>
    sample.SubController
    package sample;
    import javafx.beans.binding.Bindings;
    import javafx.fxml.FXML;
    import javafx.scene.control.Label;
    import javafx.scene.layout.AnchorPane;
    public class SubController {
        @FXML
        private AnchorPane anchorPane;
        @FXML
        private Label label;
        @FXML
        void initialize() {
            label.visibleProperty().bind(Bindings.createBooleanBinding(() -> true));
            /* When used as part of an fx:include, this controller's initialize()
             * block is called and the below binding is performed.  After that, any
             * property values set via the containing view (MainView) are applied.
             * In this example, the MainView attempts to set the visible property
             * of this included view (fx:id="sub").  Since the visible property of
             * the root node (anchorPane) has already been bound, the error
             * "A bound value cannot be set." is given.
            anchorPane.visibleProperty().bind(Bindings.createBooleanBinding(() -> true));
            System.out.println("SubController initialized.");
    sample.SubView (FXML)
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.control.Label?>
    <?import javafx.scene.layout.*?>
    <AnchorPane id="AnchorPane" fx:id="anchorPane" maxHeight="-Infinity"
                maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
                prefHeight="400.0" prefWidth="600.0"
                xmlns:fx="http://javafx.com/fxml/1"
                xmlns="http://javafx.com/javafx/2.2"
                fx:controller="sample.SubController">
        <children>
            <VBox prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0"
                  AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
                  AnchorPane.topAnchor="0.0">
                <children>
                    <Label fx:id="label" text="sub view"/>
                </children>
            </VBox>
        </children>
    </AnchorPane>
    The comments in the initialize method of SubController explain what's happening.  I found it a bit confusing until I figured out what was going on.  Should FXMLLoader be checking to see if a property is already bound before trying to set it, at least for nodes declared via fx:include?

    Hi Gaurave,
    We need to show the report like this to some users, thats what the requirement is. Using the Posted nodes option does not help.
    Thanks.

  • Oracle9i XMLType and namespace declaration

    Hi Folks,
    I am using the new XMLType for storing XML data and when I want to insert a XML document that contains a namespace declaration
    using sys.XMLType.createXML('<lom xmlns="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1"...>...</lom>') function, nothing is inserted into the field and no error message is shown. If I remove the namespace declaration like: sys.XMLType.createXML('<lom>...</lom>') then it works.
    I am wondering if there is a problem with the XML Parser or I should do something that I don't. I have read most of the online documents in this regard but couldn't find any answer.
    Your help is really appreciated.
    Bahram Jalili

    I ran into the same (almost) problem a few weeks ago and posted a question to this forum - no response... sigh. Seems like a pretty obvious bug.

  • Create root node and child nodes while downloading data from internal table

    Hi all,
    i have to down load the details of three materials present in the internal table into
    a  XML file, the material number must be the root node, ERNAM,AENAM,VPSTA
    fields must be its child nodes. in this way i have to display details of three
    materials like material1,material2,material3.
    how can i do that in 4.6c version.
    Thanks,
    satish.

    Hi Satish,
    Please look into the following programs. These are sample SAP programs to deal with XML in 46c.
    BCCIIXMLT1
    BCCIIXMLT2
    BCCIIXMLT3
    Hope these will helps,
    Sumant.

  • Add dynamic namespace declaration into xml root element

    Hello all,
    i've have two scenarios (mail to mail and file to file) with the same issue : no namespace in my XML file and i have to create one 'dynamically' from XML values.
    Example :
    <root>
    <name>test</name>
    <email>test</email>
    <schema>schemaID</schema>
    </root>
    Now I want to add infos into the root element for namespace declaration and so on, without expansion of the xsd. I've must use the value from the field schemaID.
    Example:
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns: namespace="http://test.de/schemaID">
    <name>test</name>
    <email>test</email>
    </root>
    I've already done it before through XSLT but it wasn't dynamic !! I don't know how to do it in XSL and i am not a java expert.
    Someone got an idea ?
    Thanks,
    Jean-Philippe.

    Hi,
      If you want to add name space at mapping level two options
    1)Using XSLT Mapping ,its very easy,google it to get sample XSLT code ,it will solve your problem.
    2)Using java mapping,in java mapping use regular expression code ,using regex(Regulkar expresion)we can add any content in message at any level.
    Regards,
    Raj

  • Avoid repeating namespace declaration in xml output

    Hi all,
    I'm trying an IDoc -> XML File (specifically UBL-format) scenario, and it is working fine. But the resulting XML contains repeating namespace declarations for each element, instead of a "common" declaration at the root element.
    How can I avoid this, so the message contains the namespace declarations in root node, and only uses the namespace prefix for each element?
    The target format, external definition, is an XSD with several import statements, and all external references have been set up, meaning all referenced XSD's are imported too, and have the "Source"-field set according to the import statement.
    Sample result file (top of file only):
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Invoice xmlns:ns0="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
    <ns2:UBLVersionID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">2.0</ns2:UBLVersionID>
    <ns2:CustomizationID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">urn:www.cenbii.eu:transaction:BiiCoreTrdm001:ver1.0:extentionId</ns2:CustomizationID>
    <ns2:ProfileID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">urn:www.cenbii.eu:profile:bii05:ver1.0</ns2:ProfileID>
    <ns2:ID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">9010045446</ns2:ID>
    <ns2:IssueDate xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">2011-04-19</ns2:IssueDate>
    <ns2:InvoiceTypeCode...
    PI version 7.11.
    Thanks for all help.
    Br,
    Kenneth

    Hi Mon,
    You can use below xslt 1.0 mappings.
    The first one will copy all namespaces (declared) to a newly created root element.
    The seconde one will delete the 'old' root element.
    => The result will look like an xml where the namespacesare moved to the root element.
    First xslt:
    <?xml version='1.0' encoding='utf-8'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="UTF-8"/>
    <xsl:template match="/">
    <Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ns1="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ns4="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
    <xsl:copy-of select="." />
    </Invoice>
    </xsl:template>
    </xsl:stylesheet>
    Second xslt:
    <?xml version='1.0' encoding='utf-8'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="UTF-8"/>
    <xsl:template match="@* | node()">
      <xsl:copy>
        <xsl:apply-templates select="@* | node()"/>
      </xsl:copy>
    </xsl:template>
    <xsl:template match="Invoice" >
      <xsl:apply-templates/>
    </xsl:template>
    </xsl:stylesheet>
    Kind regards,
    Lode

  • Adding Node and Deleting Node in Tree

    Hi,
    I am building a tree dynamically.
    I have a class which has set of properties.I am constructing as follows.
    public class TreeNode
            public function TreeNode()
         public var friendlyName:String;
         public var icon:Class;
         [Bindable]
         public var children : Array;
         public var logicalName:String;
         public var neType:String;
         [Bindable]
         public var arrayColl:ArrayCollection = new ArrayCollection();
         public function addChild(node:TopoTreeNode):void
             if (this.children == null){
                 this.children = new Array();
             children.push(node);
             arrayColl.source = children;    
         public function clearChild():void
             children = null;
         public function removeChild(arrayIndex:int):void
             if(children != null)
             children.splice(arrayIndex,1);
             arrayColl.source = children;
    Then I set the dataProvider as follows where treeModel is object that is injected.
    <mx:Tree id="tree"
                 dataProvider="{treeModel.rootNode.arrayColl}"
                 labelFunction="{treeModel.getDisplayName}"
                 iconFunction="{treeModel.setIcon}"
                 width="100%"
                 height="95%"
                 rowCount="6"
                 showScrollTips="true" showDataTips="true" dataTipFunction="{treeModel.getDisplayName}" allowMultipleSelection="true" click="treeModel.displayItemInWorkingView(tree.selectedItems);"/>
    TreeModel has the following variables
            [Bindable]
            public var rootNode:TopoTreeNode = new TopoTreeNode(); // this is the rootNode.
            [Bindable]
            public var rootChild:TopoTreeNode = new TopoTreeNode(); // this is the child of the root node..
    While constructing the tree, it is working fine.
    But after this when i try to add a node (ie adding a node as child to rootNode), it is getting added to my rootNode object but it is not getting displayed
    When i click on the items in the tree or click on the drop menu in the tree it is getting displayed.
    But i want it to be shown in the tree without clicking anything.
    Could anyone help on this?
    Regards
    Srini

    Off the top of my head, you need to call a refresh of some sort, or executeBindings()... something like that.
    You will also need to start at the root node and expand any parent branches down to the new leaf.
    If you are still having trouble after looking into that, I can try and dig through some of old code and find my solution.

  • How to change icon of a node or root node of a JTree

    i have a JTree with a root node, and leaf nodes. i want to change their icons. how can i do this?
    thanks

    Here's a search of the forums with the words 'tree', 'icon' and 'node' in the title
    http://onesearch.sun.com/search/developers/index.jsp?and=jtree+icon+node&nh=10&phr=&qt=&not=&field=title&since=&col=devforums&rf=0&Search.x=28&Search.y=15
    I looked at a couple and #5 seems interesting, but there are quite a few to choose from.

  • Validation to find the Root Node !!!!

    Hi All,
    Is it possible to write a Validation to find the Root Node of the Hierarchy,
    For E.g.  If we have a three level hierarchy
    Printer
            Dot Matrix
                          T123
    So is there a way I can check if my Root node value is Printer or not, because in Data Manager the value that is selected from the hierarchy drop down is the leaf node.
    Regards,
    Parul

    Hi Jitesh,
    The solution is as follows:
    MDM does not give us the option to traverse to the grandparent of the leaf node..
    In the example that we have taken :
    Printer
    - Dot Matrix
    - Laser
    --Laser1
    --Laser2
    Here if we want to check if the Grandparent of Laser1 is Printer, this cannot be done using the simple Validation, because through validation also we can at max find the parent of the current node i.e. we can traverse till Laser (for Laser 1 leaf node).
    Further we cannot use Laser as the node because in MDM we have to traverse completely through the last node and select it in Data Manager. So again we cannot search for Laser -> Parent.
    The Work Around that I have used is :
    I have created a new field and every time I import data I have mapped this field with the first Level Node and have put the Validation on this field.
    Eg: The field name is Root Node, so everytime the data is imported, Level 1 is mapped to Root Node and so all the Root node values are imported in the Root Node field that we have created and everytime the Validation Runs on this Root Node field and accordingly the process follows.
    Hope that would be helpful to you all!!!!
    Regards,
    Parul Malhotra

  • Change the Namespace and Root Node Name

    Hi,
    I have following xml :
    <ns2:Students xmlns:ns2="http://MyProject.CommonSchema">
        <ns2:Student>
          <HeaderSegment>
            <FName>AA</FName>
            <LName>AA</LName>
          </HeaderSegment>
        </ns2:Student>
      </ns2:Students>
    Now I want to change the root node name and namespace name.
    I want the following output:
    <ns2:MyStudents xmlns:ns2="http://MyProject.MySchema">
        <ns2:Student>
          <HeaderSegment>
            <FName>AA</FName>
            <LName>AA</LName>
          </HeaderSegment>
        </ns2:Student>
      </ns2:Students>
    I searched on the google but not found any right solution.
    Any kind of help would be appreciated.
    Prakash

    You should have told us that you wanted an XmlDocument. Anyway, you could use a XDocument to create and modify the XML and then return an XmlDocument like this:
    public static XmlDocument CreateXmlDocument(string xml) {
    //load the XML data
    XDocument doc = XDocument.Parse(xml); //or use XDocument.Load to load a file
    //change from old to the new namespace:
    XNamespace newNs = "http://MyProject.MySchema";
    var elemens = doc.Root.Elements();
    foreach (var elem in doc.Root.Elements()) {
    if (elem.Name.Namespace != string.Empty) {
    elem.Name = newNs + elem.Name.LocalName;
    //remove old namespace attribute:
    XAttribute atr = doc.Root.Attributes(XNamespace.Xmlns + "ns2").FirstOrDefault();
    if (atr != null)
    atr.Remove();
    //add the new namespace
    doc.Root.Add(new XAttribute(XNamespace.Xmlns + "ns2", newNs));
    doc.Root.Name = newNs + "Students2";
    string newXml = doc.ToString();
    XmlDocument xmlDocument = new XmlDocument();
    using (var xmlReader = doc.CreateReader()) {
    xmlDocument.Load(xmlReader);
    return xmlDocument;
    Usage:
    string xml = "<ns2:Students xmlns:ns2=\"http://MyProject.CommonSchema\"><ns2:Student><HeaderSegment><FName>AA</FName><LName>AA</LName></HeaderSegment></ns2:Student></ns2:Students>";
    XmLDocument doc = CreateXmlDocument(xml);
    Please remember to close your threads by marking all helpful posts as answer and then start a new thread if you have a new question.

  • How can i get also the files in the root directory and how can i for testing add items of IEnumerable FTPListDetail to List string ?

    What i get is only the directories and files that in other nodes. But i have also files on the root directory and i never
    get them. This is a screenshot of my program after i got the content of my ftp. I'm using treeView to display my ftp content:
    You can see two directories from the root but no files on the root it self. And in my ftp server host i have files in the root direcory.
    This is the method i'm using to get the directory listing:
    public IEnumerable<FTPListDetail> GetDirectoryListing(string rootUri)
    var CurrentRemoteDirectory = rootUri;
    var result = new StringBuilder();
    var request = GetWebRequest(WebRequestMethods.Ftp.ListDirectoryDetails, CurrentRemoteDirectory);
    using (var response = request.GetResponse())
    using (var reader = new StreamReader(response.GetResponseStream()))
    string line = reader.ReadLine();
    while (line != null)
    result.Append(line);
    result.Append("\n");
    line = reader.ReadLine();
    if (string.IsNullOrEmpty(result.ToString()))
    return new List<FTPListDetail>();
    result.Remove(result.ToString().LastIndexOf("\n"), 1);
    var results = result.ToString().Split('\n');
    string regex =
    @"^" + //# Start of line
    @"(?<dir>[\-ld])" + //# File size
    @"(?<permission>[\-rwx]{9})" + //# Whitespace \n
    @"\s+" + //# Whitespace \n
    @"(?<filecode>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<owner>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<group>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<size>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<month>\w{3})" + //# Month (3 letters) \n
    @"\s+" + //# Whitespace \n
    @"(?<day>\d{1,2})" + //# Day (1 or 2 digits) \n
    @"\s+" + //# Whitespace \n
    @"(?<timeyear>[\d:]{4,5})" + //# Time or year \n
    @"\s+" + //# Whitespace \n
    @"(?<filename>(.*))" + //# Filename \n
    @"$"; //# End of line
    var myresult = new List<FTPListDetail>();
    foreach (var parsed in results)
    var split = new Regex(regex)
    .Match(parsed);
    var dir = split.Groups["dir"].ToString();
    var permission = split.Groups["permission"].ToString();
    var filecode = split.Groups["filecode"].ToString();
    var owner = split.Groups["owner"].ToString();
    var group = split.Groups["group"].ToString();
    var filename = split.Groups["filename"].ToString();
    var size = split.Groups["size"].Length;
    myresult.Add(new FTPListDetail()
    Dir = dir,
    Filecode = filecode,
    Group = group,
    FullPath = CurrentRemoteDirectory + "/" + filename,
    Name = filename,
    Owner = owner,
    Permission = permission,
    return myresult;
    And then this method to loop over and listing :
    private int total_dirs;
    private int searched_until_now_dirs;
    private int max_percentage;
    private TreeNode directories_real_time;
    private string SummaryText;
    private TreeNode CreateDirectoryNode(string path, string name , int recursive_levl )
    var directoryNode = new TreeNode(name);
    var directoryListing = GetDirectoryListing(path);
    var directories = directoryListing.Where(d => d.IsDirectory);
    var files = directoryListing.Where(d => !d.IsDirectory);
    total_dirs += directories.Count<FTPListDetail>();
    searched_until_now_dirs++;
    int percentage = 0;
    foreach (var dir in directories)
    directoryNode.Nodes.Add(CreateDirectoryNode(dir.FullPath, dir.Name, recursive_levl+1));
    if (recursive_levl == 1)
    TreeNode temp_tn = (TreeNode)directoryNode.Clone();
    this.BeginInvoke(new MethodInvoker( delegate
    UpdateList(temp_tn);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    foreach (var file in files)
    TreeNode file_tree_node = new TreeNode(file.Name);
    file_tree_node.Tag = "file" ;
    directoryNode.Nodes.Add(file_tree_node);
    numberOfFiles.Add(file.FullPath);
    return directoryNode;
    Then updating the treeView:
    DateTime last_update;
    private void UpdateList(TreeNode tn_rt)
    TimeSpan ts = DateTime.Now - last_update;
    if (ts.TotalMilliseconds > 200)
    last_update = DateTime.Now;
    treeViewMS1.BeginUpdate();
    treeViewMS1.Nodes.Clear();
    treeViewMS1.Nodes.Add(tn_rt);
    ExpandToLevel(treeViewMS1.Nodes, 1);
    treeViewMS1.EndUpdate();
    And inside a backgroundworker do work how i'm using it:
    var root = Convert.ToString(e.Argument);
    var dirNode = CreateDirectoryNode(root, "root", 1);
    e.Result = dirNode;
    And last the FTPListDetail class:
    public class FTPListDetail
    public bool IsDirectory
    get
    return !string.IsNullOrWhiteSpace(Dir) && Dir.ToLower().Equals("d");
    internal string Dir { get; set; }
    public string Permission { get; set; }
    public string Filecode { get; set; }
    public string Owner { get; set; }
    public string Group { get; set; }
    public string Name { get; set; }
    public string FullPath { get; set; }
    Now the main problem is that when i list the files and directories and display them in the treeView it dosen't get/display
    the files in the root directory. Only in the sub nodes.
    I will see the files inside hello and stats but i need also to see the files in the root directory.
    1. How can i get and list/display the files of the root directory ?
    2. For the test i tried to add to a List<string> the items in var files to see if i get the root files at all.
       This is what i tried in the CreateDirectoryNode before it i added:
    private List<string> testfiles = new List<string>();
    Then after var files i did:
    testfiles.Add(files.ToList()
    But this is wrong. I just wanted to see in testfiles what items i'm getting in var files in the end of the process.
    Both var files and directoryListing are IEnumerable<FTPListDetail> type.
    The most important is to make the number 1 i mentioned and then to do number 2.

    Risa no.
    What i mean is this. This is a screenshot of my ftp server at my host(ipage.com).
    Now this is a screenshot of my program and you can see that in my program i have only the directories hello stats test but i don't have the files in the root: htaccess.config swp txt 1.txt 2.png....all this files i don't have it on my treeView.
    What i want it to be is that on my program on the treeView i will also display the files like in my ftp server.
    I see in my program only the directories and the files in the directories but i don't see the files on the root directory/node.
    I need it to be like in my ftp server i need to see in my program the htaccess 1.txt 2.png and so on.
    So what i wrote in my main question is that in the var files i see this files of the root directory i just don't know to add and display them in my treeView(my treeView is treeViewMS1).
    I know i checked in my program in the method CreateDirectoryNode i see in the first iteration of the recursive that var files contain this root files i just dont know how to add and display them in my treeView.
    On the next iterations when it does the recursive it's adding the directories hello stats test and the files in this directories but i need it to first add the root files.

  • How to add value to Root node in message mapping i.e. ns1:sObjects to ns1:sObjects xsi:type="Account"

    Hi Experts,
      please provide me any  UDF or Java or XSLT maaping code to add text into the root node of the payload i.e. my target Payload will be like
    <ns1:sObjects>
    <ns2:Id>123</ns2:Id>
    <ns2:name>Test message <n/s2:name>
    </ns1:sObjects>
    and i have to get it like
    <ns1:sObjects xsi:type="Account">
    <ns2:Id>123</ns2:Id>
    <ns2:name>Test message <n/s2:name>
    </ns1:sObjects>
    Regards,
    Yugandhar

    HI Yugandhar,
    In case of sales force, the can team will provide you a WSDL, In that WSDL you can manually edit the type:Account and can use the same while mapping.
    pls find the below screen shot, it will give you a better idea,
    pls let me know if you any further issues regarding.
    Pls Mark it as a correct answer if it is.
    Thanks,
    Prasad.

Maybe you are looking for

  • My cd/dvd drive does nor reconize the inseration of a disk

    my cd/dvd drive does nor reconize the inseration of a disk

  • Dataguard Error in v$archive_dest_status

    Hi to all, Both primary and standby servers are on lunux redhat : same version of OS - Primary DB : 10.2.0.1 - Standby DB : 10.2.0.3 - Host Name of Primary DB : arcdb01.es.egwn.lan - Host Name of Standby DB : x06.d15.lan I m trying to setup oracle da

  • Deferred expressions inside JSP tags

    Hello! I want to include custom JSP 2.0 tag into page. Something like <!-- Page.jsp --> <jsp:root version="2.0"     xmlns:f="http://java.sun.com/jsf/core"     xmlns:jsp="http://java.sun.com/JSP/Page"     xmlns:pk="urn:jsptagdir:/WEB-INF/tags">     <j

  • Suitable exits for QA32

    Hi , i stuck up with on problem that is,in T-code : QA32 (Inspection lot selection) after executing this transaction ,in the next screen we will get set of inspection lots. in the same screen in application tool bar we have ( Usage decision UD ) push

  • Itunes services could not be stopped?????

    Just got my i pod nano 2 gb I went to upgrade the itunes on the computer to the latest but the install stops here where it tries to "stooping itunes services"?? can anyone help?