Tree from XML

I have a tree control that is rendered from an xml file with
the following format:
<element name="textnode1">value here</element>
<element name="groupnode1">
.....<element name="item">
..........<element name="itemnode1">value
here</element>
..........<element name="itemnode2">value
here</element>
..........<element name="itemnode3">value
here</element>
.....</element>
</element>
<element name="textnode1">value here</element>
Using a simple labeling function, I render the tree nodes for
each "element" labeling them with the "name" attribute. But, by
default behavior, the tree also renders each node value ("value
here") as a child of the "element" node.
How can I tell the tree control to ignore the node values and
only render tree nodes from the "element" nodes in the XML?

By using a custom ITreeDataDescriptor.
But if it was me, I might just process the xml into the
correct form.
Tracy

Similar Messages

  • Tree from XML (JMX monitoring and management application)

    I am trying to create a tree structure from XML. I am setting
    the below XML as the dataProvider for the tree.
    Now I only want to see the "element" labels in the tree
    structure. But I also see the operationList and the operations
    under it too. Is there any way I can filter these out from the tree
    structure ?
    The reason why I have the operations is that I have to
    display them on the right hand side, i.e whenever someone clicks on
    an element the operations corresponding to that have to be
    displayed on the right hand side.
    If you see the "flex-admin" application under the livecycle
    data services ... my applications is exactly similar to that.
    If anyone needs more information, I would be happy to
    provide.
    <?xml version="1.0" encoding="UTF-8"?>
    <centralmbeanserver>
    <element label = "FMC-DropCopies-QA" canonicalName =
    "CentralMBeanServer:App=FMC-DropCopies-QA" >
    <element label = "Cache Manager" canonicalName =
    "CentralMBeanServer:App=FMC-DropCopies-QA,Componet=Cache Manager"
    >
    <element label = "SACFixFilterRulesCache" canonicalName =
    "CentralMBeanServer:App=FMC-DropCopies-QA,Componet=Cache Manager,DB
    Cache=SACFixFilterRulesCache" >
    <operationList>
    <operation name = "reloadDBCache" returnType =
    "java.lang.String">
    </operation>
    </operationList>
    </element>
    <element label = "SACFIXExecBrokerMapCache" canonicalName
    = "CentralMBeanServer:App=FMC-DropCopies-QA,Componet=Cache
    Manager,DB Cache=SACFIXExecBrokerMapCache" >
    <operationList>
    <operation name = "reloadDBCache" returnType =
    "java.lang.String">
    </operation>
    </operationList>
    </element>
    </element>
    <element label = "Source Manager" canonicalName =
    "CentralMBeanServer:App=FMC-DropCopies-QA,Componet=Source Manager"
    >
    <operationList>
    <operation name = "enableAllMsgSources" returnType =
    "void">
    </operation>
    <operation name = "disableAllMsgSources" returnType =
    "void">
    </operation>
    <operation name = "listMsgSourceNames" returnType =
    "java.util.List">
    </operation>
    <operation name = "reloadSources" returnType = "void">
    </operation>
    </operationList>
    <element label = "CS-SACFIX6-SS" canonicalName =
    "CentralMBeanServer:App=FMC-DropCopies-QA,Componet=Source
    Manager,Msg Source=CS-SACFIX6-SS" >
    <operationList>
    <operation name = "enableMsgSource" returnType = "class
    java.lang.String">
    </operation>
    <operation name = "disableMsgSource" returnType = "class
    java.lang.String">
    </operation>
    </operationList>
    </element>
    <element label = "CS-SACFIX1-SS" canonicalName =
    "CentralMBeanServer:App=FMC-DropCopies-QA,Componet=Source
    Manager,Msg Source=CS-SACFIX1-SS" >
    <operationList>
    <operation name = "enableMsgSource" returnType = "class
    java.lang.String">
    </operation>
    <operation name = "disableMsgSource" returnType = "class
    java.lang.String">
    </operation>
    </operationList>
    </element>
    </element>
    </element>
    </centralmbeanserver>

    How is the WebSphere node connected to the cluster? Is it using TCMP? Extend?
    Local, Distributed, Replicated, Near, Overflow, External and Optimistic cache statistics appear in the Coherence JMX server. However, near and local caches created on extend nodes do not appear. Therefore the -Dtangosol.coherence.management.remote=true on an Extend client will not register the near or local caches.
    Thanks,
    Everett

  • Create a tree from XML

    hi. I have created a simple XML file which contains a hierarchical structure of strings.
    Also, I have created a SAXParser to read from the xml.
    But I don't know how to put this structure in a JTree.I don't want to show the tree on screen. I want to be able to access certain nodes at different times.
    Any help?

    I've created the SAXParser and as you can see I've read the XML file. I need to write some code in the characters method to add the relecvant strings to the tree. I'm quite new at this...
    public class Echo extends DefaultHandler
    public static void main(String args[])
    DefaultHandler handler=new Echo();
    SAXParserFactory factory=SAXParserFactory.newInstance();
    try
    SAXParser saxParser=factory.newSAXParser();
    saxParser.parse(new File("meniu.xml"),handler);
    }catch(Throwable t)
    t.printStackTrace();
    System.exit(0);
    public void startDocument()
    throws SAXException
    public void endDocument()
    throws SAXException
    public void startElement(String namespaceURI,
    String sName,
    String qName,
    Attributes attrs)
    throws SAXException
    String eName=sName;
    if("".equals(eName)) eName=qName;
    public void endElement(String namespaceURI,
    String sName,
    String qName)
    throws SAXException
    public void characters(char[] buf,int offset, int len)
    throws SAXException
    String s=new String(buf,offset,len);
    if(!s.trim().equals("")) {

  • Building netui:tree from XML

              Hi,
              I am trying to build a Tree in Workshop 8.1 using netui:tree tag (for data in
              an XML file).
              The BEA docs say that we have to assign the TreeNode object to the 'tree' attribute
              in the netui:tree tag.
              What is the best way to translate the XML doc into a TreeNode object(s)?
              Thanks,
              Ajay
              

              "Ajay Oruganti" <[email protected]> wrote:
              >
              >Hi,
              >
              >I am trying to build a Tree in Workshop 8.1 using netui:tree tag (for
              >data in
              >an XML file).
              >
              >The BEA docs say that we have to assign the TreeNode object to the 'tree'
              >attribute
              >in the netui:tree tag.
              >
              >What is the best way to translate the XML doc into a TreeNode object(s)?
              >
              >
              >Thanks,
              >Ajay
              Did you resolve your problem?
              I have the similar one.
              So. I can draw my tree for my data, but if i receive second xml document with
              new data and try repaint the tree, i have the same tree, whitout changes.
              Can you help me?
              Best regards
              Hubert.
              

  • Building tree from xml

    i have an xml file and trying to build a tree out of it.
    can anyone please help me what is the best way to do that?

    Or any DOM parser, including the one built into the standard Java API.

  • Creating a Java content tree from scratch and then marshal it to XML data

    Hi,
    After binding a schema using JAXB binding, I wrote a class to create a Java content tree from scratch and then marshal it to create an XML document. To see if the resulting xml document is correct, I opened it in XMLSpy and tried to validate it against the original schema.... I got the following error:
    "Unable to locate a reference to a supported schema kind (DTD, DCD, W3C Schema, XML-Data, Biz Talk) within this document instance"
    Then I realized that the generated xml document didnot contain the following for the root element:
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" and xsi:schemaLocation="....."
    i.e, the XML Schema Instance namespace and the schema location.
    How do I get these attributes incorporated into the XML document generated during the marshal process.
    Thanks.

    How do I get these attributes incorporated into the XML document generated during the marshal process.
    Add xmlns:xsi and xsi:schemaLocation attributes to the root element in the schema.
    <xsd:attribute name="xmlns:xsi"  fixed="http://www.w3.org/2001/XMLSchema-instance"/>

  • Hierarchical menu tree from dynamic xml

    Can anyone give me ideas on how to create a hierarchical tree using xml / xsl / javascript. Please note that the xml data is dynamic and changes for each user/company. I have downloaded the xalan processor. Any ideas on the line of approach is highly appreciated.
    Thanks in advance

    I've used Joust Outliner, www.ivanpeters.com. This a free javascript package that builds treeviews for html. A XSL-stylesheet was used to produce the javascript code from a dynamic xml source. (Although the structure of the xml was more or less the same, the content was changed from time to time)

  • How to load data from XML DOM into tables using Business Components

    <p>
    Hi,
    </p>
    <p>
    I need to upload XML file (it&#39;s not a problem) an load data (DOM tree) from this file into relationan tables. This filelooks like this:
    </p>
    <p>
    <font face="courier new,courier" size="2">&lt;Departments&gt;
       &lt;Department&gt;
          &lt;DepartmentName&gt;OPERATIONS&lt;/DepartmentName&gt;
          &lt;Localization&gt;BOSTON&lt;/Localization&gt;
          &lt;Employees&gt;
             &lt;Employee&gt;
                &lt;LastName&gt;TURNER&lt;/LastName&gt;
                &lt;Job&gt;SALESMAN&lt;/Job&gt;
                &lt;Manager&gt;7698&lt;/Manager&gt;
                &lt;HireDate&gt;1981-09-08&lt;/HireDate&gt;
                &lt;Salary&gt;1500&lt;/Salary&gt;
                &lt;Commerce&gt;0&lt;/Commerce&gt;
             &lt;/Employee&gt;
          &lt;/Employees&gt;
       &lt;/Department&gt;
    &lt;/Departments&gt;</font>
    </p>
    <p>
    Is there any Business Components support to obtain this ? What about primary and foreign keys values (there is no in XML file). How to place this XML data in appropriate tables ?
    </p>
    <p>
    Kuba 
    </p>

    Pl post details of exact OS and database versions, along with a sample of the XML file and description of the tables. What have you tried so far ?
    http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_control_file.htm#i1005614
    HTH
    Srini

  • How to remove an Element from XML by confirming Attribute of that element

    Hi guys
    I have an XML file where i have all users DB. Now i want to remove a user from that XML file. I want to check an user id attribute which is uniqe with existing users in XML file, if its the same user then delete this user from XML file and save the changes in XML file.
    here is my XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <users>
    <user id="zahid" password="X8UrUN79avT27LYwUESiliAV328=" name="Zahid Nawaz" phone="9599808" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
    <user id="Admin" name="alpha beta" password="fEqNCco3Yq9h5ZUglD3CZJT4lBs=" phone="456782656" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
    <user id="Guest" name="beta alpha" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="8765432" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" /><user id="Guest1" name="unknown unknown" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="123122112" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" />
    </users>for example i want to delete a user which have user id= Guest.
    How can i do it in Java. Any code example please. i am using JDOM document and SAXBuilder for parsing.
    Waiting for your replay.
    Thanks in Advance
    Best regard

    Hi,
    Till now i tried the following code which give null pointer exception at following line
    element.getParentNode().removeChild(element);
         public String removeUserByID(String id) throws Exception{
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                 DocumentBuilder builder = factory.newDocumentBuilder();
                 TransformerFactory tFactory = TransformerFactory.newInstance();
                 Transformer tFormer = tFactory.newTransformer();
                   doc = builder.parse(usersXml);
                 Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);
    //             Remove the node
                 element.getParentNode().removeChild(element);
    //             Normalize the DOM tree to combine all adjacent nodes
                 doc.normalize();
                 FileOutputStream fos = new FileOutputStream(this.usersXml);
                   XMLOutputter out = new XMLOutputter();
                   out.output(((org.jdom.Document)doc), fos);
              /*     Source source = new DOMSource(doc);
                 Result dest = new StreamResult(System.out);
                 tFormer.transform(source, dest);
                 System.out.println();
                 return "true";
              if following line i m trying to use first attribute of my XML file where i am passing a string which is for example like "user id=Guest". id is a string which have user Id "Guest".
    Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);So any suggestion??Whats wrong here?
    Best regards and thanks again 4 ur reply.

  • Hierarchy tree with XML attributes in jsp

    hi,
    i need to build a hierarchy tree. data(parent and child) should be read from xml file. data is attributes of nodes in xml. i need to write the JSP code for above functionality. please help me. thanks in advance.

    Check this link for further details.
    http://www.dpawson.co.uk/xsl/sect4/N10301.html
    http://www.devx.com/getHelpOn/Article/11874
    The solution is based on XSLT approach. That can be still converted in other server side technologies.
    Regards,
    Vikrant.

  • JAXB: Creating Java content tree from scratch - examples?

    I'm trying to create XML output by building the content tree from scratch (using a the DDI schema which is fairly complex). I don't have any existing XML instances. Sample application 3 in Sun's JAXB tutorial doesn't give enough info about how to relate the nodes to create the heirarchy. I can create the root node and set it's attributes OK, but then the practical info runs out.
    Can anyone point me at some good practical examples? (i.e. not those of the "How to play the quitar: Put your fingers on the frets and move your other hand around" genre).
    Thanks in advance.

    I don't have examples, but the main thing to remember is that you should use the ObjectFactory to create all of the objects in your tree. That's important.
    You must use the element object class for the root node, but you can use type object classes for all the data contained (you can use element object classes for all the nodes, if that's easier).
    Use the accessor methods to load the data into the objects you create.
    One tip that almost everyone runs into - JAXB only provides a getter for lists - use the getter to get the list, then use .add() methods to add the objects to that list.

  • Creating tree from HTTPService

    Hi, I'm new under flex builder and I have a simple (?)
    problem :
    I would like to generate a tree from a XML file generate by
    PHP. I can display items (source) in tree but not subitems
    (playlist)...
    Here my XML file generated by PHP :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <sourcelist>
    <source id="3" nom="WarholinDaMix">
    <playlist id="0" nom="Tous les
    fichiers"></playlist>
    </source>
    <source id="2" nom="YoyesGirl">
    <playlist id="0" nom="Tous les
    fichiers"></playlist>
    <playlist id="2" nom="Yo la liste
    Girly"></playlist>
    </source>
    <source id="1" nom="Yoyesman">
    <playlist id="0" nom="Tous les
    fichiers"></playlist>
    <playlist id="1" nom="Yo ma liste 1"></playlist>
    <playlist id="3" nom="Yo ma liste 2"></playlist>
    </source>
    </sourcelist>
    Here the code I use :
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="GetSource.send(null);">
    <mx:HTTPService id="GetSource" url="
    http://127.0.0.1/SchmittTunes/bin/music.php?gettype=source"
    useProxy="false"/>
    <mx:Panel layout="absolute" left="10" right="10">
    <mx:Tree labelField="nom"
    dataProvider="{GetSource.lastResult.sourcelist.source}"
    width="100%" x="0" height="100%" y="0"
    showRoot="false"></mx:Tree>
    </mx:Panel>
    </mx:Application>
    How I said, I have 3 items displaying the 'source' on my
    tree, but I can't expand them. There is no arrow on the left side.
    So subitems like 'playlist' are not display.
    Does anyone know why or have an idea ?
    Thanks for your help
    Mika

    Thanks ! it's working with resultFormat="e4x" tag in my
    HTTPService, but with some adaptations :
    I change the following :
    <mx:Tree labelField="nom"
    dataProvider="{GetSource.lastResult.sourcelist.source}"
    width="100%" x="0" height="100%" y="0"
    showRoot="false"></mx:Tree>
    By :
    <mx:Tree labelField="@nom"
    dataProvider="{GetSource.lastResult}" width="100%" x="0"
    height="100%" y="0" showRoot="false"></mx:Tree>
    Changes are about labelfield and dataprovider.
    Thanks for your help !

  • Load Sales Order from Xml file

    Hi,
    I want to load a sales order from xml file. How can I do so? Where I'll get the xml schema for Sales Order or other documents (delivery,invoice etc)?
    Plz reply with code and xml file.

    When I'm going to load SO from xml file, it's showing an error:
    "The connected value 0 was not found in table Uasge of Nota Fiscal".
    What is this table for? Which attribute is related with this table?
    How can I find out that?

  • I want to load a sales order from xml file. How can I do.

    Hi,
    I want to load a sales order from XML  file. How can I do ? how can i create the sales order?
    what are the necessary  setting for  create the sales orders.
    with Regards,
    Prakesh.

    Three options come to my mind.
    Option 1: Use SAP transaction SXDA_TOOLS (Object Type BUS2032), Program Type (BAPI) and Program (CREATEFROMDAT2).
    Option 2: Use SAP transaction SXDA_TOOLS (Object Type BUS2032), Program Type (DINP) and Program (RVINVB10).
    Option 3: Translate the xml to IDoc so that ORDER04 / ORDER05 Idoc can be used to create Sales order (WEDI transaction).

  • Pls Help me with steps to add data from xml file to SAP B1 through B1iSN.

    Pls Help me with steps to add data from xml file to SAP B1 through B1iSN. I  am getting stuck in xsl transformation. not able to understand where the mapping code needs to be added.
    Pls explain me the steps for adding data from xml to B1 quotation step by step.
    thanks and regards
    Priya

    Hi,
    Have you checked this: https://sap.na.pgiconnect.com/p45508295/?launcher=false&fcsContent=true&pbMode=normal ?
    Thanks,
    Gordon

Maybe you are looking for