How to show an XML doc's node?/element in a dynamic textbox?

Hello!
I would like to show an XML doc's node?/element in a textbox. I am importing the XML data from a PHP page. My code looks like this:
var xmlRequest:URLRequest = new URLRequest("adatatvitel.php");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE, init);
function init(e:Event):void{ 
  var xmlDoc:XMLDocument = new XMLDocument();
  xmlDoc.ignoreWhite = true;
  var datasXML:XML = XML(xmlLoader.data);
  xmlDoc.parseXML(datasXML.toXMLString());
This program would be a quiz. First I would like to write out the first data: Question with the appropriate Answers. If the player's answer is correct, the program would show the second set.  Thanks in advance!
Here is my PHP code:
<?php
require("db.php");
$sql = "SELECT * FROM kerdesvalasz";
$result = mysql_query($sql) or die(mysql_error());
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<datas>";
while($row = mysql_fetch_array($result))
  echo '<data>';
  echo '<question>'.$row['kerdes'].'</question>';
  echo '<answer1>'.$row['valasz1'].'</answer1>';
  echo '<answer2>'.$row['valasz2'].'</answer2>';
  echo '<answer3>'.$row['valasz3'].'</answer3>';
  echo '<answer4>'.$row['valasz4'].'</answer4>';
  echo '<correct>'.$row['helyes'].'</correct>';
  echo '</data>';
echo "</datas>";
?>

Hi Taly,
Florian is right, you need to knwo / set a maximum columns ( i assumed he actually mean column) so that content being displayed will be visible on form.
I would suggest you to reaccess to your solution again if this design and think what if you have 999 columns, how do you want to display the content in form .
I would suggest to transpose your content to display as row in form, and let the content to flow.
This should solve your issue.
Hope this helps.
regards,
Xiang Li

Similar Messages

  • How to receive a xml CDATA in string element when OSB calling a webservice?

    How to receive a xml CDATA in string element when OSB calling a webservice?
    I have a business service (biz) that route to operation of a webservice.
    A example of response to this webservice legacy:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eg="example">
    <soapenv:Header/>
    <soapenv:Body>
    <ex:executeResponse>
    <ex:arg><![CDATA[<searchCustomerByDocumentNumberResponse>
    <name>John John</name>
    </searchCustomerByDocumentNumberResponse>]]></ex:arg>
    </ex:executeResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    the type of ex:arg is a string.
    How to receive this CDATA structure to webservice in OSB?

    Similiar to the answer How to pass a xml CDATA in string element when OSB calling a webservice?
    Use the xquery function fn-bea:inlinedXML rather than fn-ben:serialize
    Steps to solve this problem:
    1. Create a XML Schema. E.g.:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="unqualified">
    <xs:complexType name="searchCustomerByDocumentNumberResponse">
    <xs:sequence>
    <xs:element name="name" minOccurs="0">
    <xs:annotation>
    <xs:documentation>
    </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
    <xs:restriction base="xs:string" />
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="searchCustomerByDocumentNumberResponse" type="searchCustomerByDocumentNumberResponse"></xs:element>
    </xs:schema>
    2. Create a XQuery to create a searchCustomerByDocumentNumber ComplexType. E.g.:
    3. Create a XQuery Transformation (XQ) to get the CDATA response to the webservice legacy. E.g.:
    declare namespace ns0 = "novosiaws";
    declare function xf:getReponse($searchCustomerByDocumentNumberResponse as element(ns0:searchCustomerByDocumentNumberResponse))
    as element(searchCustomerByDocumentNumberResponse) {
    fn-bea:inlinedXML($searchCustomerByDocumentNumberResponse/ns0:arg)
    For more information about xquery function:
    fn-bea:inlinedXML
    The fn-bea:inlinedXML() function parses textual XML and returns an instance of the XQuery 1.0 Data Model.
    The function has the following signature:
    fn-bea:inlinedXML($text as xs:string) as node()*
    where $text is the textual XML to parse.
    Examples:
    fn-bea:inlinedXML(“<e>text</e>”) returns element “e”.
    fn-bea:inlinedXML(“<?xml version=”1.0”><e>text</e>”) returns a document with root element “e”.
    Source: http://docs.oracle.com/cd/E13162_01/odsi/docs10gr3/xquery/extensions.html

  • How to pass a xml CDATA in string element when OSB calling a webservice?

    How to pass a xml CDATA in string element when OSB calling a webservice?
    I have a business service (biz) that route to operation of a webservice.
    A example of request to this webservice legacy:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eg="example">
    <soapenv:Header/>
    <soapenv:Body>
    <ex:execute>
    <ex:arg><![CDATA[<searchCustomerByDocumentNumber>
    <documentNumber>12345678909</documentNumber>
    </searchCustomerByDocumentNumber>]]></ex:arg>
    </ex:execute>
    </soapenv:Body>
    </soapenv:Envelope>
    the type of ex:arg is a string.
    How to pass this CDATA structure to webservice in OSB?

    Steps to solve this problem:
    1. Create a XML Schema. E.g.:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         elementFormDefault="unqualified">
         <xs:complexType name="searchCustomerByDocumentNumber">
              <xs:sequence>
                   <xs:element name="documentNumber" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation>
                             </xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                             <xs:restriction base="xs:string" />
                        </xs:simpleType>
                   </xs:element>
         </xs:sequence>
         </xs:complexType>
         <xs:element name="searchCustomerByDocumentNumber" type="searchCustomerByDocumentNumber"></xs:element>
    </xs:schema>
    With this XSD, the XML can be generate:
    <?xml version="1.0" encoding="UTF-8"?>
    <searchCustomerByDocumentNumber xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="searchCustomerByDocumentNumber.xsd">
    <documentNumber>documentNumber</documentNumber>
    </searchCustomerByDocumentNumber>
    2. Create a XQuery to create a searchCustomerByDocumentNumber ComplexType. E.g.:
    (:: pragma bea:global-element-return element="searchCustomerByDocumentNumber" location="searchCustomerByDocumentNumber.xsd" ::)
    declare namespace xf = "http://tempuri.org/NovoSia/CreateSearchCustomerByDocumentNumber/";
    declare function xf:CreateSearchCustomerByDocumentNumber($documentNumber as xs:string)
    as element(searchCustomerByDocumentNumber) {
    <searchCustomerByDocumentNumber>
    <documentNumber>{ $documentNumber }</documentNumber>
    </searchCustomerByDocumentNumber>
    declare variable $documentNumber as xs:string external;
    xf:CreateSearchCustomerByDocumentNumber($documentNumber)
    3. In your stage in pipeline proxy add a assign calling the XQuery created passing the document number of your payload.
    Assign to a variable (e.g.: called searchCustomerByDocumentNumberRequest)
    4. Create another XQuery Transformation (XQ) to create a request to the webservice legacy. E.g.:
    <ex:arg>{fn-bea:serialize($searchCustomerByDocumentNumberRequest)}</ex:arg>
    For more information about xquery serialize function:
    41.2.6 fn-bea:serialize()
    You can use the fn-bea:serialize() function if you need to represent an XML document as a string instead of as an XML element. For example, you may want to exchange an XML document through an EJB interface and the EJB method takes String as argument. The function has the following signature:
    fn-bea:serialize($input as item()) as xs:string
    Source: http://docs.oracle.com/cd/E14571_01/doc.1111/e15867/xquery.htm

  • How to pass all values from one node element to created node element?

    Hi
    I have model node element under which there are 7 values, and I've created value node element and trying to pass the values from the model node Element to this value node element. But instead of passing all the values its listing only one value.
    How do we rectify this problem!!!
    Thanks in Advance
    Srikant

    Hi Anil
    I've created the node named: TableNode
    and the name of the node from which i want to get the data is : Li_Required_Node
    the Node Structure is
    Context
      |_ Zs_Quantity_Input
         |_Output
           |_Node_Required_Node
              |_Schddt
      |_TableNode
        |_CmpDate
    The Schddt has some 7 values
    The code Snippet is as follows:
    IPublicPricesComp.ITableNodeElement nodeElement;
    IPublicPricesComp.ILi_Required_NodeElement scheduleElement;
    int counter3Max = wdContext.ILi_Required_Node().size();
    for( int counter3= 0 ; counter3 < counter3Max ;counter3++ )
    nodeElement = wdContext.createTableNodeElement();
                             scheduleElement = wdContext.nodeZs_Quantity_Input().nodeOutput_Contract_Qty().nodeLi_Required_Node().getLi_Required_NodeElementAt(counter3);
    nodeElement.setCmpDate(scheduleElement.getSchddt());
    wdContext.nodeTableNode().addElement(nodeElement);               
    On writing the above code and then binding the node to a table column only one value getting displayed
    Where can be the error?
    Thanks in Advance
    Srikant

  • How to show an xml content in a Jsp page?

    I use <jsp:include page=".....xml" /> tag in a jsp file to include an xml file. When this jsp page is open, only the text content in the xml file shows up with plain text. I want this xml file shows up like in IE (with xml format). Does anyone know how to do it? Thanks.
    northcloud

    Thank you, BalusC & evnafets. Someone told me to use <c:import> to load the XML file into a scoped variable, and then use <c:out> to display it. The <c:out> will automatically convert the markup to HTML entities. I tried it, it works. It shows the content in the xml file as plain text (a long string). Any one give me some suggestion to make it looking better, for example, show each element in seperated lines. Thanks.

  • How to structure an XML doc using schema?

    Hi there,
    I have an XML file with a grouped <employee> tags like,
    <employee>
    <employeename>John</employeename>
    <employeename>Dave</employeename>
    </employee>
    I want to structure above xml file to be like this
    <employee>
    <employeename>John</employeename>
    </employee>
    <employee>
    <employeename>Dave</employeename>
    </employee>
    Can I do that in a XML schema (.xsd file)? If I can, how do I do that?
    Thanks,
    Chandi

    Hi Dave,
    Thanks for your response.
    I create this XML from .xsd files using a tool (MapForce by Altova which allows me to do the mappings between relational database table columns and elements in the .xsd file, and it creates Java code for me), the data is read from a database to compose this XML file.
    Everything works fine with this XML file, I just want to change the structure of the XML file when it composes it, I was wondering if I could do that by changing the existing .xsd file?
    Its not easy to use XSLT, I�m dealing with over 600 hierarchical elements with over 15 .xsd files.
    So, what are my options?
    All I want to know is, what should I change in the .xsd in order to compose this XML in the structure that I want.
    It groups all the employee names (<employeename> tag) under one <employee> tag, instead I want to have individual <employee> tags for each and every <employeename> tags (<employee> tag around <employeename> tag for each and every employee)
    Is it possible at all?
    Thanks,
    Chandi

  • JDev 11.1.1.2 - How to map fixed xml tags in "any" element of the target?

    I have a target schema that has "any" element as below:
    <xs:element name="USERAREA">
    <xs:complexType mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
    <xs:any/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    I want to map as below in JDev xslt. The 2 new elements are fixed and do not change. I tried to use copy-of but did not know how to do this? Any sample would help.
    <USERAREA>
    <ORACLE.BOOKEDFLAG>Y</ORACLE.BOOKEDFLAG>
    <ORACLE.ORDERTYPE>Standard Order</ORACLE.ORDERTYPE>
    </USERAREA>
    Any help is appreciated.
    Thanks
    Shanthi

    I would think if you intanciate the XMLReference and use IIDXMLElement GetChildCount / GetNthChild would do what you are looking for.
    Ian

  • How to show the content of a table (long text) in a scrollable textbox?

    Hi,
    I have to say first, many thanks to the ones who answers to threads in this forum, it's very helpfull when we're learning web dynpro!
    I have a RFC function that return a table containing a long text (node "it_text", with elements "Tdformat" and "Tdline").
    1) I want first to copy all the Tdlines in a new node "text_box" (that I made specially for the screen, it contains only the element "Tdline" [the text itself]);
    2) Then I want to show the content of the node "text_box" in a scrollable textbox on the screen (to show 8 lines of text, for example).
    How to do that easily?  What is the UI Element needed to show that?
    Thanks!

    If you want to display as it is then you can use Table UI element. You can change the design property to 'transparent' and set column header visibility property to none. Then you need not to write any code simple you can map the node to table field.
    Even with TextEdit you can achieve what you want. Try this code...
         StringBuffer tmpBuffer = new StringBuffer();
         for(int index=0;index<wdContext.nodeLines().size();index++)
              wdContext.nodeLines().setLeadSelection(index);
              tmpBuffer.append(wdContext.currentLinesElement().getLine()+"n");
         wdContext.currentContextElement().setData(tmpBuffer.toString());
    Regards
    Abhilash

  • How to read the content in one node of XML in Java? Pls help

    My dear brothers,
    I am a newbie of XML, I have a exercise which is creating a Tree View from XML file. But the trouble is I do not know how to read the content in one node of XML file. I decide to use the algorithm as following:
    1. Create a GUI form which gives the ability for user to choose a XML file (ok)
    2. Load XML and return the file (ok)
    3. Read the file from node to node to create the node in Tree View (?!)
    Please help me, and if you are enough kind, please give me an small example to easy understand. Thanks in advance.
    Hoang Yen Binh

    I hope this one helps you.
         <ABC Type="ProductBased" ProdName="One" Location="India">
              <CEO>Raj</CEO>
              <Finance>Vikram</Finance>
              <HR>Karthik</HR>
              <Technical>Satish</Technical>
         </ABC>
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Attr;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import org.w3c.dom.DOMException;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import java.io.File;
    import java.io.IOException;
    public class XmlReading {
         Document doc;
         Element element;
         public static void main(String[] args) throws Exception{
              XmlReading xr = new XmlReading();
              xr.getXmlParser(args);
         public void getXmlParser(String[] args) {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   if(args.length != 1) {
                        System.err.println("Argument Required");
              try {
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   doc = builder.parse(new File(args[0]));
              }catch(ParserConfigurationException e1) {
              }catch(SAXException e2) {
              }catch(IOException e3) {
              getAttributes();
         public void getAttributes() {
              // Retrive the entire Document from the Dom Tree
              element = doc.getDocumentElement();
    //          System.out.println(element);
              NamedNodeMap attrs = element.getAttributes();
              // Get number of attributes in the element
         int numAttrs = attrs.getLength();
         // Process each attribute
              for (int i=0; i<numAttrs; i++) {
                   Node node = attrs.item(i);
                   // Get attribute name and value
                   String attrName = node.getNodeName();
                   String attrValue = node.getNodeValue();
                   System.out.println(attrName + ": " + attrValue);
              String s1 = element.getTagName();
              System.out.println(s1);
              // To get all the elements in a DOM Tree
              NodeList nl1 = element.getElementsByTagName("*");
              int i2 = nl1.getLength();
              System.out.println(i2);
              for(int i=0; i<i2; i++) {
                   System.out.println(nl1.item(i) + "\n");
    }

  • How to use Xpath to query elements loaded from different xml docs?

    I have a big DBLP XML doc (95mb), to load into the container, i splitted the doc into many small xml docs by the publication types, such as articles, books, inproceedings, etc.
    I tried to use xpath query such as
    query 'collection()/dblp[article/author]/book[title]'
    I got empty answers.
    but if i use XQuery such as
    query 'let $r:=collection()/dblp,$a :=$r/inproceedings/author
    for $l2 in $r/book
    where $a and $l2/title
    return <result> {$l2}{$a}</result>'
    i got answers. However, if i remove {$a} from the return clause, i still got empty answers.
    is there any problem with my Xpath query and flwor Xquery?
    regards,
    xiaoying

    Hi John,
    Following is the procedure i have used to load the xml docs (after the indexes have been created):
    private static void loadXmlFiles(File path2DbEnv,String theContainer, File file) throws Throwable {
         //Open a container in the db environment
              XmlManager theMgr = null;
              XmlContainer openedContainer = null;
              myDbEnv env;
              try {
              env = new myDbEnv(path2DbEnv);
         theMgr = new XmlManager(env.getEnvironment(), new XmlManagerConfig());
         //use node container
         theMgr.setDefaultContainerType(XmlContainer.NodeContainer);
                   try{
                   openedContainer = theMgr.createContainer(theContainer);
                   }catch (XmlException e){
                        //if the container alreay exist, then open it;     
                        openedContainer = theMgr.openContainer(theContainer);
              //Get an update context.
              XmlUpdateContext updateContext = theMgr.createUpdateContext();
                   String theFile = file.toString();
                   String docName=file.getName();
              //Get the input stream.
              XmlInputStream theStream = theMgr.createLocalFileInputStream(theFile);
              System.out.println("Adding " + theFile + " to container " +
                             theContainer);
         //     Do the actual put
              openedContainer.putDocument(docName, // The document's name
              theStream, // The actual document.
              updateContext, // The update context
         //     (required).
              null); // XmlDocumentConfig object
              System.out.println("done.");
              //XmlException extends DatabaseException, which in turn extends Exception.
              // Catching Exception catches them all.
              } catch (XmlException e){
                   System.err.println("Error loading files into container " + theContainer);
                   System.err.println(" Message: " + e.getMessage());
                   //In the event of an error, we abort the operation
                   // The database is left in the same state as it was in before
                   // we started this operation.
                   throw e;
              finally {
              cleanup(theMgr, openedContainer);
    Unfortunately, i waited for around 20 hours 148mb doc was not loaded; so i gave up.
    Could you please give me some suggestions on how to load the large doc efficiently ? thanks.
    regards,
    xiaoying

  • How do I pull XML data by a node name?

    I am new to Flash and XML so I hope I am not asking a
    completely dumb question. I have figured out how to retrieve data
    from and XML file by the node possition but now I would like to
    know how to pull it by a specific node name. Here is what I
    currently have:
    on (rollOver)
    myLot = 1;
    _root.myInfo =
    _root.myXML.childNodes[0].childNodes[this.myLot].childNodes[0].childNodes[0].nodeValue;
    With XML file like this:
    <SectionOne>
    <Lot1>
    <Lot>1</Lot>
    <Price>$450,000</Price>
    <Status>Active</Status>
    </Lot1>
    <Lot4>
    <Lot>4</Lot>
    <Price>$389,000</Price>
    <Status>Sold</Status>
    </Lot2>
    </SectionOne>
    What I would like is to pull instead of
    childNodes[this.myLot] to pull the node named Lot1. The problem I
    have is I don't always have consecutive lot numbers and I don't
    want to have to build in blank xml lines for a placeholder. I hope
    that makes sense.

    Sorry for the delay. I originally posted this on the
    newsgroup, but I suppose it did not propagate to here.
    What you would do is use a loop statement and compare the
    nodeNames.
    To see a nodes name such as Lot1 you use:
    childNodes[x].nodeName
    // Load up the lotNodes object
    lotNodes = _root.myXML.childNodes[0];
    // Now lotNodes contains all the nodes Lot0, Lot1, Lot2.....
    // Iterate through all of lotNodes childNodes and compare the
    // nodeName until you find the one you want then drill down
    // it to get the info you want.
    for( var counter01 = 0;counter01 <
    lotNodes.childNodes.length;counter01++){
    if(lotNodes.childNodes[counter01].nodeName == "Lot1"){
    myInfo =
    lotNodes.childNodes[counter01].childNodes[0].childNodes[0].nodeValue;
    I have not had time to test this but it should work, I'll
    double check it after work.
    I hope this helps get you moving forward.
    If you have any other problems or can't get it to work, let
    me know here or email me. Preferably here, so others can learn and
    help.
    Scotty
    [email protected]

  • How to convert XML doc to string and vice versa?

    Assume I have a XML doc and I want to convert it into a string (and put it into a string variable).
    How can I do this?
    How can I do the opposite: Convert a string content into a XML doc?
    Peter

    Use:
    ParseEscapedXML() and ora:getContentAsString()
    See
    http://www.codeguru.com/cpp/sample_chapter/article.php/c10789__7/
    Marc

  • I had purchased Imovie today I can find the icon movie it click it but it will not open. Its shows up in docs and purchased but not apps? how do i add it to my bar and open it?!

    I had purchased Imovie today I can find the icon movie it click it but it will not open. Its shows up in docs and purchased but not apps? how do i add it to my bar and open it?!

    Exactly where are you clicking, you need to be specific. For example, are you using the Dock, the Applications folder, Launchpad, etc. to attempt to start teh app? Also IOS 7.1.2 does not run on a Mac, what version of OS X is installed on your computer?

  • Parse and display xml doc when click on JTree node?

    Ok so here is the code that I have now. You will have to make alot of html files to run the program, but they can be empty for now. What you can do is just put the same exact html file to be displayed in each node element. for example.
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));could be changed to
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "status.html"));And just keep adding the status.html page to each one of the nodes.
    anyway.
    For now when I click on the node, the html file is displayed in the JScrollPane rPane = new JScrollPane(htmlPane); and the htmlPane is a JEditorPane
    what I need it to do.
    When I click on the JTree node. I would like to go out to an xml file, parse the information in it, and display it to the pane.
    I will need to later, be able to add, edit, or delete information on the xml through the pane later.
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.JTree;
    import javax.swing.JPanel;
    import javax.accessibility.*;
    import javax.swing.UIManager;
    import javax.swing.JComponent;
    import javax.swing.JEditorPane;
    import javax.swing.tree.TreeSelectionModel;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.ImageIcon;
    import java.net.URL;
    import java.io.IOException;
    import java.awt.Dimension;
    * @author orozcom
    public class Example extends JFrame implements TreeSelectionListener
        private JEditorPane htmlPane;
        private URL helpURL;
        private static boolean DEBUG = false;
        private JTree tree;
        public Example()
            super("Example");
            setSize(1200,900);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JMenuBar jmb = new JMenuBar();
            JMenu fileMenu = new JMenu("File");
            JMenuItem openItem = new JMenuItem("Open");
            JMenuItem saveItem = new JMenuItem("Save");
            JMenuItem exitItem = new JMenuItem("Exit");
            exitItem.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    System.exit(0);
            fileMenu.add(openItem);
            fileMenu.add(saveItem);
            fileMenu.add(new JSeparator());
            fileMenu.add(exitItem);
            jmb.add(fileMenu);
            setJMenuBar(jmb);
            //  **************** start JTree ******************//       
            JPanel lPane =new JPanel();       
            lPane.setLayout(new BorderLayout());
            DefaultMutableTreeNode top = new DefaultMutableTreeNode(new ModuleInfo("Devices","splashScreen.html"));
            DefaultMutableTreeNode branch1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 1", "module1.html"));
            DefaultMutableTreeNode branch2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 2", "module2.html"));
            //DefaultMutableTreeNode branch3 =
                    //new DefaultMutableTreeNode(new ModuleInfo("Module 3", "module3.html"));
            //adding to the topmost node
            top.add(branch1);
            top.add(branch2);
            //top.add(branch3);
             *          BRANCH 1           *
            //adding to the First branch
            DefaultMutableTreeNode node1_b1
                    =new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
            //branch1.add(node1_b1);
                DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b1.add(n1_node1_b1);
                node1_b1.add(n2_node1_b1);
                node1_b1.add(n3_node1_b1);
                node1_b1.add(n4_node1_b1);    
            DefaultMutableTreeNode node2_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
            DefaultMutableTreeNode n1_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
            DefaultMutableTreeNode n2_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
            DefaultMutableTreeNode n3_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
            node4_b1.add(n1_node4_b1);
            node4_b1.add(n2_node4_b1);
            node4_b1.add(n3_node4_b1);
            DefaultMutableTreeNode node5_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch1.add(node1_b1);
            branch1.add(node2_b1);
            branch1.add(node3_b1);
            branch1.add(node4_b1);
            branch1.add(node5_b1);
             *          BRANCH 2           *
            //adding to the Second branch
            DefaultMutableTreeNode node1_b2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
                DefaultMutableTreeNode n1_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b2.add(n1_node1_b2);
                node1_b2.add(n2_node1_b2);
                node1_b2.add(n3_node1_b2);
                node1_b2.add(n4_node1_b2);
            DefaultMutableTreeNode node2_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
                DefaultMutableTreeNode n1_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
                node4_b2.add(n1_node4_b2);
                node4_b2.add(n2_node4_b2);
                node4_b2.add(n3_node4_b2);
            DefaultMutableTreeNode node5_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch2.add(node1_b2);
            branch2.add(node2_b2);
            branch2.add(node3_b2);
            branch2.add(node4_b2);
            branch2.add(node5_b2);
             *          BRANCH 3           *
            //adding to the Third branch
            DefaultMutableTreeNode node1_b3=new DefaultMutableTreeNode("Status");
            DefaultMutableTreeNode n1_node1_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node1_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node1_b3=new DefaultMutableTreeNode("Chassis");
            DefaultMutableTreeNode n4_node1_b3=new DefaultMutableTreeNode("Resources");
            node1_b3.add(n1_node1_b3);
            node1_b3.add(n2_node1_b3);
            node1_b3.add(n3_node1_b3);
            node1_b3.add(n4_node1_b3);
            DefaultMutableTreeNode node2_b3=new DefaultMutableTreeNode("Project Editor");
            DefaultMutableTreeNode node3_b3=new DefaultMutableTreeNode("Project Manager");
            DefaultMutableTreeNode node4_b3=new DefaultMutableTreeNode("Administration");
            DefaultMutableTreeNode n1_node4_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node4_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node4_b3=new DefaultMutableTreeNode("Users");
            node4_b3.add(n1_node4_b3);
            node4_b3.add(n2_node4_b3);
            node4_b3.add(n3_node4_b3);
            DefaultMutableTreeNode node5_b3=new DefaultMutableTreeNode("Logging");
            branch3.add(node1_b3);
            branch3.add(node2_b3);
            branch3.add(node3_b3);
            branch3.add(node4_b3);
            branch3.add(node5_b3);
            tree=new JTree(top,true);
            //tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
            //Set the icon for leaf nodes.       
            ImageIcon deviceIcon = createImageIcon("/device.gif");       
            if (deviceIcon != null)
                DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
                renderer.setLeafIcon(deviceIcon);
                tree.setCellRenderer(renderer);
            else
                System.err.println("Leaf icon missing; using default.");
            //Listen for when the selection changes.
            tree.addTreeSelectionListener(this);
            //Create the scroll pane and add the tree to it.
            //JScrollPane treeView = new JScrollPane(tree);
            tree.setToolTipText(" and ");
            lPane.add(tree);
            getContentPane().add(lPane);
            //  ****************  end  JTree  ******************//
            htmlPane = new JEditorPane();
            htmlPane.setEditable(false);       
            initHelp();
            JScrollPane rPane = new JScrollPane(htmlPane);
            JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, lPane, rPane);
            jsp.setDividerLocation(180);
            getContentPane().add(jsp, BorderLayout.CENTER);
            JPanel bPane = new JPanel();
            JButton okButton = new JButton("Ok");
            JButton applyButton = new JButton("Apply");
            JButton clearButton = new JButton("Clear");
            bPane.add(okButton);
            bPane.add(applyButton);
            bPane.add(clearButton);
            getContentPane().add(bPane, BorderLayout.SOUTH);
            setVisible(true);
        /** Required by TreeSelectionListener interface. */
        public void valueChanged(TreeSelectionEvent e)
            DefaultMutableTreeNode node = (DefaultMutableTreeNode)
            tree.getLastSelectedPathComponent();
            if (node == null) return;
            Object nodeInfo = node.getUserObject();
            if (node.isLeaf())
                ModuleInfo module = (ModuleInfo)nodeInfo;
                displayURL(module.moduleURL);
                if (DEBUG)
                    System.out.print(module.moduleURL + ":  \n    ");
            else
                displayURL(helpURL);
            if (DEBUG)
                System.out.println(nodeInfo.toString());
        private class ModuleInfo
            public String deviceName;
            public URL moduleURL;
            public ModuleInfo(String device, String filename)
                deviceName = device;
                moduleURL = (URL)Example.class.getResource("/" + filename);
                if (moduleURL == null)
                    System.err.println("Couldn't find file: "
                            + filename);
            public String toString()
                return deviceName;
        private void initHelp()
            String s = "YFDemoHelp.html";
            helpURL = Example.class.getResource("/" + s);
            if (helpURL == null)
                System.err.println("Couldn't open help file: " + s);
            else if (DEBUG)
                System.out.println("Help URL is " + helpURL);
            displayURL(helpURL);
        private void displayURL(URL url)
            try
                if (url != null)
                    htmlPane.setPage(url);
                else
                { //null url
                    htmlPane.setText("File Not Found");
                    if (DEBUG)
                        System.out.println("Attempted to display a null URL.");
            catch (IOException e)
                System.err.println("Attempted to read a bad URL: " + url);
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path)
            java.net.URL imgURL = Example.class.getResource(path);
            if (imgURL != null)
                return new ImageIcon(imgURL);
            else
                System.err.println("Couldn't find file: " + path);
                return null;
        public static void main(String args[])
            new Example();
            //new AssistiveExample();
    }Thanks orozcom

    yes i can at the time of MIRO u can see both
    go in SU01 for and user
    in Parameters enter IVFIDISPLAY in Parameter ID and X in Paramater Value
    thus for that user u will be able to c Invoice number and accounting number after saving MIRo
    u will get message like
    Invoice document 5105608893 was posted ( Accountng Documnt: 5100000000 )
    hope this helps

  • How to get the name and value of an attribute on a node/element that is not a child

    Hello,
    Can someone shed some wisdom on how I can compare 2 xml nodes for differences.
    My main challenge is I need to use the attributes/values of 'ProductDescription' and 'Features' as 'key' to identify the same node in
    another doc with the same layout, but different content.
    I am having trouble getting the name of the attribute on the node, 'ProductDescription' and 'Features'.  I can only seem to get the node names, but not the attributes on the node.  I need the name, because it can be different from doc to doc, so
    I can't hardcode this.
    Can someone please help with how to retrieve an attribute name/value on a node that is not a child.  Here's an example of what
    my xml looks like:
    DECLARE
    @myDoc1 xml
    ,@mydoc2 xml
    DECLARE
    @ProdID int
    SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <features featureID = "2" featureName = "seat">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>
    SET @myDoc2 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>2 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <features featureID = "2" featureName = "wheel">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>
    I need to compare the attributes of 'ProductDescription' and 'Features' from @mydoc1 against @mydoc2 to see if they are the same based on those 2 nodes first.  If they are, then i want to show the difference in the child elements. 
    This will eventually be an outer join to give me the differences betw the 2 docs based on those key values (node attributes).
    I used node('//*') for the path, and value('local-name(../.)', 'varchar(50)') as element
    ,value('.[not(@xsi:nil = "true")]','VARCHAR(255)') AS new_value
    ...etc...
    but that only gives me the node names, and the child elements.  It does not give me back the attribute names and values from the node itself.
    Thanks in advance for your help.
    cee

    Are you looking for something like this:
    DECLARE @myDoc1 xml
    SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <Features featureID = "2" featureName = "seat">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>'
    SELECT T.c.value('local-name(.)', 'nvarchar(50)') AS name,
           T.c.value('.', 'nvarchar(50)')  AS value
    FROM   @myDoc1.nodes('ProductDescription/@*') AS T(c)
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for