[jdom-interest] Accessing the Text for <Get Name="Jerry">BLACK</Get> and the rest of the list.

Martinez, Will Will_Martinez at cable.comcast.com
Thu Nov 6 16:26:04 PST 2008


good morning,
I have this xml file that I need to access the Text "Dish."  I have
listed what  quit works and does not work.  Please see attached file.

<CatParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> ">
    <CatInputs>
        <InputValue Name="Food">
            <From>MotherCat</From>
            <Where>
                <On>Dish</On>
            </Where>
            <Get Name="Tom">WHITE</Get>
            <Get Name="Jerry">BLACK</Get>
            <Get Name="Sam">GREY</Get>
        </InputValue>

descendant_2 = Where
secondDescendant_1 = On
descendant_3 = Get
attributeValue = Name

With this syntax, I am able to get at Dish, but that is because an
attribute is not associated with
the element On.
String secondDescendant1Data =
subParentElement.getChild(descendant_2).getChildText(secondDescendant_1)
;
System.out.print("\n secondDescendant1 Text: " +
secondDescendant1Data);// child's descendant2 Where Dish

I get WHITE with this, but I do not have an API/library component ti get
to the next element  BLACK.
String secondDescendant3Data =
subParentElement.getChild(descendant_3).getValue();//This works!

I get Tom with this syntax;
String secondDescendant3Data =
subParentElement.getChild(descendant_3).getAttribute(attributeValue).get
Value();


With this syntax I get the actual attribute: Name;
String secondDescendant3Data =
subParentElement.getChild(descendant_3).getAttribute(attributeValue).get
Name();//Name

I need syntax like this, but there is none;
String secondDescendant3Data =
subParentElement.getChild(descendant_3).getAttributeValue(attributeValue
).getText(of Tom);

But there isn't an API method that works!
Might you be able to suggest a solution?

 

Thank you.  I would appreciate your comments.

will

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20081106/711bc2bb/attachment.htm


More information about the jdom-interest mailing list