Pulling in children of children in XML

Hey all-
Newbie to XML here and I have what I *hope* is an easy
problem, but I just don't know the answer. And as I have to try and
show this by Monday, I'm sort of stuck.
I am trying to pull in information about houses via an xml
file. Each house has 1 address, 1 owner, 1 description, and about 6
photos. I have no problem accessing the address, owner, etc, and I
can always access the first photo, but whenever I cycle through the
photos, I seem to cycle through the first photo for every house,
not every photo for each house.
Basically, I need the children <images> to go up by
one, without the the parent going up by 1. I am hoping I am
describing this well.
My code looks like this:
total = xmlNode.childNodes.length;
totalb =
xmlNode.childNodes[0].childNodes[5].childNodes.length;
totalc = (totalb-1);
for (i=0; i<total; i++) {
thumb
= xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
address
= xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
construct
= xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
work
= xmlNode.childNodes.childNodes[3].firstChild.nodeValue;
description
= xmlNode.childNodes.childNodes[4].firstChild.nodeValue;
image
=
xmlNode.childNodes.childNodes[5].firstChild.firstChild.nodeValue;
where total = number of houses
and totalb = number of photos for that house.
This works fine - it is pulling in the accurate number of
both houses and photos.
My XML looks like this:
<projects>
<pic>
<thumb>boulevard_staircase1_thumb.jpg</thumb>
<address>Jim's Place</address>
<construct>July 28, 2006</construct>
<work>Framing, Electrical, Flooring,
Roofing</work>
<description>This is Jim's place</description>
<photos>
<image>jim1.jpg</image>
<image>jim2.jpg</image>
<image>jim3.jpg</image>
<image>4.jpg</image>
<image>jim5.jpg</image>
</photos>
</pic>
<pic>
<thumb>boulevard_staircase1_thumbb.jpg</thumb>
<address>Bob's Place</address>
<construct>January 20, 2006</construct>
<work>Bob's Stuff</work>
<description>Isn't Bob Great?</description>
<photos>
<image>bobs1.jpg</image>
<image>bobs2.jpg</image>
<image>bobs3.jpg</image>
<image>bobs4.jpg</image>
</photos>
</pic>
<image> is the tag I am having problem with.
THANKS a lot, and a frosty beer to whoever can help!
Noah

I suggest you load your XML nodes in to an Array for each
nodevalue
then you can cycle thru the array for each pic rather than
trying to extract each childnode value.
A simple way to do this is using XPath statements to load
Arrays
Try this
import mx.xpath.XPathAPI;
var projectxml:XML = new XML();
projectxml.ignoreWhite = true;
projectxml.onLoad = function(success:Boolean) {
trace("onload...");
if (success) {
trace("success...");
var thePath_str:String = "projects/pic/photos";
var pic_array:Array =
XPathAPI.selectNodeList(this.firstChild, thePath_str);
// then you can use a loop to step thru the images
for (var i:Number = 0; i < title_array.length; i++) {
trace(pic_array
.firstChild.nodeValue);
projectxml.load("project.xml");
You can extend this to load all your node values into arrays
then you can step thru the data far more easily.

Similar Messages

  • JS: XMP Children of Children

    I know this may be a simple question to answer, but I am stuck. I am not a programmer, but I am trying to learn, and I am working with an actual programmer on this project, but he is not very familiar with scripting in InDesign, so I am trying to get him the high-level information he needs and he in turn helps me understand how to use that programmatically. So far this has worked really well within InDesign, but now I am venturing into the uncharted waters of XMP.
    I am trying to write a script that will add XMP metadata to images. The idea is to run a script that will allow me to manually position the images in InDesign and then store that information in the XMP of the image so that the next time I use that image (running a different script), it will automatically position itself according to the XMP metadata. The image's XMP needs to hold position data for a number of material types and it needs to be extensible (hence the XMP), but looking through the documentation I am not able to decipher how to inject XMP data with multiple children into the image file, or how to add a child later on. I have been successful in putting a single property into a file's XMP data using the following script:
    new ExternalObject('lib:AdobeXMPScript');
    xmpFile = new XMPFile(
         'file.png',
         XMPConst.FILE_PNG,
         XMPConst.OPEN_FOR_UPDATE
    xmpData = new XMPMeta();
    xmpData.setProperty(
         XMPConst.NS_PNG,
         'propertyName',
         'data'
    I have a schema in mind for the data and I am trying to keep it human-readable so that it can be more easily used in the future. I just can't figure out how to inject a parent --> child --> etc. type schema into the XMP.
    Is there any documentation that anyone can point to that can help me understand this a little better? I have read the XMP section in the JavaScript Tools Guide and, while I admit I don't understand most of it, I can't seem to locate any information on how this would be done. Is there a section within that section that I can show my progammer that would help him understand how to do this?
    Thanks in advance for any help you can give.

    A really wild guess: createContainerItem. It seems you can add a new container of type 'BAG', which may be what you need here.

  • Accessing children of children

    Hey!
    for some reason STORAGE[0].getChildAt(0) works whereas liner.getChildAt(0).getChildAt(0) does not. STORAGE is a movieclip and a child of liner. the error is something about not being able to use getChildAt on a display object.
    what's wrong? is there any other approach i could use?
    PS: liner.getChildAt(0) works and does indeed seem to refer to STORAGE[0]
    thanks!!

    What do you mean when you say "liner.getChildAt(0) works and does indeed seem to refer to STORAGE[0]"... in what ways does it work and seem?  You might find out that what you believe is STORAGE[0] is not.
    Try using...
    trace(DisplayObjectContainer(liner.getChildAt(0)).getChildAt(0));
    and see what comes up.
    If you have direct access to the objects via the STORAGE array there is no need to be trying to reach them via whatever you might have added them as children.  The reference in the array is a direct line to them.
    You should show the code that creates this system so that it is clearer what each element is and from where each arises.  If you are getting an error message, include the complete message.

  • Getting at a Tile's children's children ?

    I've been puzzling with this for 2 days now and it's driving
    me crazy - please help me if you can.
    Using AS I add children to a Tile. Each child consist of a
    <vbox> containing 2 <image>. What I want to do, is to
    be able to loop through the Tile and get to the source of each
    <image>. But I can only access the <vbox>.
    I've been trying to use tile1.getChildAt(i).numChildren - but
    no luck. Feel's like I've exhausted my options.
    I put up a small example here : <
    http://flex2.dk/index.php?entry=entry070227-135034>
    If you got any pointer or general help, please do so :-)
    Thanks,
    Mark

    …and for instructions on how to, non-destructively, remove your HD go to http://www.ifixit.com/
    I say "non-destructively" because even gutted of its HD it will be worth something as a 'spares or repair' on eBay
    Have fun,
    Adrian

  • Children not appearing in drop down of dimension in multiple hierachy

    Hello,
    In 4.2 we had parenth1 and parenth2 and one dimension table (at least I think).  If parenth2 had multiple layers of children (children that were parents) you saw them in the drop down lists of the dimension for the second hierarchy.  In 5.1 it appears the architecture changed with dimensions and multiplie heirarchies.  I do not see children of children in my alternate hierarchies as before.  In looking in the dim"dimensionName"_H2 table I see the correct information.  The data seems to be in the tables but drop down lists for the dimension are not showing children of children if this makes sense.
    Ex.in 5.1  I'm expecting to see in  Hierarchy2 09 -> Child 099 ->Grandchild 0991
          but I'm only seeing Hierachy2 09 -> Child 099
    The Grandchild 0991does not appear. (Grandchild if you will of Hierarchy2)
    In Hierachy1 of the same dimension (or what use to be Parenth1 in 4.2) you see all parents and their children and children of their children etc.   Note:  this dimension is built using a dimension build ssis pkg.
    I know my explanation is probably wordy and confusing but hopefully someone can make sense out of it.  Any feedback, would be greatly appreciated!
    Vikki

    Hi Vikki,
    The way the memberselector shows the hierarchies to end-users is not changed from V4 to V5, so I think there might be something wrong in your dimension.
    Please try to copy the contents of the mbr<dimname> table to you membersheet to see more clearly what is going wrong, also try to process it from there (it will give you more hints compared to using a ssis package to import a dimension.
    Another idea is to look to Apshell, some dimension have multiple hierarchies, you could compare them to your own to see what is wrong.
    Alwin

  • How can I casting from parent class to children class

    Dear,
    Could someone help me to casting from parent class to children class.
    I have class like this
    class parent{
    String name;
    String id;
    public String getId() {
    return id;
    public void setId(String id) {
    this.id = id;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    class children extends parent{
    String address;
    public String getAddress() {
    return address;
    public void setAddress(String address) {
    this.address = address;
    public children() {
    public children(parent p) {
    //Do init super class here
    In the constructor
    public children(parent p) {
    //Do init super class here
    I like to init super class by object p (this is instance of parent class). The way to do is using:
    public children(parent p) {
    super.setId(p.getId());
    super.setName(p.getName());
    But I don't like this, because, for example I have parent class with over 30 proberties, it take time to do like that.
    There are any way to use super operation to init parent class, for example super = p;
    Could you show me the way.
    Thanks alot

    If I understand your question correctly, you are in need of a copy constructor for you class Parent. A copy constructor behaves like this:
       Parent one = new Parent();
       one.setName("...");
       //... and all other properties of interest
       Parent two = new Parent(one);
       //Now two != one, but one.getName().equals(two.getName) for property name and all othersThe copy constructor is programmed in the Parent class, more later. Then for your child class you can use it as follows
       public class Children extends Parent {
           public Children(Parent p) {
              super(p);
       }There are at least 3 ways of programming a copy constructor:
    1. Just bite the bullet: type the assignment for each field this.name = p.getName()
    2. Use reflection to find all common setters/getters dynamically and assign using them
    3. Use a code generator that uses 2 to give you the code for solution 1 for you to paste in.
    If you find doing this a lot, there are frameworks that can do these mappings, like Dozer
    (PS be carefull with Date fields, don't copy the reference but create a new and equals instance, the dirty way would be this.birthdate = new Date(p.getBirthdate.getTime()); )

  • Unable to display all listings in my listbox component pulling from an xml doc

    I have a listbox that I'd like to pull it's data from an XML
    doc. My listbox only pulls the first Artist from my xml file.
    I changed changed the "index for to #2" under bindings and I
    got only the second artist listed.
    What am I missing?
    Thanks

    Hi,
    Pls try application-config tag like this
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb">
        </property>
        <property name="SharingReference" value="com.sap.portal.runtime.application.soap">
        </property>
      </application-config>
    Also check component tag is in this order
    <component name="AddAccounts">
          <component-config>
            <property name="ClassName" value="Test">
            </property>
            <property name="JSP" value="pagelet/test.jsp">
            </property>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld">
            </property>
          </component-profile>
        </component>
    regards,
    Sujesh

  • Coverflow hide children ?

    Hello
    I am using a coverflow, which has 26 panels inside of it. I set all 26 panels to visible=false, yet they still display.
    I have looked at the "extended" code, and see where visibilty gets set, but if I change it, it does not affect the coverflow control. All 26 panels still display.
    Does anyone have any experience with children controls in a coverflow and setting their visibility?
    Any help is appreciated. This is such a cool control, so I am hoping I can get it to behave correctly

    ok, I found a few interesting things with coverwheel control...
    I was able to change the visibility in the main extended class, where it displays children. that did work, but I was getting some really crazy behaviour if I used all 26 panels. Like some panels would get stuck at the top, while others disappeared and would not reappear until you click in the missing area. It was bizarre.
    Anyways, I got real frustrated and realized I could just move all 26 panels to a different container, so they would reside elsewhere. I removed them from layout (includeinlayout=false) and was able to reference them and add them to the coverwheel that way.
    Doing that made it work much better, pretty much flawless now. In the coverwheel example, in the source code I downloaded from doug mccune, it had panels defined INSIDE the coverflow control. I could not set those to visible=false, without altering the extended code classes, so I simply moved the contained panels to a different container.
    In doing some of this, I ran into a problem where you cannot find nested container children. Children references only go one level deep (as far as I understand, I could be wrong), but I had a hell of a time setting the values and properties of the UI controls inside my 26 panels.
    Here is a function I found and altered to get all children inside a container (this is pretty slick):
                private function getChildByNameRecursive(name:String, container:DisplayObjectContainer):Object
                    var child:Object = container.getChildByName(name);
                    if (child)
                        return child as Object;
                    for (var i:uint=0; i < container.numChildren; i++) {
                        if (container.getChildAt(i) is DisplayObjectContainer)
                            child = getChildByNameRecursive(name, container.getChildAt(i) as DisplayObjectContainer);
                            if (child)
                                return child as Object;
                    return child as Object;
    Using this I was able to get to the UI controls embedded deep inside the panels, inside the coverflow control, and set their values (amongst other things).
    This has eliminated my need for using the Tab Navigator control, which sucks to work with by the way. This 3D coverflow is much nicer and really impressed everyone Ive shown I just thought I would share my solution, in case somebody one day could use some of it. Cheers.

  • Vbox resize w/ nested children

    If I dynamically add items to a vbox control in my flex app,
    the vbox automatically adjusts it's height to accomodate the
    additional height needed to house the items I added.
    I am creating a custom control that uses a vbox as the parent
    control. I find that if I add controls to the vbox, then add
    controls to those controls (nested controls), the vbox does not
    adjust it's height. It seems to only adjust for it's own children,
    and not it's children's children.
    Can anyone direct me to the event or method in the vbox that
    I need to call for it to "auto-adjust" its height?
    I know I can use a Resize, but I'd rather not get into
    calculating what the new height should be. It'd be nice to just
    have the vbox do it itself if there is a method I can call to cause
    this to happen.

    Hmm, I'm thinking now that it could be that the parent vbox
    controls are being resized by flex before the child vbox controls.
    I can see that the children do get the proper height adjustment as
    I nest deeper, but the primary child does not adjust. The
    appearance is that the bottom portion of the nested child remains
    hidden behind it's parent.
    I'm going to try to dig a bit deeper and see if this is
    happening.

  • What is the BISAC category to get into Children's Nonfiction?

    I have some children books which I wish to be placed into Children & Teens->Children's Nonfiction category in iBookstore, as our competitors have books over there.
    However, when I tried to upload our Children Music books, we choose Children Music in iTunes Producer, and ends up in Arts & Entertainment->Music! OK, so when we upload our children books on animls, we tried Education/Preschool & Kindergarten, and we ends up in Professional & Technical->Education!
    In all cases, we make sure that our books are specified to be for children only and 3 and up reading age.
    I got another batch of children music books that we wanted to upload, can some kind souls please tell us what category to choose in BISAC? Thanks!

    This works! I finally got one of my book into Children Non-fiction!
    My book is named "Cranes", can't find it yet, but anybody interested can search for it. It has a lot of good photographs of the birds.

  • Converted XML not showing multiple data entries correctly

    Hello
    I am creating a PDF Form from a xsd scheme but when I have data that could require multiple entries the converted xml is a mess. I am curently trying to create a way to add fields for multiple children. I created an expanding table and the fields are automatically copied when I click on „+“ or are deleted when I click on „-“ . If I have multiple rows for children then the converted xml looks like this :
    The correct xml for multiple data entries should look like this (this is from a xml scheme not made in LiveCycle) :
    Even if I copy the fields without creating a table, the converted xml is still a mess just like on the first image. Is there a way to show the xml from the PDF from correctly. I linked the xsd scheme that I am using for the PDF form: https://drive.google.com/file/d/0B30LkLSwYgB4SFN5bTkyLW1fOVU/edit?usp=sharing
    Best regards
    Ivica

    Hello
    I am creating a PDF Form from a xsd scheme but when I have data that could require multiple entries the converted xml is a mess. I am curently trying to create a way to add fields for multiple children. I created an expanding table and the fields are automatically copied when I click on „+“ or are deleted when I click on „-“ . If I have multiple rows for children then the converted xml looks like this :
    The correct xml for multiple data entries should look like this (this is from a xml scheme not made in LiveCycle) :
    Even if I copy the fields without creating a table, the converted xml is still a mess just like on the first image. Is there a way to show the xml from the PDF from correctly. I linked the xsd scheme that I am using for the PDF form: https://drive.google.com/file/d/0B30LkLSwYgB4SFN5bTkyLW1fOVU/edit?usp=sharing
    Best regards
    Ivica

  • XML DOM Parsing getAttributes() in J2SE 5.0 vs. J2SE 1.4

    I am experiencing the following problem, with the Node.getAttributes() function although the following code runs fine under Java 1.4, and getAttributes() returns the actual string attribute values:
                File xmlFile = new File(fileName);
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = factory.newDocumentBuilder();
                Document doc = builder.parse(xmlFile);
                // Begin analyzing XML
                Element root = doc.getDocumentElement();
                // Enumerate all children
                NodeList children = root.getChildNodes();
                    Node rootNode = null;
                    NodeList nodeList = children;
                    for (int R = 0; R < nodeList.getLength() ; R++)
                        if (nodeList.item(R).getNodeType() == Node.ELEMENT_NODE)
                            rootNode = nodeList.item(R);
                            System.out.println("> " + rootNode.getNodeName() + " - " + rootNode.getAttributes().toString());
                 In J2SE 5.0 the Node.getAttributes() returns the following:
    [email protected]d of returning then the actual attribute string (like in Java 1.4)!
    If it helps at all I am using DOM parser (as noticed above, org.w3c.dom)
    My assumption is that J2SE 5.0 returns an attribute map that is encoded differently then Java 1.4
    Thank you for your time & appreciate any help...

    The getAttributes method returns a NamedNodeMap.
    Iterate over the NamedNodeMap to get attribute values.
    Instead of rootNode.getAttributes().toString();
    NamedNodeMap map=rootNode.getAttributes().toString();
    for(int i=0; i<map.getLength(); i++){
    Node node=map.item(i);
    if(node.getNodeType()==Node.ATTRIBUTE_NODE)
    System.out.println("Attribute Node "+node.getNodeName()+ "has value "+ node.getNodeValue());
    }

  • JTree with XML Content

    Hi Friends,
    I am trying to create a JTree whose data will come from a XML Document. Whenever the tree is refreshed (There is a JPopupMenu on the tree which allows the user to call refresh), the tree must update itself with the underlying XML document. If there is any change in the xml doc, it must be reflected in the tree. However, the tree must not collapse when the refresh is called. For example if I have a tree like this:-
    + Root
        |
        ------ Child #1
        |            |
        |            -------- A
        |            |
        |            -------- B
        |
        +------ Child #2
        |
        ------- Child #3
                    |
                    -------- AAA
                    |
                    -------- BBBThe XML Document for the above tree structure would be:-
    <?xml version="1.0" encoding="UTF-8"?>
    <Root>Root
          <Child> Child #1
                <SubChild>A</SubChild>
                <SubChild>B</SubChild>
          </Child>
          <Child> Child #2
                <SubChild>AA</SubChild>
                <SubChild>BB</SubChild>
          </Child>
          <Child> Child #3
                <SubChild>AAA</SubChild>
                <SubChild>BBB</SubChild>
          </Child>
    </Root>Now if i add another node (CCC) in Child #3 (by adding another Subchild element in the XML document), and click refresh on the tree, the tree should look like:-
    + Root
        |
        ------ Child #1
        |            |
        |            -------- A
        |            |
        |            -------- B
        |
        +------ Child #2
        |
        ------- Child #3
                    |
                    -------- AAA
                    |
                    -------- BBB
                    |
                    -------- CCCHowever, if i am trying to reload the tree model, after reading the XML file, the whole tree collapses.
    Can anyone please help me out with this problem?
    Thanx a lot in advance,
    ~Debopam

    * XMLNode.java
    * Created on December 18, 2004, 4:25 PM
    package debopam.utils.xml;
    import java.util.Enumeration;
    import java.util.NoSuchElementException;
    import java.util.Vector;
    import javax.swing.tree.MutableTreeNode;
    import javax.swing.tree.TreeNode;
    import org.jdom.Element;
    * @author Debopam Ghoshal
    public class XMLNode implements MutableTreeNode
        private Element nodeElement;
        private XMLNode parent;
        /** optional user object */
        transient protected Object     userObject;
        /** true if the node is able to have children */
        protected boolean allowsChildren;
        /** array of children, may be null if this node has no children */
        protected Vector children;
         * An enumeration that is always empty. This is used when an enumeration
         * of a leaf node's children is requested.
        static public final Enumeration<TreeNode> EMPTY_ENUMERATION
                = new Enumeration<TreeNode>()
            public boolean hasMoreElements()
            { return false; }
            public TreeNode nextElement()
                throw new NoSuchElementException("No more elements");
        /** Creates a new instance of XMLNode */
        public XMLNode(Element nodeElement, boolean allowsChildren)
            this.nodeElement = nodeElement;
            this.allowsChildren = allowsChildren;
        public XMLNode(String nodeName, boolean allowsChildren)
            nodeElement = new Element(nodeName);
            this.allowsChildren = allowsChildren;
         * Creates and returns a forward-order enumeration of this node's
         * children.  Modifying this node's child array invalidates any child
         * enumerations created before the modification.
         * @return     an Enumeration of this node's children
        public java.util.Enumeration children()
            if(children == null)
                return EMPTY_ENUMERATION;
            else
                return children.elements();
         * Returns true if this node is allowed to have children.
         * @return     true if this node allows children, else false
        public boolean getAllowsChildren()
            return allowsChildren;
         * Determines whether or not this node is allowed to have children.
         * If <code>allows</code> is false, all of this node's children are
         * removed.
         * <p>
         * Note: By default, a node allows children.
         * @param     allows     true if this node is allowed to have children
        public void setAllowsChildren(boolean allows)
            if (allows != allowsChildren)
                allowsChildren = allows;
                if (!allowsChildren)
                    removeAllChildren();
         * Returns the child at the specified index in this node's child array.
         * @param     index     an index into this node's child array
         * @exception     ArrayIndexOutOfBoundsException     if <code>index</code>
         *                              is out of bounds
         * @return     the TreeNode in this node's child array at  the specified index
        public javax.swing.tree.TreeNode getChildAt(int index)
            if (children == null)
                throw new ArrayIndexOutOfBoundsException("node has no children");
            return (TreeNode)children.elementAt(index);
         * Returns the number of children of this node.
         * @return     an int giving the number of children of this node
        public int getChildCount()
            if (children == null)
                return 0;
            else
                return children.size();
         * Returns the index of the specified child in this node's child array.
         * If the specified node is not a child of this node, returns
         * <code>-1</code>.  This method performs a linear search and is O(n)
         * where n is the number of children.
         * @param     aChild     the TreeNode to search for among this node's children
         * @exception     IllegalArgumentException     if <code>aChild</code>
         *                                   is null
         * @return     an int giving the index of the node in this node's child
         *          array, or <code>-1</code> if the specified node is a not
         *          a child of this node
        public int getIndex(TreeNode aChild)
            if (aChild == null)
                throw new IllegalArgumentException("argument is null");
            if (!isNodeChild(aChild))
                return -1;
            return children.indexOf(aChild);     // linear search
         * Returns this node's parent or null if this node has no parent.
         * @return     this node's parent TreeNode, or null if this node has no parent
        public TreeNode getParent()
            return parent;
         * Removes <code>newChild</code> from its present parent (if it has a
         * parent), sets the child's parent to this node, and then adds the child
         * to this node's child array at index <code>childIndex</code>.
         * <code>newChild</code> must not be null and must not be an ancestor of
         * this node.
         * @param     newChild     the MutableTreeNode to insert under this node
         * @param     childIndex     the index in this node's child array
         *                    where this node is to be inserted
         * @exception     ArrayIndexOutOfBoundsException     if
         *                    <code>childIndex</code> is out of bounds
         * @exception     IllegalArgumentException     if
         *                    <code>newChild</code> is null or is an
         *                    ancestor of this node
         * @exception     IllegalStateException     if this node does not allow
         *                              children
         * @see     #isNodeDescendant
        public void insert(MutableTreeNode newChild, int childIndex)
            if (!allowsChildren)
                throw new IllegalStateException("node does not allow children");
            else if (newChild == null)
                throw new IllegalArgumentException("new child is null");
            else if (isNodeAncestor(newChild))
                throw new IllegalArgumentException("new child is an ancestor");
            MutableTreeNode oldParent = (MutableTreeNode)newChild.getParent();
            if (oldParent != null)
                oldParent.remove(newChild);
            newChild.setParent(this);
            if (children == null)
                children = new Vector();
            children.insertElementAt(newChild, childIndex);
        public boolean isLeaf()
            return !nodeElement.hasChildren();
         * Removes the child at the specified index from this node's children
         * and sets that node's parent to null. The child node to remove
         * must be a <code>MutableTreeNode</code>.
         * @param     childIndex     the index in this node's child array
         *                    of the child to remove
         * @exception     ArrayIndexOutOfBoundsException     if
         *                    <code>childIndex</code> is out of bounds
        public void remove(int childIndex)
            MutableTreeNode child = (MutableTreeNode)getChildAt(childIndex);
            children.removeElementAt(childIndex);
            child.setParent(null);
         * Removes <code>aChild</code> from this node's child array, giving it a
         * null parent.
         * @param     aChild     a child of this node to remove
         * @exception     IllegalArgumentException     if <code>aChild</code>
         *                         is null or is not a child of this node
        public void remove(MutableTreeNode aChild)
            if (aChild == null)
                throw new IllegalArgumentException("argument is null");
            if (!isNodeChild(aChild))
                throw new IllegalArgumentException("argument is not a child");
            remove(getIndex(aChild));     // linear search
         * Removes the subtree rooted at this node from the tree, giving this
         * node a null parent.  Does nothing if this node is the root of its
         * tree.
        public void removeFromParent()
            MutableTreeNode parent = (MutableTreeNode)getParent();
            if (parent != null)
                parent.remove(this);
         * Sets this node's parent to <code>newParent</code> but does not
         * change the parent's child array.  This method is called from
         * <code>insert()</code> and <code>remove()</code> to
         * reassign a child's parent, it should not be messaged from anywhere
         * else.
         * @param     newParent     this node's new parent
        public void setParent(MutableTreeNode mutableTreeNode)
            this.parent = parent;
        public void setUserObject(Object obj)
            this.userObject = obj;
        public Element getXMLElement()
            return this.nodeElement;
        public String toString()
            return this.nodeElement.getTextTrim();
         * Returns true if <code>anotherNode</code> is an ancestor of this node
         * -- if it is this node, this node's parent, or an ancestor of this
         * node's parent.  (Note that a node is considered an ancestor of itself.)
         * If <code>anotherNode</code> is null, this method returns false.  This
         * operation is at worst O(h) where h is the distance from the root to
         * this node.
         * @see          #isNodeDescendant
         * @see          #getSharedAncestor
         * @param     anotherNode     node to test as an ancestor of this node
         * @return     true if this node is a descendant of <code>anotherNode</code>
        public boolean isNodeAncestor(TreeNode anotherNode)
            if (anotherNode == null)
                return false;
            TreeNode ancestor = this;
            do
                if (ancestor == anotherNode)
                    return true;
            } while((ancestor = ancestor.getParent()) != null);
            return false;
         * Returns true if <code>aNode</code> is a child of this node.  If
         * <code>aNode</code> is null, this method returns false.
         * @return     true if <code>aNode</code> is a child of this node; false if
         *            <code>aNode</code> is null
        public boolean isNodeChild(TreeNode aNode)
            boolean retval;
            if (aNode == null)
                retval = false;
            else
                if (getChildCount() == 0)
                    retval = false;
                else
                    retval = (aNode.getParent() == this);
            return retval;
         * Removes all of this node's children, setting their parents to null.
         * If this node has no children, this method does nothing.
        public void removeAllChildren()
            for (int i = getChildCount()-1; i >= 0; i--)
                remove(i);
         * Removes <code>newChild</code> from its parent and makes it a child of
         * this node by adding it to the end of this node's child array.
         * @see          #insert
         * @param     newChild     node to add as a child of this node
         * @exception     IllegalArgumentException    if <code>newChild</code>
         *                              is null
         * @exception     IllegalStateException     if this node does not allow
         *                              children
        public void add(MutableTreeNode newChild)
            if(newChild != null && newChild.getParent() == this)
                insert(newChild, getChildCount() - 1);
            else
                insert(newChild, getChildCount());
         * Indicates whether some other object is "equal to" this one.
         * @param   obj   the reference object with which to compare.
         * @return  <code>true</code> if this object is the same as the obj
         *          argument; <code>false</code> otherwise.
        public boolean equals(XMLNode node)
            boolean retValue;
            retValue = (this.getXMLElement().getTextTrim().equals(node.getXMLElement().getTextTrim())) &&
                    (this.getXMLElement().getParent().getTextTrim().equals(node.getXMLElement().getParent().getTextTrim()));
            return retValue;
    * XMLTreeModel.java
    * Created on December 20, 2004, 11:29 AM
    package debopam.utils.xml;
    import java.io.File;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.Serializable;
    import java.util.EventListener;
    import java.util.List;
    import java.util.Vector;
    import javax.swing.event.EventListenerList;
    import javax.swing.event.TreeModelEvent;
    import javax.swing.event.TreeModelListener;
    import javax.swing.tree.TreeModel;
    import javax.swing.tree.TreePath;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    * @author Debopam Ghoshal
    public class XMLTreeModel implements TreeModel
        private XMLNode rootNode;
        private String xmlFileName;
        private Document xmlDocument;
        /** Listeners. */
        protected EventListenerList listenerList = new EventListenerList();
         * Determines how the <code>isLeaf</code> method figures
         * out if a node is a leaf node. If true, a node is a leaf
         * node if it does not allow children. (If it allows
         * children, it is not a leaf node, even if no children
         * are present.) That lets you distinguish between <i>folder</i>
         * nodes and <i>file</i> nodes in a file system, for example.
         * <p>
         * If this value is false, then any node which has no
         * children is a leaf node, and any node may acquire
         * children.
         * @see TreeNode#getAllowsChildren
         * @see TreeModel#isLeaf
         * @see #setAsksAllowsChildren
        protected boolean asksAllowsChildren;
        /** Creates a new instance of XMLTreeModel */
        public XMLTreeModel(String xmlFileName, boolean asksAllowsChildren)
            this.xmlFileName = xmlFileName;
            this.asksAllowsChildren = asksAllowsChildren;
            loadXMLDocument();
            rootNode = makeRootNode();
        public XMLTreeModel(String xmlFileName)
            this(xmlFileName, false);
        private void loadXMLDocument()
            System.out.println("loading xml document...");
            try
                this.xmlDocument = null;
                this.xmlDocument = new SAXBuilder().build(new File(xmlFileName));
            catch(Exception x)
                System.out.println("Error while loading XML Document.");
                x.printStackTrace();
        private XMLNode makeRootNode()
            XMLNode root = new XMLNode(xmlDocument.getRootElement(), true);
            addChildren(root, xmlDocument.getRootElement());
            return root;
        private void addChildren(XMLNode parentXMLNode, Element element)
            List children = element.getChildren();
            for(int i = 0; i < children.size(); i++)
                Element childElement = (Element)children.get(i);
                XMLNode childNode = new XMLNode(childElement, true);
                parentXMLNode.add(childNode);
                addChildren(childNode, childElement);
         * Sets whether or not to test leafness by asking getAllowsChildren()
         * or isLeaf() to the TreeNodes.  If newvalue is true, getAllowsChildren()
         * is messaged, otherwise isLeaf() is messaged.
        public void setAsksAllowsChildren(boolean newValue)
            asksAllowsChildren = newValue;
         * Tells how leaf nodes are determined.
         * @return true if only nodes which do not allow children are
         *         leaf nodes, false if nodes which have no children
         *         (even if allowed) are leaf nodes
         * @see #asksAllowsChildren
        public boolean asksAllowsChildren()
            return asksAllowsChildren;
         * Returns the child of <I>parent</I> at index <I>index</I> in the parent's
         * child array.  <I>parent</I> must be a node previously obtained from
         * this data source. This should not return null if <i>index</i>
         * is a valid index for <i>parent</i> (that is <i>index</i> >= 0 &&
         * <i>index</i> < getChildCount(<i>parent</i>)).
         * @param   parent  a node in the tree, obtained from this data source
         * @return  the child of <I>parent</I> at index <I>index</I>
        public Object getChild(Object parent, int index)
            return ((XMLNode)parent).getChildAt(index);
         * Returns the number of children of <I>parent</I>.  Returns 0 if the node
         * is a leaf or if it has no children.  <I>parent</I> must be a node
         * previously obtained from this data source.
         * @param   parent  a node in the tree, obtained from this data source
         * @return  the number of children of the node <I>parent</I>
        public int getChildCount(Object parent)
            return ((XMLNode)parent).getChildCount();
         * Returns the index of child in parent.
         * If either the parent or child is <code>null</code>, returns -1.
         * @param parent a note in the tree, obtained from this data source
         * @param child the node we are interested in
         * @return the index of the child in the parent, or -1
         *    if either the parent or the child is <code>null</code>
        public int getIndexOfChild(Object parent, Object child)
            if(parent == null || child == null)
                return -1;
            return ((XMLNode)parent).getIndex((XMLNode)child);
         * Sets the root to <code>root</code>. A null <code>root</code> implies
         * the tree is to display nothing, and is legal.
        public void setRoot(XMLNode rootNode)
            Object oldRoot = this.rootNode;
            this.rootNode = rootNode;
            if (rootNode == null && oldRoot != null)
                fireTreeStructureChanged(this, null);
            else
                nodeStructureChanged(rootNode);
         * Returns the root of the tree.  Returns null only if the tree has
         * no nodes.
         * @return  the root of the tree
        public Object getRoot()
            return rootNode;
         * Returns whether the specified node is a leaf node.
         * The way the test is performed depends on the
         * <code>askAllowsChildren</code> setting.
         * @param node the node to check
         * @return true if the node is a leaf node
         * @see #asksAllowsChildren
         * @see TreeModel#isLeaf
        public boolean isLeaf(Object node)
            if(asksAllowsChildren)
                return !((XMLNode)node).getAllowsChildren();
            return ((XMLNode)node).isLeaf();
         * This sets the user object of the TreeNode identified by path
         * and posts a node changed.  If you use custom user objects in
         * the TreeModel you're going to need to subclass this and
         * set the user object of the changed node to something meaningful.
        public void valueForPathChanged(TreePath path, Object newValue)
            XMLNode aNode = (XMLNode)path.getLastPathComponent();
            aNode.setUserObject(newValue);
            nodeChanged(aNode);
         * Invoked this to insert newChild at location index in parents children.
         * This will then message nodesWereInserted to create the appropriate
         * event. This is the preferred way to add children as it will create
         * the appropriate event.
        public void insertNodeInto(XMLNode newChild, XMLNode parent, int index)
            parent.insert(newChild, index);
            int[] newIndexs = new int[1];
            newIndexs[0] = index;
            nodesWereInserted(parent, newIndexs);
         * Message this to remove node from its parent. This will message
         * nodesWereRemoved to create the appropriate event. This is the
         * preferred way to remove a node as it handles the event creation
         * for you.
        public void removeNodeFromParent(XMLNode node)
            XMLNode parent = (XMLNode)node.getParent();
            if(parent == null)
                throw new IllegalArgumentException("node does not have a parent.");
            int[] childIndex = new int[1];
            Object[] removedArray = new Object[1];
            childIndex[0] = parent.getIndex(node);
            parent.remove(childIndex[0]);
            removedArray[0] = node;
            nodesWereRemoved(parent, childIndex, removedArray);
         * Invoke this method after you've changed how node is to be
         * represented in the tree.
        public void nodeChanged(XMLNode node)
            if(listenerList != null && node != null)
                XMLNode parent = (XMLNode)node.getParent();
                if(parent != null)
                    int        anIndex = parent.getIndex(node);
                    if(anIndex != -1)
                        int[] cIndexs = new int[1];
                        cIndexs[0] = anIndex;
                        nodesChanged(parent, cIndexs);
                else if (node == getRoot())
                    nodesChanged(node, null);
         * Invoke this method if you've modified the TreeNodes upon which this
         * model depends.  The model will notify all of its listeners that the
         * model has changed.
        public void reload()
            loadXMLDocument();
            XMLNode tempRootNode = makeRootNode();
            if(!tempRootNode.equals(rootNode))
                // Means that the root node itself has changed.
                System.out.println("Root node changed");
                reload(rootNode);
            //else
                checkForNodesChanged(tempRootNode, rootNode);
         * Invoke this method if you've modified the TreeNodes upon which this
         * model depends.  The model will notify all of its listeners that the
         * model has changed below the node <code>node</code> (PENDING).
        public void reload(XMLNode node)
            if(node != null)
                fireTreeStructureChanged(this, getPathToRoot(node), null, null);
         * Invoke this method after you've inserted some TreeNodes into
         * node.  childIndices should be the index of the new elements and
         * must be sorted in ascending order.
        public void nodesWereInserted(XMLNode node, int[] childIndices)
            if(listenerList != null && node != null && childIndices != null
                    && childIndices.length > 0)
                int               cCount = childIndices.length;
                Object[]          newChildren = new Object[cCount];
                for(int counter = 0; counter < cCount; counter++)
                    newChildren[counter] = node.getChildAt(childIndices[counter]);
                fireTreeNodesInserted(this, getPathToRoot(node), childIndices,
                        newChildren);
         * Invoke this method after you've removed some TreeNodes from
         * node.  childIndices should be the index of the removed elements and
         * must be sorted in ascending order. And removedChildren should be
         * the array of the children objects that were removed.
        public void nodesWereRemoved(XMLNode node, int[] childIndices,
                Object[] removedChildren)
            if(node != null && childIndices != null)
                fireTreeNodesRemoved(this, getPathToRoot(node), childIndices,
                        removedChildren);
         * Invoke this method after you've changed how the children identified by
         * childIndicies are to be represented in the tree.
        public void nodesChanged(XMLNode node, int[] childIndices)
            if(node != null)
                if (childIndices != null)
                    int cCount = childIndices.length;
                    if(cCount > 0)
                        Object[] cChildren = new Object[cCount];
                        for(int counter = 0; counter < cCount; counter++)
                            cChildren[counter] = node.getChildAt
                                    (childIndices[counter]);
                        fireTreeNodesChanged(this, getPathToRoot(node),
                                childIndices, cChildren);
                else if (node == getRoot())
                    fireTreeNodesChanged(this, getPathToRoot(node), null, null);
         * Invoke this method if you've totally changed the children of
         * node and its childrens children...  This will post a
         * treeStructureChanged event.
        public void nodeStructureChanged(XMLNode node)
            if(node != null)
                fireTreeStructureChanged(this, getPathToRoot(node), null, null);
         * Builds the parents of node up to and including the root node,
         * where the original node is the last element in the returned array.
         * The length of the returned array gives the node's depth in the
         * tree.
         * @param aNode the TreeNode to get the path for
        public XMLNode[] getPathToRoot(XMLNode aNode)
            return getPathToRoot(aNode, 0);
         * Builds the parents of node up to and including the root node,
         * where the original node is the last element in the returned array.
         * The length of the returned array gives the node's depth in the
         * tree.
         * @param aNode  the TreeNode to get the path for
         * @param depth  an int giving the number of steps already taken towards
         *        the root (on recursive calls), used to size the returned array
         * @return an array of TreeNodes giving the path from the root to the
         *         specified node
        protected XMLNode[] getPathToRoot(XMLNode aNode, int depth)
            XMLNode[] retNodes;
            // This method recurses, traversing towards the root in order
            // size the array. On the way back, it fills in the nodes,
            // starting from the root and working back to the original node.
            /* Check for null, in case someone passed in a null node, or
               they passed in an element that isn't rooted at root. */
            if(aNode == null)
                if(depth == 0)
                    return null;
                else
                    retNodes = new XMLNode[depth];
            else
                depth++;
                if(aNode == rootNode)
                    retNodes = new XMLNode[depth];
                else
                    retNodes = getPathToRoot((XMLNode)aNode.getParent(), depth);
                retNodes[retNodes.length - depth] = aNode;
            return retNodes;
        //  Events
         * Adds a listener for the TreeModelEvent posted after the tree changes.
         * @see     #removeTreeModelListener
         * @param   l       the listener to add
        public void addTreeModelListener(TreeModelListener l)
            listenerList.add(TreeModelListener.class, l);
         * Removes a listener previously added with <B>addTreeModelListener()</B>.
         * @see     #addTreeModelListener
         * @param   l       the listener to remove
        public void removeTreeModelListener(TreeModelListener l)
            listenerList.remove(TreeModelListener.class, l);
         * Returns an array of all the tree model listeners
         * registered on this model.
         * @return all of this model's <code>TreeModelListener</code>s
         *         or an empty
         *         array if no tree model listeners are currently registered
         * @see #addTreeModelListener
         * @see #removeTreeModelListener
         * @since 1.4
        public TreeModelListener[] getTreeModelListeners()
            return (TreeModelListener[])listenerList.getListeners(
                    TreeModelListener.class);
         * Notifies all listeners that have registered interest for
         * notification on this event type.  The event instance
         * is lazily created using the parameters passed into
         * the fire method.
         * @param source the node being changed
         * @param path the path to the root node
         * @param childIndices the indices of the changed elements
         * @param children the changed elements
         * @see EventListenerList
        protected void fireTreeNodesChanged(Object source, Object[] path,
                int[] childIndices,
                Object[] children)
            // Guaranteed to return a non-null array
            Object[] listeners = listenerList.getListenerList();
            TreeModelEvent e = null;
            // Process the listeners last to first, notifying
            // those that are interested in this event
            for (int i = listeners.length-2; i>=0; i-=2)
                if (listeners==TreeModelListener.class)
    // Lazily create the event:
    if (e == null)
    e = new TreeModelEvent(source, path,
    childIndices, children);
    ((TreeModelListener)listeners[i+1]).treeNodesChanged(e);
    * Notifies all listeners that have registered interest for
    * notification on this event type. The event instance

  • XML - ExportDocument problem

    I'm exporting a xml document that I'm creating dynamically in my application.
    I'm having the following problems (working with 30M.2).
    1)
    It's not possible to edit a DTD (or creating one run time) so I have to write a
    template doc XML to have it.
    I'm afraid that this is a costraint on the DOM1 so ...
    2)
    Once I complete the construction of the doc, I need to write it down (let's say
    on a file, but could be also in memory to send it on http).
    When I write it (using exportdocument function) I just find the root element
    with all it's children, no haeder (<?xml version="1.0" ?><!DOCUMENT ...>) so I
    cannot have the dtd information on the stream, and cannot enforce validation of
    the doc when someone read it afterwards.
    I admit I'm new of the subject, but or I miss something or something is wrong:
    having trouble to get a dtd and not being able to code it's information.
    Anyone has some ideas?
    TIA
    Luca

    I'm interested in DTDs. For example in the reported situation, why, if you
    know you've created a valid XML document would you want to give a DTD to
    someone at the other end? If someone has a DTD at the other end and want to
    use it to validate your XML then fine but if you create the XML and are
    controlling the format then wouldn't they just assume the XML correct if the
    DTD wasn't being controlled by a 3rd party or themselves?
    DTDs don't help you create a document but just validate it, I'd thought. If
    there is more to DTDs I'd appreciate if someone felt like ellaborating.
    Thanks.
    Matthew Middleton
    OrYx Software Consultant
    Lawpoint Pty. Limited
    A Solution 6 Company
    Ph: +61 2 9239 4972
    Fax: +61 2 9239 4900
    E-mail matthewmwriteme.com
    ----- Original Message -----
    From: Luca Gioppo <Luca.GioppoCSI.IT>
    To: <forte-userslists.xpedior.com>
    Sent: Tuesday, August 08, 2000 8:24 PM
    Subject: (forte-users) XML - ExportDocument problem
    >
    >
    I'm exporting a xml document that I'm creating dynamically in myapplication.
    I'm having the following problems (working with 30M.2).
    1)
    It's not possible to edit a DTD (or creating one run time) so I have towrite a
    template doc XML to have it.
    I'm afraid that this is a costraint on the DOM1 so ...
    2)
    Once I complete the construction of the doc, I need to write it down(let's say
    on a file, but could be also in memory to send it on http).
    When I write it (using exportdocument function) I just find the rootelement
    with all it's children, no haeder (<?xml version="1.0" ?><!DOCUMENT ...>)so I
    cannot have the dtd information on the stream, and cannot enforcevalidation of
    the doc when someone read it afterwards.
    I admit I'm new of the subject, but or I miss something or something iswrong:
    having trouble to get a dtd and not being able to code it's information.
    Anyone has some ideas?
    TIA
    Luca
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

  • UIX-XML BC4J - Unexpected errors using paths and DeltaTree on a particular UIX page

    We are using a PageDescription to dynamically change a UIX tree using the DeltaTree technique described in the Dynamic Structure for For UIX Pages chapter of the UIX Developers Guide.
    We search for a particular node using PathUtils.FindPathWithNodeID(RenderingContext context, UINode from, java.lang.String nodeID), but this fails when the page contains nested ViewObjectScopes.
    The method throws a NullPointerException, and the render fails:
    29/08/02 9.08 Valutazioni: java.lang.NullPointerException
         oracle.cabo.ui.data.DataObjectList oracle.cabo.ui.collection.DataObjectListNodeList.getDataObjectList(oracle.cabo.ui.RenderingContext)
         int oracle.cabo.ui.collection.DataObjectListNodeList.size(oracle.cabo.ui.RenderingContext)
         int oracle.cabo.ui.BaseUINode.getIndexedChildCount(oracle.cabo.ui.RenderingContext)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         oracle.cabo.ui.path.Path oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         oracle.cabo.ui.path.Path oracle.cabo.ui.path.PathUtils.findPathWithNodeID(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.UINode, java.lang.String)
         oracle.cabo.ui.UINode com.websiteitalia.wsdk.uix.pageflow.PageFlowManager.getRootUINode()
         oracle.cabo.ui.UINode oracle.cabo.servlet.ui.UINodePageDescriptionProxy.getRootUINode()
         oracle.cabo.ui.UINode oracle.cabo.servlet.ui.UINodePageRenderer.getRootUINode(oracle.cabo.servlet.BajaContext, oracle.cabo.ui.RenderingContext, oracle.cabo.servlet.Page)
         oracle.cabo.ui.UINode oracle.cabo.servlet.ui.HTMLUINodePageRenderer.getRootUINode(oracle.cabo.servlet.BajaContext, oracle.cabo.ui.RenderingContext, oracle.cabo.servlet.Page)
         void oracle.cabo.servlet.ui.UINodePageRenderer.renderPage(oracle.cabo.servlet.BajaContext, oracle.cabo.servlet.Page)
         void oracle.cabo.servlet.AbstractPageBroker.renderPage(oracle.cabo.servlet.BajaContext, oracle.cabo.servlet.Page)
         oracle.cabo.servlet.Page oracle.cabo.servlet.PageBrokerHandler.handleRequest(oracle.cabo.servlet.BajaContext)
         void oracle.cabo.servlet.BajaServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    We found the element of the UIX page that causes the problem:
    <bc4j:viewObjectScope name="ElementsView" >
    <contents>
         <bc4j:rowScope name="NewElement" >
         <contents>     
              <bc4j:region automatic="false" >
                   <bc4j:key>
                        <bc4j:rowKey name="keyElement"/>
                   </bc4j:key>
                   <contents>
                        <bc4j:attrScope name="FlgState">
                        <contents>
                             <messageChoice name="FlgState" prompt="State" >
                                  <boundAttribute name="selectedValue">
                                       <concat>
                                            <bc4j:attrProperty name="value"/>
                                            <fixed text=""/>
                                       </concat>
                                  </boundAttribute>
                                  <contents>
                                       <!-- This is the nested vo scope causing the error -->
                                       <bc4j:viewObjectScope name="DecodeStateView" >
                                       <contents data:childData="list@DecodeState">
                                            <option data:value="StateCode"
                                                 data:text="StateDescription"/>
                                       </contents>
                                       </bc4j:viewObjectScope>
                                  </contents>
                             </messageChoice>
                        </contents>
                        </bc4j:attrScope>
                   </contents>
              </bc4j:region>
         </contents>
         </bc4j:rowScope>
    </contents>
    </bc4j:viewObjectScope>
    This usage of nested view object scopes has been explained in reply of a previous post, How to databind the children of a UIX XML choice, and before ours attempts to modify the tree it worked fine. Removing the nested view object scope the page makes the page render correctly, but we need it to retrieve the description of its state.
    We get the same behaviour (and a much similar stack trace, with the same oracle.cabo.ui.data.DataObjectList oracle.cabo.ui.collection.DataObjectListNodeList.getDataObjectList (oracle.cabo.ui.RenderingContext) throwing a NullPointerException) if we use NodeUtils.createPreorderDescendentAttributeEnumeration method instead of PathUtils.

    It's a bug in the DataObjectListNodeList class that's up at the top of
    the stack. It's been fixed for 9.0.3. The bit of XML that's triggering
    it isn't the <viewObjectScope>s, but the "data:childData".
    I believe you can workaround this bug by not passing a null RenderingContext to
    findPathWithNodeID(). Now, you don't have a real RenderingContext, and we
    don't especially need one - "null" is legit here, but I think if
    you just pass "new oracle.cabo.ui.RootRenderingContext()" then you'll
    get around this bug.

Maybe you are looking for

  • Toshiba Satellite P870 upgraded to Win 8.1 does not boot

    I have a Toshiba Satellite P870 with Win 8 preinstalled. Soon after upgrade to Win 8.1 and basically successful removal of "watermark error" (secure boot activated) the machine stopped booting completely: after pressing the power button ventilator so

  • Tried to upgrade Acrobat 9 Pro, somehow got saddled with Reader X

    Just what is says on the tin: I've been schtucked by the updater. Grrrr. So what I need to know is: Whom do I notify that they have a bad routine in the updater How do get back to Acrobat Pro, of whatever version I'm entilted to as a CS5 owner. I'm s

  • Fiscal year for consolidation

    Hi All, Anyone knows how to maintain the fiscal year for consolidation ? I'm trying to post some transaction and I hit this error message "No postable ledger/FY variant found for cons unit ICFNBT (dim FN)" Thanks, Melissa

  • How define database performance?

    Hi all I have a question about performance. I have an Oracle database installed on Xeon server 1. I want to know parameters of my server. How many processors it has? What is it's RAM and other parameters. From Linux, with which command I can get info

  • Impedance Locus - Reactance vs Resistance Plot

    Hi, I am new to using MultiSim, and so still finding my way around. I have a circuit (consisting of basically parallel RC) and would like to do an AC analysis of the same. I have seen that MultiSim provides several features for these under Simulate -