commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject Commons Config : various XML config querying issues
Date Tue, 27 Sep 2005 14:31:45 GMT
Hi,

Given an XML structure as follows;

<a>
  <b x="1" y="2">
    <c>
      <d>1</role>
      <d>2</role>
      <d>3</role>
    </c>
    <e>
      <f>1</f>
      <f>2</f>
    </e>
  </b>

  <b x="3" y="4">
    <c>
      <d>1</role>
      <d>2</role>
      <d>3</role>
    </c>
    <e>
      <f>1</f>
      <f>2</f>
    </e>
  </b>
</a>

I am having 2 issues.

Firstly, I cannot under any permutation whatsoever manage to get a non-null result for 

Object o = config.getProperty("b");

or 

Object o = config.getProperty("a.b");

However, I _can_ get a result when I know the index 

Object o = config.getProperty("b(0)[@x]");

In practice however, I do not know the index, and not being able to query just "b" means I
have no way of finding out how many indices there are.

Furthermore, if I know the B I want to get the @y for, and I know this because I have the
b[@x], how do I express this? In xPath I would do something like

String prop = config.getProperty("b[@x='1'][@y]);

Other queries I would like to do would be to get a list of d's or a list of f's but only within
the context of a particular B which I can identify by b[@x] _not_ by an index which means
nothing.

Your advice appreciated, Allistair.


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT> <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLACK> 
Disclaimer:  The information contained within this e-mail is confidential and may be privileged.
This email is intended solely for the named recipient only; if you are not authorised you
must not disclose, copy, distribute, or retain this message or any part of it. If you have
received this message in error please contact the sender at once so that we may take the appropriate
action and avoid troubling you further.  Any views expressed in this message are those of
the individual sender.  QAS Limited has the right lawfully to record, monitor and inspect
messages between its employees and any third party.  Your messages shall be subject to such
lawful supervision as QAS Limited deems to be necessary in order to protect its information,
its interests and its reputation.  

Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS Limited cannot guarantee
that attachments are virus free or compatible with your systems and does not accept any liability
in respect of viruses or computer problems experienced.
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message