Copy node from XML tree problem

I am trying to copy an XML node 9whic hmay have child nodes) from one tree to another with the code
nodes = dataDoc.getElementsByTagName("text");
               currentElement = (Element) nodes.item(0);
               textNode.appendChild(nodes.item(0).cloneNode(true));
gives the error
org.apache.crimson.tree.DomEx: WRONG_DOCUMENT_ERR: That node doesn't belong in this document.
     at org.apache.crimson.tree.ParentNode.checkDocument(ParentNode.java:250)
     at org.apache.crimson.tree.ParentNode.appendChild(ParentNode.java:333)
What am I doing wrong?
Regards,
MArk

What am I doing wrong?Failing to use the Document.importNode() method.

Similar Messages

  • Deleting Nodes from XML Tree (JTree)

    I have created a XML Tree(extended from JTree) using XNodes ( extended from DefaultMutableTreeNode)
    After some insertions, i need to delete certain nodes from the XML Tree.. but after deletion, XNode will be null.
    subroutine is as follows...
    appreciates any advice
    Thanx
    private XNode RemoveExtraNode( XNode xNode ){
    int child;
    String nodeType;
    XNode childNode=null;
    if ( (child=xNode.getChildCount() ) > 0){
    for(int i=0;i<child;i++){
    childNode=(XNode)xNode.getChildAt(i);          
         nodeType = childNode.getType();
         if(nodeType.equals("DTD") )
         childNode.removeFromParent();
    }//end for (int i=1;i<child;i++)
    }//endif((child=xNode.getChildCount())!=0)
    return xNode;     
    }//RemoveExtraNode

    Hi IKEDA
    Thanx for the reply.
    I have tried xNode.remove(childNode) b4 and it still return a null JTree.
    Anyway fyi i discover i can delete last child of xNode and return the correct java tree. therefore to delete a node of my choice i simply insert its next sibling nodes in its place and delete that particular node when it becomes the last child.

  • Copying data from a tree to another

    Hi all!
    I am in a trouble when I try to copy somedata from one tree to another one.
    The interface allows the user to select one item from the first tree, and then when he clicks on a button, this item is copied to the second tree. The first tree stays in the same way. It is not permitted to the user to do any operation on the first tree.
    It is permitted to the user to remove items from the second tree. But I implemented this without any trouble.
    The problem occurs, after I selected the item that will be copied. Then, when I click on Add button, an unexpected error occurs.
    The vi is attached.
    Thank you in advance
    Attachments:
    Painel Frontal.vi ‏36 KB

    I am using version 8.2, and it doesn´t allow me to sabe in 7.1
    So, I send you the screen shot of blocks diagram.
    Thank you in advance.
    Attachments:
    screenshot.PNG ‏36 KB

  • How to delete a perticular node from xml file using java code

    Hii All,
    Now i am trying to delete a perticular node from xml file.Like...
    XML file:
    <Licence>
    <SERVER>
    <was id="1">1</was>
    <was id="2">2</was>
    </SERVER>
    </LICENCE>
    I am working in messaging service using JABBER framework with whiteboard facility.
    Here Some commands i have created to add,modify,delete nodes from xml file.They Are
    1.If u want to add a new node then.
    create Licence.SERVER <ss id="3">ddd</ss> lic.xml
    (here u want to add a new node called "ss" under Licence.SERVER.
    And lic.xml is tyhe xml file name where it was saved.
    2.If u want to delete a node(Suppose <was id="1">),then the command should be
    delete Licence.SERVER.was:id='"1" lic.xml
    A problem arises that here it find two was attributes.And it delete the last was attribute,not the requested node.
    PLEASE HELP ME IN SOLVING THIS CODE..
    ------------------------------------

    Looks like you clicked on "Post" before you pasted in the code you were talking about.

  • Can't remove a node from a tree

    I am using the custom tree dataDescriptor provided in Flex live
    doc. It works for creating the tree and add notes, however when I
    try to remove a node from the tree it cant work. Does anyone have
    any idea?
    This is the code for MyCustomeTreeDataDescriptor.as
    package
    import mx.collections.ArrayCollection;
    import mx.collections.CursorBookmark;
    import mx.collections.ICollectionView;
    import mx.collections.IViewCursor;
    import mx.events.CollectionEvent;
    import mx.events.CollectionEventKind;
    import mx.controls.treeClasses.*;
    public class MyCustomTreeDataDescriptor implements
    ITreeDataDescriptor
    // The getChildren method requires the node to be an Object
    // with a children field.
    // If the field contains an ArrayCollection, it returns the
    field
    // Otherwise, it wraps the field in an ArrayCollection.
    public function getChildren(node:Object,
    model:Object=null):ICollectionView
    try
    if (node is Object) {
    if(node.children is ArrayCollection){
    return node.children;
    }else{
    return new ArrayCollection(node.children);
    catch (e:Error) {
    trace("[Descriptor] exception checking for getChildren");
    return null;
    // The isBranch method simply returns true if the node is an
    // Object with a children field.
    // It does not support empty branches, but does support null
    children
    // fields.
    public function isBranch(node:Object,
    model:Object=null):Boolean {
    try {
    if (node is Object) {
    if (node.children != null) {
    return true;
    catch (e:Error) {
    trace("[Descriptor] exception checking for isBranch");
    return false;
    // The hasChildren method Returns true if the node actually
    has children.
    public function hasChildren(node:Object,
    model:Object=null):Boolean {
    if (node == null)
    return false;
    var children:ICollectionView = getChildren(node, model);
    try {
    if (children.length > 0)
    return true;
    catch (e:Error) {
    return false;
    // The getData method simply returns the node as an Object.
    public function getData(node:Object,
    model:Object=null):Object {
    try {
    return node;
    catch (e:Error) {
    return null;
    // The addChildAt method does the following:
    // If the parent parameter is null or undefined, inserts
    // the child parameter as the first child of the model
    parameter.
    // If the parent parameter is an Object and has a children
    field,
    // adds the child parameter to it at the index parameter
    location.
    // It does not add a child to a terminal node if it does not
    have
    // a children field.
    public function addChildAt(parent:Object, child:Object,
    index:int,
    model:Object=null):Boolean {
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.ADD;
    event.items = [child];
    event.location = index;
    if (!parent) {
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.insert(child);
    else if (parent is Object) {
    if (parent.children != null) {
    if(parent.children is ArrayCollection) {
    parent.children.addItemAt(child, index);
    if (model){
    model.dispatchEvent(event);
    model.itemUpdated(parent);
    return true;
    else {
    parent.children.splice(index, 0, child);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    // The removeChildAt method does the following:
    // If the parent parameter is null or undefined, removes
    // the child at the specified index in the model.
    // If the parent parameter is an Object and has a children
    field,
    // removes the child at the index parameter location in the
    parent.
    public function removeChildAt(parent:Object, child:Object,
    index:int, model:Object=null):Boolean
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.REMOVE;
    event.items = [child];
    event.location = index;
    //handle top level where there is no parent
    if (!parent)
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.remove();
    if (model)
    model.dispatchEvent(event);
    return true;
    else if (parent is Object)
    if (parent.children != undefined)
    parent.children.splice(index, 1);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    This is my tree definition:
    <mx:Tree width="143" top="0" bottom="0" left="0"
    height="100%"
    id="publicCaseTree"
    dataDescriptor="{new MyCustomTreeDataDescriptor()}"
    dataProvider="{ac}"
    defaultLeafIcon="@Embed('assets/caseIcon.png')"
    change="publicTreeChanged(event)"
    dragEnabled="true"
    dragMoveEnabled="false"/>
    This is how I remove the selected node from the tree. When
    Delete button is clicked, the doDeleteCase function is
    exectuted.
    public function publicTreeChanged(event:Event):void {
    selectedNode =
    publicCaseTree.dataDescriptor.getData(Tree(event.target).selectedItem,
    ac);
    public function doDeleteCase(event:Event):void{
    publicCaseTree.dataDescriptor.removeChildAt(publicCaseTree.firstVisibleItem,
    selectedNode, 0, ac);
    Any help would be appreciated.Thanks.

    Finally I removed nodes from tree, but not sure I did in the
    right way. Anybody encounter the same problem, please
    discuss.

  • 3750x Stack UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree

    A Cisco Stack 3750X switch report the following error message:
    %UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree.
    every minute +-20 sec
    Cisco IOS Software, C3750E Software (C3750E-IPBASEK9-M), Version 15.0(2)SE4, RELEASE SOFTWARE (fc1)
    analog bug: https://tools.cisco.com/bugsearch/bug/CSCsz93221

    WS-C3750G-24PS-E C3750-IPBASEK9-M version 12.2(53)SE2
    After implementing 802.1x with Avaya IP phones
    %UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree
    Port then fails authentication and goes into vl-err-dis

  • Using assign-activity:Append to append child nodes in XML-tree within loop

    I would like to produce an XML looking something like this (just an example):
    &lt;Customer&gt;
    &lt;Name&gt;Tom&lt;/Name&gt;
    &lt;Invoices&gt;
    &lt;Invoice&gt;
    &lt;InvoiceData&gt;.....&lt;/InvoiceData&gt;
    &lt;/Invoice&gt;
    &lt;Invoice&gt;
    &lt;InvoiceData&gt;.....&lt;/InvoiceData&gt;
    &lt;/Invoice&gt;
    &lt;/Invoices&gt;
    &lt;/Customer&gt;
    For different reasons (composite PK's in DB etc) I have to first get the Customer-data, and then get each Invoice for that customer.
    Then I have to loop the Invoices and append each Invoice-node to the XML, ending up with the whole thing when the loop is finished.
    This should be pretty simple (I guess), and I have tried different variations of the Append (assign activity), but everytime I end up with only the last Invoice-node.
    I can see in the Flow-window of the BPEL Console that it is not the same Invoice-node I'm appending within the loop-iterations, so that can not be the case in any way.
    In other words it seems to copy instead of appending.
    What is wrong ?
    Is this a bug in the Append function ?
    Any suggestions to other approaches that might work ? (I have to use the loop to get 1 and 1 Invoice-node though, and in that way put the whole XML together in some way)
    Edited by: user1694182 on 09.okt.2008 05:08

    Thank you for your answer.
    After taking your "debugging"-suggestions at hand and running some tests, I can now see that it gets appended in some way, but not correctly.
    1st LOOP ROUND:
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>308</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    Correct so far.
    2nd LOOP ROUND:
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>322</measurePointId>...</measurePoint>
    <measurePoint><measurePointId>322</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    So now it appends the new measurepoint, but overwrites the 1st as well... Strange..
    3rd LOOP ROUND (last round):
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>382</measurePointId>...</measurePoint>
    <measurePoint><measurePointId>382</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    So suddenly the same Append doesn't append, but overwrites the 2 I had with the new measurepoint...Strange...
    WHAT I DO IN MORE DETAIL:
    1: Assign(copy) the whole XML in the 1st loop round. (Copy - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
    2: Within each loop round I collect the whole XML with just 1 measurePoint (TransformActivity - FROM: DBAdapter-output - TO: submitInstallation_InputVariable).
    3: Within each loop round I then append the new measurePoint (collected in step 2) to the measurePoints-node. (Append - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
    PS! I can see in the BPEL Console that it is a new measurePoint that gets collected in step 2, and just 1 node.
    Help/tips on this is very appreciated ! :-)
    Edited by: user1694182 on 14.okt.2008 00:57

  • Autotype from XML schema problems

    Hello,
    I am trying to autotype the following Xml schema:
    http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3
    My build.xml contains:
    <target name="autotype" >
         <autotype
              schemaFile="REL-5-MM7-1-3.xsd"
              targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"
              packageName="com.foo"
              keepGenerated = "True"
              destDir="output" />
    </target>
    1.
    I run using ant but it fails..
    SubmitRspTypeCodec.java:15: cannot resolve symbol
    [autotype] symbol : class GenericResponseTypeCodec
    [autotype] location: package soap
    [autotype] extends javax.xml.soap.GenericResponseTypeCodec
    weblogic.webservice.tools.build.WSBuildException: Failed to do type mapping -
    with nested exception:
    [weblogic.xml.schema.binding.BindingException: ERROR: during code compilation
    - with nested exception:
    [java.io.IOException: Compiler failed executable.exec]]
    The interesting point is when i deleted following 3 lines from schema (line 413
    to 415 in REL-5-MM7-1-3.xsd),
    <xs:sequence>
         <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    no compile error is thrown.
    2.
    But the weird thing is that some of classes are not generated, for example SubmitReqType,
    ReplaceReqType. This is because they reference RelativeOrAbsoluteDateType (line
    367). And RelativeOrAbsoluteDateType contains the following union definition:
    <xs:union memberTypes="xs:dateTime xs:duration"/>
    i think that this union definition might cause problem but neither an error nor
    a warning message is submitted from ant. It says successful but missing classes.
    I am struggling with these 2 problems for days, any help would be appreciated.
    Thanks,
    aLi

    Hi Ali,
    I suspect that the reason you are having this problem is covered in the following
    link:
    http://e-docs.bea.com/wls/docs81/webserv/overview.html#1074641
    I guess my question is, what else do you have in the build.xml that uses (or attempts
    to use) the autotype Ant task? Are you trying to build a client (i.e. a JAX-RPC
    static stub) for a web service? Is this for a WebLogic Web Service you want to
    build? Or are you just trying to see if autotype can process the .xsd file, in
    question? If so, the above link states why it currently won't work.
    One alternative option, is to use a Workshop Schema project (or XMLBeans) to process
    the .xsd file. I just did that, and it worked fine :-)
    Regards,
    Mike Wooten
    "Ali Pakkan" <[email protected]> wrote:
    >
    Hello,
    I am trying to autotype the following Xml schema:
    http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3
    My build.xml contains:
    <target name="autotype" >
         <autotype
              schemaFile="REL-5-MM7-1-3.xsd"
              targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"
              packageName="com.foo"
              keepGenerated = "True"
              destDir="output" />
    </target>
    1.
    I run using ant but it fails..
    SubmitRspTypeCodec.java:15: cannot resolve symbol
    [autotype] symbol : class GenericResponseTypeCodec
    [autotype] location: package soap
    [autotype] extends javax.xml.soap.GenericResponseTypeCodec
    weblogic.webservice.tools.build.WSBuildException: Failed to do type mapping
    with nested exception:
    [weblogic.xml.schema.binding.BindingException: ERROR: during code compilation
    - with nested exception:
    [java.io.IOException: Compiler failed executable.exec]]
    The interesting point is when i deleted following 3 lines from schema
    (line 413
    to 415 in REL-5-MM7-1-3.xsd),
    <xs:sequence>
         <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    no compile error is thrown.
    2.
    But the weird thing is that some of classes are not generated, for example
    SubmitReqType,
    ReplaceReqType. This is because they reference RelativeOrAbsoluteDateType
    (line
    367). And RelativeOrAbsoluteDateType contains the following union definition:
    <xs:union memberTypes="xs:dateTime xs:duration"/>
    i think that this union definition might cause problem but neither an
    error nor
    a warning message is submitted from ant. It says successful but missing
    classes.
    I am struggling with these 2 problems for days, any help would be appreciated.
    Thanks,
    aLi

  • How to retrieve a child node's immediate parent node from a tree table?

    Hello
    Hi,
    I have a category_subcategories table, and I would like to know how to construct a sql and sub-sql for retrieving a child node's immediate parent node.
    Here is my first part of the sql, it only returns the node "Flash"'s parent and its grand-parents:
    SELECT parent.category_name, node.lft, node.rgt
    FROM category_subcategories AS node,
    category_subcategories AS parent
    WHERE node.lft > parent.lft AND node.lft < parent.rgt
    AND node.category_name = 'FLASH'
    ORDER BY parent.lft;
    | name |
    | ELECTRONICS |
    | PORTABLE ELECTRONICS |
    | MP3 PLAYERS | |
    how can I modify this query so that it returns Flash' parent - 'MP3 Players'?
    Thanks a lot
    Sam

    Hi,
    This is an Oracle forum. If you're not iusing Oracle, make that clear. Always say what version of your softwate you're using, whether it's Oracle or anything else.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. Explain how you get those results from that data.
    It looks like you're using the Nested Sets technique for modeling a tree. To get the parents of given nodes, do something like this:
    SELECT        parent.category_name
    ,       node.lft
    ,       node.rgt
    FROM        category_subcategories      node     -- Can't use AS with table alias in Oracle
    ,       category_subcategories      parent
    WHERE        parent.lft      IN (
                        SELECT     MAX (lft)
                        FROM     category_subcategories
                        WHERE     lft     < node.lft
                        AND     rgt     > node.rgt
    AND        node.category_name          = 'FLASH'
    ORDER BY  parent.lft; This should work in Oracle 8.1 and up. (I can't actually test it unless you post CREATE TABLE and INSERT statements for some sample data). You may need to modify the syntax a little for your database.
    785102 wrote:
    Hello,
    I tried to implement the solution as follow:
    mysql> select parent.*
    -> from category_subcategories as parent
    -> having parent.lft =
    -> (select max(parent.lft) from
    -> (SELECT parent.category_name, parent.lft, parent.rgt
    -> FROM category_subcategories AS node,
    -> category_subcategories AS parent
    -> WHERE node.lft > parent.lft AND node.lft < parent.rgt
    -> AND node.category_name = 'Sofa'
    -> ORDER BY parent.lft
    -> )
    -> );
    ERROR 1248 (42000): Every derived table must have its own alias
    mysql>
    But I got an error.
    What is wrong with it?What does the error message say?
    Apparantly, in your system (unlike Oracle), every sub-query must have a name. Try something like this:
    select      parent.*
    from      category_subcategories as parent
    having      parent.lft = (
                   select      max(parent.lft)
                   from     (
                             SELECT        parent.category_name
                             ,       parent.lft
                             ,       parent.rgt
                             FROM        category_subcategories      AS node,
                                    category_subcategories      AS parent
                             WHERE        node.lft      > parent.lft
                             AND        node.lft      < parent.rgt
                             AND        node.category_name = 'Sofa'
                             ORDER BY  parent.lft     -- Is this a waste of effort?
                        )  AS got_name_lft_and_rgt
                  )     AS got_lft
    ;What is the purpose of having the inner sub-query, the one I called got_name_lft_and_rgt?
    Also, in Oracle, an ORDER BY clause in a sub-query doesn;t guarantee that any super-queries will keep that order. Why do you have an ORDER BY clause in the sub-query, and not in the main query?

  • Retrieve / Search specific Node from XML File

    Hello,
    i have a question about reading (searching) XML File within PL SQL:
    There is a XML file with following structure:
    <root>
      <Hnode1 attr1="value1" />
      <Hnode2 attr1="value1" />
         <node1_of_Hnode2 id="10" personname="Steven"/>
         <node2_of_Hnode2 id="20" personname="Christian"/>
         <node3_of_Hnode2 id="30" personname="Arnold"/>
      <Hnode2/>
    <root/>How it is possible to filter a node by one of its attribute value. For example:
    I know the id of a person - lets say id =20. In this case i would like to get the whole node (in this case node2_of_Hnode2) to get the personname => "Christian".
    Just like a SELECT statement (WHERE ID = 20)
    Is there a possibility the get this by one command or should it be looped over all Rows of the Document?. Can you please provide an example for me.
    Thank you in advice!

    Database version is 10.Sorry, that's not a version.
    For example :
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    How to use the extraction of values?
    1.Better in Select statement; assigning directli in a variable or using xmlquery function?.PL/SQL or SQL calls to XMLType methods such as extract() or getStringVal() should be equivalent (putting aside the context switch).
    However, none of them is the correct way to retrieve a scalar value from a given node.
    You must use extractValue() function instead (SQL only) for release < 11.2 and XMLCast/XMLQuery starting with 11.2.
    One more Question:
    I have seen a lot of options to handle with XML Files.
    So in my case only querying data in XML Files is relevant.
    I have seen many APIs called XMLDOM, DMBS_XMLDOM, XMLTYPE...
    When to use these APIS. Can you give me some input on that please?That's a broad topic.
    A relevant answer will depend on your requirement.
    - Do you have to process large files, and if so how large?
    - Is performance/memory management a concern for you?
    - Do you want to extract single values, or process the XML content as relational data?
    If you have any specific test case to show us, please post in the {forum:id=34} forum, and make sure you include all the necessary details (see the FAQ).
    Edited by: odie_63 on 23 févr. 2012 11:35

  • Read Xml Child node from XML Blob

    Hi Gurus,
    Greetings
    I am working in oracle 10g /Solaris platform.
    I have table with columns namely id varcha2,pmt blob.
    PMT stores xml file.
    <Products xmlns:source="http://apache.org/cocoon/source/1.0" DocStatus="approved" DocTimeStamp="2013-04-18T06:52:14" DocType="PMT" DocVersion="xUCDM_product_external_1_3.xsd">
    <Product Country="DE" IsAccessory="false" IsLocalized="true" IsMaster="false" Locale="de_DE" lastModified="2013-04-18T00:08:11" masterLastModified="2013-02-25T14:46:40">
    <Assets>
      <Asset code="46PFL8008S_12" description="User manual" extension="pdf" extent="3359201" lastModified="2013-04-18" locale="de_DE" number="001" type="DFU">http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_dfu_deu.pdf</Asset>
      <Asset code="46PFL8008S_12" description="Leaflet" extension="pdf" extent="970750" lastModified="2013-04-18" locale="de_DE" number="001" type="PSS">http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_pss_deu.pdf</Asset>
      <Asset code="46PFL8008S_12" description="Quick start guide" extension="pdf" extent="911832" lastModified="2013-04-18" locale="de_DE" number="001" type="QSG">http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_qsg_deu.zip</Asset>
      <Asset code="46PFL8008S_12" description="Front product photograph - highres 2196x1795" extension="jpg" extent="1989253" lastModified="2013-04-18" locale="global" number="001" type="_FP">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-_FP-global-001</Asset>
      <Asset code="46PFL8008S_12" description="Alternative product photograph 1 - highres 2196x1795" extension="jpg" extent="603474" lastModified="2013-04-18" locale="global" number="001" type="A1P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A1P-global-001</Asset>
      <Asset code="46PFL8008S_12" description="Alternative product photograph 2 - highres 2196x1795" extension="jpg" extent="407701" lastModified="2013-04-18" locale="global" number="001" type="A2P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A2P-global-001</Asset>
      <Asset code="46PFL8008S_12" description="Alternative product photograph 3 - highres 2196x1795" extension="jpg" extent="174261" lastModified="2013-04-18" locale="global" number="001" type="A3P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A3P-global-001</Asset>
      <Asset code="46PFL8008S_12" description="Alternative product photograph 4 - highres 2196x1795" extension="jpg" extent="109712" lastModified="2013-04-18" locale="global" number="001" type="A4P">http://images.abc.com/is/image/abcConsumer/46PFL8008S_12-A4P-global-001</Asset>
       </Assets>
    </Product>
      </Products>');
      I want the extract the ids from the table where pmt contains the child node (asset) contains .zip
    for example http://download.p4c.abc.com/files/4/46pfl8008s_12/46pfl8008s_12_qsg_deu.zip
    Then, I tried like this...
      select r.* from
       (SELECT xmltype(pmt) object_value
                     FROM PRODUCT_TR_PMT
                     XMLTABLE
                                     'for $Product  in $TEST/Products/Product/Assets/Asset
                                         return <RESULT>
                                                   $Product                     
                                                </RESULT>'
                                     passing OBJECT_VALUE as "TEST"   
                                     columns Asset path 'Asset' 
                                 ) r;
    ORA-02263: need to specify the datatype for this column
      Could you kindly help.
    Thanks
    Raj

    Blob storage we (db folks) dont have any control its from application standard design.
    If necessary, i can create function blob to clob.
    Kindly help me in extracting child node which contains zip.
       select r.* from
       (SELECT xmltype(pmt) object_value
                     FROM PRODUCT_TR_PMT
                     XMLTABLE
                                     'for $Product  in $TEST/Products/Product/Assets/Asset
                                         return <RESULT>
                                                   $Product                     
                                                </RESULT>'
                                     passing OBJECT_VALUE as "TEST"   
                                     columns Asset varchar2(255) path 'Asset' 
                                 ) r;
    ORA-06553: PLS-306: wrong number or types of arguments in call to 'XMLTYPE'Thanks
    Raj

  • Remove node from XML with E4X

    How do i do it? I've tried "delete node;" or even node =
    null;

    Ok, i found a solution to it...
    The problem was first of all mostly that i was trying to do
    it dynamically, without really telling the name of the child that i
    would like to remove.
    So, if it was only this that needed to be done:
    delete xml.hello;
    and the xml looks like
    <xml>
    <hello>something</hello>
    </xml>
    it would work. But now i tried to remove a node without
    knowing the name of it.
    but it works when i did like this:
    var node : XML = XML( checkbox.data.node );
    var nodeParent : XML = node.parent();
    delete nodeParent[node.name()][node.childIndex()];
    And it works!
    I don't know if it's the best way, but it works and i'm
    happy...

  • Get child nodes and only child nodes from a tree?

    Hi all,
    Relatively simple table
    create table replaced_parts
    old_part_number varchar(7),
    replaced_part_number varchar(7),
    updated_date date
    insert into Replaced_parts values('AAAAA/1', 'BBBBB/1', '2012-Feb-16');
    insert into Replaced_parts values('BBBBB/1', 'FFFFF/1', '2012-Feb-23');
    insert into Replaced_parts values('YYYYY/3', 'ZZZZZ/3', '2012-Mar-17');
    insert into Replaced_parts values('FFFFF/1', 'LLLLL/1', '2012-Mar-18');
    insert into Replaced_parts values('LLLLL/1', 'HHHHH/1', '2012-Mar-19');The question is how do I issue a select using 'AAAAA/1' and get the result 'HHHHH/1'
    i.e. (A... -> B, B->F, F->L, L->H)
    and select using 'YYYYY/3' to get 'ZZZZZ/3' (Y... ->Z)?
    It would be really nice if I could also get my original value, say, 'CCCCC/1' if there is no entry
    for 'CCCCC/1' in the replaced_parts table (maybe NVL?).
    I have googled and tried various combinations of CONNECT BY, PRIOR, ISLEAF... &c. but
    am beating my head off a brick wall at the moment.
    TIA,
    Paul...

    >
    Hi, Paul,Hi again Frank - couldn't sleep and am back at the "£$%^&* computer...
    Yeah - it's a pity they weren't correct - I'll make doubly sure in future - see
    my edited post (with DROP TABLE commands inter alia - I also removed
    Order_Parts.User_Number since it was redundant - all that's needed is
    Order_Number (normalisation) so now your SQL doesn't work - sorry
    about that.
    Just saying something "doesn't work" isn;t very helpful. What exactly is wrong with the SQL
    statements I posted? Point out a couple of places where they are wrong, and explain how
    you get the right results in those places.Nothing is wrong with your SQL - I meant *sorry* about the confusion in the DDL/DML from my end.
    Now, I'm sorry again about the ambiguity of my English.
    I'll reconstruct the original data that I gave you and re-run your SQL against that data - again,
    this is *totally* my fault.
    My tables creation script seems to work fine now - I've edited my reponse to Solomon - the definitive scripts
    are now there - with Order_Parts.User_Number gone and the TO_DATE(...) as
    you suggested - the VARCHARs seemed to give the right result though - but I
    agree that if there's a correct way of doing it, then it should be done that way.
    Remember why you need to go to the trouble of posting CREATE TABLE and INSERT statements
    for some sample data here. It's to allow the people who want to help you to re-create the prolem
    and test their ideas. I know, and that's why I did it - the OR REPLACE that I added (stupidly and without thinking or testing) was
    so that people wouldn't have to go to the trouble of dropping the tables - I have now added
    DROP TABLE blah... to the beginning of the script so it won't be necessary.
    I have over 600 posts on this forum and only 26 questions - most of my time
    spent here is trying to help (to the best of my limited ability - I'm not a guru
    like yourself) and learning - it's amazing the number of times problems that
    I've seen here have subsequently arisen at work - and I am frequently
    frustrated by some posters' inability to explain their problem or at least give test
    cases.
    I can forgive bad English (except my own) - not everybody is a fluent speaker of the language,
    but SQL should run no matter what language one speaks.
    I appreciate that people are volunteering their time and effort here and I really do
    try and make it as easy as possible for them when I ask questions - I messed up
    this time, I'm afraid. It might also be the fact that I'm moving between SQL*Plus
    and SQL Developer and a text editor that I got confused (plus, fatigue didn't help...)
    In general, other people are not going to test anything on your system. I'm going to test
    things on my system, Solomon will test things on his system, and other people will test things
    on other systems. Well, if ever you're in Dublin ;). Again, I appreciate the effort that you, Solomon and sKr have
    gone to in helping me.
    Your INSERT earlier statements did not work on my system, because you were using a VARCHAR2
    in a place where a DATE was required. The correct thing to do is to use DATEs where DATEs are required. Indeed, and I agreed with you that if there's a right way of doing it, then it should be done that way.
    If your NLS settings are such that this is not causing you any errors right now, it's still a good
    idea for you to fix it; but, at any rate, whether it works on your system isn't what's important in
    this case; you're posting it to run on other peoples' systems.Ahhh.... <the blinding light of a moment of epiphany descends on Paul> I didn't realise it was
    an NLS setting - of course Americans will be different - it's just that I thought that YYYY-Mon-DD
    worked everywhere (I tried to avoid the day-first/month-first pitfall ) but now that you've explained
    it to me, I'll *never* make that mistake again.
    Yes - my mistake - I've now corrected the error
    Where are the desired results? Don't merely hide them in an old message; post them in a new message.OK. I'll put it in a reply to this post. I really am endeavouring to be as clear as possible - please
    excuse my errors - I will do better in future. I'm also very annoyed at my own incompetence and at
    having put you to more trouble than you would have had to go to if I had my wits about me.
    - should I keep Order_Parts.User_Number even
    if it isn't conformant to normalisation rules?
    If you have a good reason, it's okay to store de-normalized data. For example, some address tables in
    the US contain both state and ZIP code, even though state is fucntionally depenedent on ZIP code. I think that in this case, denormalisation is not called for.
    Re. the ZIP code thing, yeah, sure AIUI, the first two digits are dependent on the state, but the
    last three? They're more or less random - at least in the sense that there's no way to type
    in an address and calculate (mathematically, using a formula) them - so unless one were
    to have weird SQL lookups to a "State" table for the first two digits and then take the final
    three from a user-entered string field, then do a TO_CHAR on the returned 2-digit state number and add
    this to the 3-character one - I can't see how the ZIP code is an example of this? But, maybe
    (unless you wish to discuss that) we're getting side-tracked. Perhaps I'll ask this question
    on comp.databases.theory?
    Oracle actually added a new feature in version 11 (virtual columns) to make de-normalizing easier.Hmmm... is adding virtual columns denormalisation per se? My favourite "cheap'n'cheerful"
    db server (Firebird) has had a COMPUTED BY clause (same idea) for yonks (> 12yrs) - no data
    is actually stored - rather it is calculated on the fly. Another one for comp.databases.theory
    perhaps?
    BTW, wouldn't triggers remove all this hassle? It was my first idea, but trying to do it
    purely through SQL is now *obsessing* me ;)
    That would be another example of de-normalization. If the benefits of doing that outweigh the
    costs, then go ahead. A trigger will take some effort to maintain, and it will make all DML slower, regardless
    of how often that derived value is needed. Having the extra column will make some queries simpler and faster. Disk is cheap. Have an Original_Orders table (never changes) and a Revised_Orders table. When
    a part replacement occurs - for orders that haven't been fulfilled (boolean flag?), change the
    old part number to the new one. I can't imagine that replacement occurs very frequently, so
    the expense of a trigger would IMHO be minimal - plus the down side of any trigger would
    be mitigated by greatly simplifying the production of the Revised_Orders report?
    ... I'll experiment with what you've given me so far - but it's 23:40 here now, so I won't
    get a chance to do it tonight - unfortunately, I *do* have to sleep.
    If you haven't tested it yet, why did you start this message saying "your SQL doesn't work"?Sorry - what I meant was it obviously doesn't work when this eejit (i.e. me) has changed
    the table structure - I did run it quickly (your 1st statement) against the (revised table
    structure, the one you hadn't seen and I don't think even a man of your great SQL talents
    can be expected to write working queries against unknown table structures :)).
    Again, thanks for your help so far - I'll post the *_correct_* DDL and DML as a reply to this post
    with the desired result. I'll also reconstitute the old (i.e. the one you worked against) tables
    and data and let you know - again as a reply to this post - if I can at least learn something
    from my fiasco, it won't have been a total waste of my time, and again, apologies for
    wasting yours.
    Thanks again and rgs.
    Paul...
    Edited by: Paulie on 22-Mar-2012 02:50

  • How to Output Nodes from XML web service to a FLV?

    Hi
    I've used AS3 to query a web service and obtain the resulting XML.  I need to parse the result down to just a few nodes for a given location.  I can tackle that separately.  I am wondering how I output the parsed XML to a flash video file (.flx)?  The video has place holders for the XML node values.  What do I need to do to place the XML results in the video?
    Thanks,
    Sid

    Andrei1 wrote:
    What is a content of XML nodes? I am not sure what you mean by "inserting nodes". Do you mean that you want to display some information over the video?
    And yes, encoders do take XMLs to inject metadata into video. But this is metadata only.
    OSML = Open Source Media Framework:
    http://www.opensourcemediaframework.com/
    By inserting nodes, I mean that the XML web service returns data for each city, which needs to be parsed to just high temp, low temp and current condition.  Those 3 values needed to be dispalyed over, or woven into, the video at each city location.  My thought was that AS3 could somehow recognize the 3 placeholders for each city and insert the high temp, low temp and condition icon into each placeholder.  However, when I import the FLV file into Flash, there are no elements into which I can infuse this data.

  • Load Movie from XML attribute Problem

    Hi:
    This is strange. My code works when Testing Movie, but it
    doesnt work when its Published. Would be so grateful for help.
    Im loading a subnav button and a link for that button from an
    XML doc.
    Maybe this is wrong, but since the button attribute in the
    XML element is a link, I inserted a MovieLoaderClass test within
    the XML.OnLoad to be sure the button loads first . Once it's
    initiated loading, then I can proceed to assign a LoadMovie link to
    the button such as "loadMovie(Cliplinks[0], holderclip)"
    This is working in test movie. But when I Publish, the Button
    appears but it is unclickable. The button should be responding to
    the "loadMovie(Cliplinks[0],holderclip)"
    Can someone be so kind a to help me determine what Im doing
    wrong?
    Thanks much!
    Ryan

    var rootNode, i;
    rootNode = XML_Object.firstChild;
    rootNode = rootNode.firstChild;
    for(i = 0; i < rootNode.childNodes.length; i ++)
    var personObj
    bject = new Object();
    personObj.name = rootNode.childNodes
    .attributes.name;
    personObj.inwhat =
    rootNode.childNodes.attributes.inwhat;
    personAry.push(personObj);
    But, I think your XML file is incorrect.
    <name="joe smith" inwhat="honor" />
    should be... something like..
    <person name="joe smith" inwhat='honor" />

Maybe you are looking for