Skip to main content
1-Visitor
February 27, 2013
Question

Linking Java and Arbortext

  • February 27, 2013
  • 2 replies
  • 848 views

Hello gurus!

Today I'm having a problem with some of my java methods, I created an
Arbortext button which calls through aDocument doc = Acl.getDOMDocument("0");
getElementsByTagName("Sect1");

childsByTag.getLength());
for(int i=0; i < childsByTag.getLength(); i++){
this.getNodeContent(node,");
childByTag node that I have found in my first oid_find_childrenoid,root_children_arr,"SectX") < in java and get the
elements of the root_children_arr, in order to process them in a
recursive function.

Please if anybody could help me I would be pretty grateful. As always I
really appreciate your time, help and support.

Regards,
Paulette

    2 replies

    1-Visitor
    February 27, 2013
    You could either iterate through the DOM itself, or just use an XPath to
    get a set of applicable nodes.

    For XPath, you'll also need to add some helper functions, as XPath support
    isn't native, but can be exposed through ACL.

    See example:

    trick I would think.


    On Wed, Feb 27, 2013 at 12:30 PM, Paulette Zorrilla <
    paulette.zorrilla@oracle.com> wrote:

    > Hello gurus!
    >
    > Today I'm having a problem with some of my java methods, I created an
    > Arbortext button which calls through a dlgitem_add_callback command a
    > java method, this method will execute an examination of the XML document
    > which is currently open in Arbortext, my java code is kind like this...
    >
    > Document doc = Acl.getDOMDocument("0");
    > NodeList childsByTag = doc.getElementsByTagName("Sect1");
    > System.err.println("Number of childs by Tag Sect1" +
    > childsByTag.getLength());
    > Node node;
    > for(int i=0; i < childsByTag.getLength(); i++){
    > node = childsByTag.item(i);
    > this.getNodeContent(node,");
    > }
    >
    > However, what I'm trying to find now are the childs of every single childByTag
    > node that I have found in my first getElementsByTagName implementation,
    > what I mean is: my document will contain another sections inside every
    > section, for example, inside Sect1, there's one or more Sect2, and inside
    > Sect2 you can find one or more Sect3 and so on...; but I don't have any
    > idea how can i get this in Java, I just implemented a method in Arbortext
    > to achieve this task, but I'm needing to implement this algorithm in Java.
    > I would like to know if there's a way in order to implement the Arbortext's
    > command > oid_find_childrenoid,root_children_arr,"SectX") < in java and
    > get the elements of the root_children_arr, in order to process them in a
    > recursive function.
    >
    > Please if anybody could help me I would be pretty grateful. As always I
    > really appreciate your time, help and support.
    >
    > Regards,
    > Paulette
    >
    >
    pzorrilla1-VisitorAuthor
    1-Visitor
    March 12, 2013

    Thank you! It works now using Ac.lfun(...) 🙂