commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [Configuration] How do I traverse an XML configuration?
Date Fri, 07 Apr 2017 20:33:11 GMT
On Fri, Apr 7, 2017 at 12:52 PM, Oliver Heger <oliver.heger@oliver-heger.de>
wrote:

>
>
> Am 07.04.2017 um 21:43 schrieb Gary Gregory:
> > On Fri, Apr 7, 2017 at 12:40 PM, Oliver Heger <
> oliver.heger@oliver-heger.de>
> > wrote:
> >
> >>
> >>
> >> Am 07.04.2017 um 19:09 schrieb Woonsan Ko:
> >>> On Fri, Apr 7, 2017 at 2:05 AM, Gary Gregory <garydgregory@gmail.com>
> >> wrote:
> >>>> I might have hit pay-dirt
> >>>> with org.apache.commons.configuration2.BaseHierarchicalConfiguration.
> >> getNodeModel()...
> >>> Sounds great and thanks for sharing the pay-dirt!
> >>
> >> Yes, that's the way to go: From the node model you can obtain the root
> >> node via getRootNode(). This returns an ImmutableNode which has methods
> >> to query all children or other properties of the node.
> >>
> >
> > The only drawback is that these are all calls on classes, not interfaces.
> >
> > I wonder if it worth adding an interface for node traversal to hide most
> of
> > the guts?
>
> Internally, hierarchical configurations use the NodeHandler interface to
> abstract over the concrete node model. That way other hierarchical
> structures can be handled.
>
> However, the most important use case is to access hierarchical
> structures via the Configuration interface. Node traversing is a rather
> low-level operation, and so far there has not been the need to offer
> better support for this.
>

All right, then let's leave things as they are.

Thank you,
Gary


>
> Oliver
>
> >
> > Gary
> >
> >
> >>
> >> Oliver
> >>
> >>>
> >>> Woonsan
> >>>
> >>>>
> >>>> Gary
> >>>>
> >>>> On Thu, Apr 6, 2017 at 9:39 PM, Gary Gregory <garydgregory@gmail.com>
> >> wrote:
> >>>>
> >>>>> Thanks Woonsan, but using DOM defeats the purpose of using Commons
> >> Config
> >>>>> :-(
> >>>>>
> >>>>> I was hopping to get access to some object model where I do not
have
> to
> >>>>> worry about collapsing white space and other XML messy stuff.
> >>>>>
> >>>>> getKeys() gives me ALL the keys for the whole document, all I need
> >>>>> something like getChildKeys() for the current config. Then I can,
> >>>>> presumably, get make a config out of each child and keep going.
> >>>>>
> >>>>> Is that not possible?
> >>>>>
> >>>>> If I have to use DOM, then I do not need Commons Config :-(
> >>>>>
> >>>>> Gary
> >>>>>
> >>>>> On Thu, Apr 6, 2017 at 8:46 PM, Woonsan Ko <woonsan@apache.org>
> wrote:
> >>>>>
> >>>>>> If you meant to traverse dom tree of the xml document, perhaps
you
> can
> >>>>>> use XMLConfiguration#getDocument().
> >>>>>>
> >>>>>> Regards,
> >>>>>>
> >>>>>> Woonsan
> >>>>>>
> >>>>>> On Thu, Apr 6, 2017 at 11:00 PM, Gary Gregory <
> garydgregory@gmail.com
> >>>
> >>>>>> wrote:
> >>>>>>> Hi All:
> >>>>>>>
> >>>>>>> I have an XMLConfiguration and I need to get all of the
child nodes
> >> from
> >>>>>>> the root. Once I have each node I need to get the children
of each.
> >>>>>> This is
> >>>>>>> not about preorder or postorder or depth-first searches.
I just
> need
> >> to
> >>>>>> be
> >>>>>>> able to navigate the tree.
> >>>>>>>
> >>>>>>> Clues?
> >>>>>>>
> >>>>>>> Thank you,
> >>>>>>> Gary
> >>>>>>>
> >>>>>>> --
> >>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> >>>>>>> Java Persistence with Hibernate, Second Edition
> >>>>>>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?
> >>>>>> ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&link
> >>>>>> Code=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2
> b8>
> >>>>>>>
> >>>>>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=
> >>>>>> am2&o=1&a=1617290459>
> >>>>>>> JUnit in Action, Second Edition
> >>>>>>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?
> >>>>>> ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&link
> >>>>>> Code=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de4
> >> 18%22>
> >>>>>>>
> >>>>>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=
> >>>>>> am2&o=1&a=1935182021>
> >>>>>>> Spring Batch in Action
> >>>>>>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?
> >>>>>> ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&link
> >>>>>> Code=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Bli
> >>>>>> nk_id%7D%7D%22%3ESpring+Batch+in+Action>
> >>>>>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=
> >>>>>> am2&o=1&a=1935182951>
> >>>>>>> Blog: http://garygregory.wordpress.com
> >>>>>>> Home: http://garygregory.com/
> >>>>>>> Tweet! http://twitter.com/GaryGregory
> >>>>>>
> >>>>>> ------------------------------------------------------------
> ---------
> >>>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >>>>>> For additional commands, e-mail: dev-help@commons.apache.org
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> >>>>> Java Persistence with Hibernate, Second Edition
> >>>>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_
> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
> >> linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2
> b8>
> >>>>>
> >>>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=
> garygregory-20&l=am2&o=1&a=
> >> 1617290459>
> >>>>> JUnit in Action, Second Edition
> >>>>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_
> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
> >> linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de4
> 18%22
> >>>
> >>>>>
> >>>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=
> garygregory-20&l=am2&o=1&a=
> >> 1935182021>
> >>>>> Spring Batch in Action
> >>>>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_
> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
> >> linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
> >> 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
> >>>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=
> garygregory-20&l=am2&o=1&a=
> >> 1935182951>
> >>>>> Blog: http://garygregory.wordpress.com
> >>>>> Home: http://garygregory.com/
> >>>>> Tweet! http://twitter.com/GaryGregory
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> >>>> Java Persistence with Hibernate, Second Edition
> >>>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_
> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
> >> linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2
> b8>
> >>>>
> >>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=
> garygregory-20&l=am2&o=1&a=
> >> 1617290459>
> >>>> JUnit in Action, Second Edition
> >>>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_
> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
> >> linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de4
> 18%22
> >>>
> >>>>
> >>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=
> garygregory-20&l=am2&o=1&a=
> >> 1935182021>
> >>>> Spring Batch in Action
> >>>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_
> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
> >> linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
> >> 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
> >>>> <http:////ir-na.amazon-adsystem.com/e/ir?t=
> garygregory-20&l=am2&o=1&a=
> >> 1935182951>
> >>>> Blog: http://garygregory.wordpress.com
> >>>> Home: http://garygregory.com/
> >>>> Tweet! http://twitter.com/GaryGregory
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >>> For additional commands, e-mail: dev-help@commons.apache.org
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: dev-help@commons.apache.org
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message