Getting list of possible child nodes

I'm trying to find an automated way to get a list of all the possible child nodes for a given element based on a schema. How does one go about doing that in Java? The closest match I could find was the class ElementEditAS, but it's deprecated with no mentioned replacement or alternative.
Any help would be greatly appreciated.

You are right, but what may seem simple is not.
1) You can have combinations of choice and sequence constructs in the contents.
2) The element definitions are just references to true definitions somewhere else.
3) You can include other schema files, so you need to work with an arbitrary number of files at the same time.
Basically, all you have to do is read one or more schema files as XML files, probably using DOM or JDOM or whatever you know. Avoid SAX, since you need the full tree structure of the schema file.
Having done something similar, be aware that element names are described in attributes of the element tag, and attributes are defined as elements. Be ready to redo your code a time or two because the names you use (attribute and element) are not working as you expected.
Dave Patterson

Similar Messages

  • Xpath: get attributes from first child node

    Hi,
    I have some problems by getting the attributes from the first child node, if i try to get child elements everything works fine, but whenever i need the elementvalue from a node with attributes i doesn't return anything.
    The xpath expression works fine if i want to get the element value from all childs, but not when i just want from one of them.
    This one works,
    XPathFactory factory1 = XPathFactory.newInstance();
        XPath xpath = factory1.newXPath();
        xpath.setNamespaceContext(new PersonalNamespaceContext());
        XPathExpression expr
         = xpath.compile("//default:DeviceExchange[1]/default:Status/text()");
       // gets the value of the node picked out
        Object result = expr.evaluate(doc, XPathConstants.NODESET);
        NodeList nodes = (NodeList) result;
        for (int i = 0; i < nodes.getLength(); i++) {
          names[i] = nodes.item(i).getNodeValue();
          String a = names;
    // checks if status is exchanged, if it is sets status to 1
    if (a.length() == 9){
    names[i] = "1"; }
    else{  names[i] = "0";}
    System.out.println(names[i]);This doesn'tXPathFactory factory2 = XPathFactory.newInstance();
    XPath xpath2 = factory2.newXPath();
    xpath2.setNamespaceContext(new PersonalNamespaceContext());
    XPathExpression expr2 = xpath2.compile("//default:DeviceExchange[1]/default:Field[@names='MLPKTID']/text()");
    Object result2 = expr2.evaluate(doc, XPathConstants.NODESET);
    NodeList nodes2 = (NodeList) result2;
    for (int i = 0; i < nodes2.getLength(); i++) {
    names2[i] = nodes2.item(i).getNodeValue();
    System.out.println(names2[i]);}Does anyone have any ideas? I will apreciate all help!
    Edited by: fusen on Oct 25, 2007 1:12 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Sorry, solved myself. Just � typo that that i couldn't detect.

  • Getting the value of a child node in an array

    How do you get the value of a child node in an array titled "entries"?  I used to do this in AS2, and now I'm trying in AS3.  To top it off, I'm forced to use an XML format I'm unfamiliar with.  So I'm not sure how to access these nodes in AS3.  An example of the XML is;
       <Row>
        <Cell><Data ss:Type="String">Absorption Areas</Data></Cell>
        <Cell><Data ss:Type="String">Drain fields where left over liquid from the septic system soak into the ground.</Data></Cell>
       </Row>
    How would I access ether of the <Cell> rows?
    Thanks

    Given that you declared ss namespace (otherwise it will throw an error) you have two options:
    xml.Cell[0].Data - will output:
    Absorption Areas
    xml.Cell.Data will output:
    <Data ss:Type="String">Absorption Areas</Data>
    <Data ss:Type="String">Drain fields where left over liquid from the septic system soak into the ground.</Data>
    So, xml.Cell.Data[1] will output:
    Drain fields where left over liquid from the septic system soak into the ground.

  • Is it possible to restrict the user from creating a sibling and allow him to ONLY create child nodes in DRM?

    When in a hierarchy, a user right clicks on a node to crate a new node, he has two options
    -Child
    -Sibling
    Is it possible to restrict the user from creating a sibling and allow him to ONLY create child nodes?
    Business cases:
    1. different level nodes need to have different prefixes.
    - Thus, the default prefix property definition uses the level number to assign a prefix
    - Also, a validation, to ensure the correct prefix, uses the level number
    But if the user can create a child and a sibling then the default prefix will only be right for a single case and not both.
    Thanks

    If the images are exactly the same size then make sure the layer with the mask
    is the active layer and in the other documents go to Select>Load Selection and choose
    your document with the layer mask under Source document and under channel choose the layer mask.
    After the selection loads press the layer mask icon at the bottom of the layers panel.
    MTSTUNER

  • I need to get the tagName after a node of the first child of the Root

    Hi All,
    I need to get the TagName of the Node immediete after the Root. I won't know what is the TagName, and based on the Tagname only I can process the records.
    For example I might receive a SALES object or a MARKETING object wrapped under the root.
    eg.
    <PARENT>
    <SALES>
    </SALES>
    </PARENT>
    or
    <PARENT>
    <MARKETING>
    </MARKETING>
    </PARENT>
    I tried to using like this
                   DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                   File file = new File("c:/example.xml");
                   document = documentBuilder.parse(file);
                   Node node = document.getDocumentElement().getFirstChild();
                   System.out.println("node Name:" +node.getNodeName());
                   System.out.println("node Value:" +node.getNodeValue());
    It returns only something like #text, but I need the response like 'SALES'.
    Can anyone let me know if im missing something somewhere.
    thanks in advance,
    Harish

    That's because the first child of the document element is that whitespace text node between <PARENT> and <SALES>. You need to scan through the children of the document element until you find one that is an Element node.

  • Is it possible to put two different colors in tree parent node background and child nodes background?

    Is it possible to put two different colors in tree parent
    node background and child nodes background?
    Any help will be very helpful.
    Thanks

    Hi PanosE,
    Yes, you can set up another Standard Edition Server in child domain and then deploy pool pairing.
    You need to deploy a new Front End Pool for the new Standard Edition Server.
    A similar case for your reference.
    https://social.technet.microsoft.com/Forums/office/en-US/eca4299c-8edb-481e-b328-c7deba2a79ba/lync-2013-standard-edition-lync-fe-pools-in-multiple-domain-single-forest-senario?forum=lyncdeploy
    Best regards,
    Eric
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How is it possible to get list of VIs from executable?

    Hi!
    Simple question.
    I have executable (builded with LabVIEW, of course).
    In LabVIEW 8.0.1 - based application I able to get list of VI inside of executable (with ..\LabVIEW 8.x\vi.lib\Utility\libraryn.llb\Get VI Library.vi)
    But if application was builded with LabVIEW 8.2 it seems to be impossible, because error 13 occurred (file is not a resource file).
    How is it possible to get list of all VIs from executable which was generated with LabVIEW 8.2?
    I do not prefer to build application with llb.
    Theoretically I can "convert" exe to llb, and then get list of VIs, but this is "undocumented" way and not preferred.
    Any other (better) ideas how to do this?
    best regards,
    Andrey.

    Hi Andrey;
    Just happened to be browsing for a different problem, but an alternative method (assuming I understood the question correctly) may be to use the "List Folder" vi to create a list of all VIs contained within your .exe application.  From this list, you could further use a "Match Pattern" vi to do further sorting.
    For example, if any constructed VIs contained the phrase "SubVI" within the file name, use "Current VI Path" followed by a single "Strip Path" (to eliminate the active VI name), use a "List Folder" to extract the vi names contained within the .exe, and match pattern for something like "*SubVI.vi" to get a listing of all VIs with the phrase "SubVI.vi" in the file name.
    Hope it helps.
    DJH

  • How can i get list of all monitors and rules that assigned to a node ?

    Hello,
    We r using the scom 2012 sp1
    i need to get list of monitors and rules that have assigned to nodes.
    for example :
    nodename - type - name
    node1 - monitor - montiorname1
    node1 - monitor - monitorname2
    node1 - rule - rule1
    node1 - rule - rule2
    can i get this list by using sql or powershell script ?
    thanks

    Hi,
    Please refer to the link below:
    How to View All Rules and Monitors Running on an Agent-Managed Computer
    https://technet.microsoft.com/en-us/library/hh212748.aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How to get Parent nodes and corresponding child nodes in BI Hierarchy

    Hi all,
    I have a standard function module 'RSNDI_SHIE_STRUCTURE_GET3'  to get child node if i pass parent node. But I need child nodes along with the provided parent node as I use this in a loop in BI.
    Thanks

    Could any one help me in this regards .
    Thanks in advance
    Regards,
    sri

  • Get Child node rowkey of a richtreetable in Javascript

    Hello,
    I ve been trying for a while now and any help is greatly appreciated.
    Using Javascript, when clicked on a tree node, i would like to traverse to the first child node and get the rowkey.
    Thanks.

    Hi,
    Basically, we have a rich tree table with child nodes as well.
    When a user discloses a node, the selected row key stays at the top node but i would like to focus it on the child node.
    We already do that through managed bean ((JUCtrlHierNodeBinding)node.getChildren().get(0)) but on the client side, it s still not making child node as selected
    even though in the bean, we have tree.SetSelectedRowKeys with the child node.
    So, our CSS highlight on the child node goes away once we do any other click.
    This does not happen if we click on the child node specifically.
    Hence , we would like to do that traverse down at script level as well and do the selection part.
    Another problem with this is that since the top node behaves as selected(which is correct bcos the expand-collapse is at the top node and we click that icon), user is not
    able to click on top node to see some other data.
    Pls guide me on this where i ve gone wrong.
    and i do have addPartialTarget code in the bean as well but it s not behaving the way we want.
    Thanks.
    Edited by: Jay on Apr 7, 2011 10:19 AM

  • OLAP API to get child nodes ?

    Hi, I am new to OLAP API (Java), I spend some months in Hyperrion Essbase JAPI, now turn to Oracle but feel quite confused about a lot of concept. Here is a task in my hand that is to present the dimension tree in XML format, just like:
    <?xml version="1.0" encoding="GBK"?>
         <Member name="Market" gen="1">
              <Member name="East" gen="2">
                   <Member name="New_York" gen="3" />
                   <Member name="Boston" gen="3" />
                   <Member name="Chicago" gen="3" />
              </Member>
              <Member name="West" gen="2">
                   <Member name="San_Francisco" gen="3" />
                   <Member name="Seattle" gen="3" />
                   <Member name="Denver" gen="3" />
                   <Member name="Los_Angeles" gen="3" />
              </Member>
              <Member name="South" gen="2">
                   <Member name="Dallas" gen="3" />
                   <Member name="Houston" gen="3" />
                   <Member name="Phoenix" gen="3" />
              </Member>
         </Member>
         <Member name="Product" gen="1">
              <Member name="Audio" gen="2">
                   <Member name="Stereo" gen="3" />
    I didn't find ways on how to get child nodes for a given node, for example, how can I get East,West,South,North nodes (called "member" in Essbase) from "Market" node?

    Hi, I am new to OLAP API (Java), I spend some months in Hyperrion Essbase JAPI, now turn to Oracle but feel quite confused about a lot of concept. Here is a task in my hand that is to present the dimension tree in XML format, just like:
    <?xml version="1.0" encoding="GBK"?>
         <Member name="Market" gen="1">
              <Member name="East" gen="2">
                   <Member name="New_York" gen="3" />
                   <Member name="Boston" gen="3" />
                   <Member name="Chicago" gen="3" />
              </Member>
              <Member name="West" gen="2">
                   <Member name="San_Francisco" gen="3" />
                   <Member name="Seattle" gen="3" />
                   <Member name="Denver" gen="3" />
                   <Member name="Los_Angeles" gen="3" />
              </Member>
              <Member name="South" gen="2">
                   <Member name="Dallas" gen="3" />
                   <Member name="Houston" gen="3" />
                   <Member name="Phoenix" gen="3" />
              </Member>
         </Member>
         <Member name="Product" gen="1">
              <Member name="Audio" gen="2">
                   <Member name="Stereo" gen="3" />
    I didn't find ways on how to get child nodes for a given node, for example, how can I get East,West,South,North nodes (called "member" in Essbase) from "Market" node?

  • Getting child nodes using sax

    How can i get the value of childnodes in java using sax?

    Just wait a while. The child nodes will be passed to you after the parent nodes. Of course, you will have to keep track of which child nodes of which parent elements you want, but you probably know this already. If you want to process the entire file first and then decide which child nodes are of interest, read up on one of the DOM-ish approaches.
    Dave Patterson

  • HOw to get parent node name value through its child node?

    Hi,
    Experts,
    I am able to get child node name values but according to attribute name value i want to  get its parent name value how to achieve that. For that i have used If_Ixml_element->Get_parent. Please pass some idea on it.
    Thanks in advance,
    Shabeer ahmed.

    Hello Shabeer
    I think the coding should be straightforward:
    DATA: lo_element   TYPE REF TO if_ixml_element,
              lo_child        TYPE REF TO if_ixml_node,
              lo_parent      TYPE REF TO if_ixml_node.
    " NOTE: LO_ELEMENT holds your child node
      lo_child ?= lo_element.
      lo_parent = lo_child->get_parent( ).
    Regards
      Uwe

  • I'm using AOL for email and Firefox 9.0.1. Problem started 2 days ago. Before that I put in the first two letters of an email address and it gave me a list of possibles. Now I get "undefined" for each possible instead of the email address.

    After updating to Firefox 9.0.1 there were no problems. My contact list still shows as it did before this problem arose. When I type in the first letter or two of the email address, it used to give me a list of possibles. Now t is just showing the email address as "undefined" when it gives me suggestions for the email address I'm typing in the send line. This means that instead of being able to click on my choice in the possibles it gives me, I have to go to my contact list, find the name and then click on it if I'm sending the email to one person. If it goes to more than one, I either have to type in the full address or use copy and paste from the contact list. This is a huge hassle. Any help is appreciated.

    I moved the file formhistory.sqlite to another file folder. I then started Firefox up again to see if it worked or if I needed to start it in Safe Mode. No need for Safe Mode. It now works exactly as it should. Thank you so much!!

  • I need to get the tagName of a node of the first child of the Root

    Hi All,
    I need to get the TagName of the Node immediete after the Root. I won't know what is the TagName, and based on the Tagname only I can process the records.
    For example I might receive a SALES object or a MARKETING object wrapped under the root.
    eg.
    <PARENT>
    <SALES>
    </SALES>
    </PARENT>
    or
    <PARENT>
    <MARKETING>
    </MARKETING>
    </PARENT>
    I tried to using like this
    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
    File file = new File("c:/example.xml");
    document = documentBuilder.parse(file);
    Node node = document.getDocumentElement().getFirstChild();
    System.out.println("node Name:" +node.getNodeName());
    System.out.println("node Value:" +node.getNodeValue());
    It returns only something like #text, but I need the response like 'SALES'.
    Can anyone let me know if im missing something somewhere.
    thanks in advance,
    Harish

    Hi Blaise,
    thanks for your reply.
    but still i couldn't get the tag name even after using setIgnoringElementContentWhitespace true.
              Document document = null;
              DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
              documentBuilderFactory.setIgnoringElementContentWhitespace(true);
              try
                   DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                   File file = new File("c:/example.xml");
                   document = documentBuilder.parse(file);
                   Node node = document.getDocumentElement().getFirstChild();
                   System.out.println("node.getNodeName: "+node.getNodeName());
                   System.out.println("node.getNodeValue: "+node.getNodeValue());
    it really confuses what im going wrong.
    can you let me know if the code that i have given is correct?
    thanks,
    Harish

Maybe you are looking for

  • How can i transfer contacts from my iPhone to my new iPad 2

    I just bought a iPad 2 and want to tranfer all info from my iPhone 3GS. iTunes installed music, pics and apps but couldn't find how to do it for email & contacts

  • Header in the output of the program

    I have used this code for creating header in the output. REPORT  ZF7U_PAYMT_PAR         LINE-SIZE  132         LINE-COUNT 60         NO STANDARD PAGE HEADING. TOP-OF-PAGE. CALL FUNCTION 'Z_STANDARD_PAGE_HEADER'        EXPORTING             COMPANY_CO

  • For only 'Deliver' transaction when one step receiving is done.

    Hello, per clients business process, client performs one step receiving transaction manually. So this act produces 'Receive' entry in rcv_transactions table. So technically now we want to perform only 'Deliver' transaction. So, per Oracle Note 731097

  • Material group issue

    Dear All, The requirement is for a particular material type the system should purpose the material group that belong to that material type only not all the material groups that are defined in the system. Example; Material group—V-belt, bearings, etc

  • Sales Person Commission

    Hi, How to calculate sales person commision in order management. My client wants to give sepearate sales person commission on each type of sales category like Deal, special Deal, Nett orders commission differs like 2%, 5%, 3%. If we want to pull up s