Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: XPath query for elements rather than attributes


Message #1 by Colin.Montgomery@C... on Fri, 17 May 2002 12:48:03 +0100
Hi,

I've got the following XPath query working for the following XML:

/Combos/Combo[@level = '5' and @matchlvl1 = 'Jurisdiction' and matchlvl2 
'UK' ... ]

<Combos>
  <Combo level="5" matchlvl1="Jurisdiction" matchlvl2="UK" matchlvl3="Case
Law" matchlvl4="England" matchlvl5="">
	<option>- - Please choose an option - -</option>
	<option>Citations</option>
	<option>Judgement</option>
	<option>Legislation</option>
	<option>General</option>
	<option>Updating</option>
	<option>Courts</option>
  </Combo>
</Combos>

I've changed the format of the XML so the attributes are now elements -
because I feel it's clearer and have heard many opinions that it's the
correct way to do things.

Now the XML is:

<Combos>
  <Combo>
	<level>3</level>
	<matchlvl1>Jurisdiction</matchlvl1>
	<matchlvl2>UK</matchlvl2>
	<matchlvl3></matchlvl3>
	<matchlvl4></matchlvl4>
	<matchlvl5></matchlvl5>
	<option>- - Please choose an option - -</option>
	<option>Case Law</option>
	<option>Legislation</option>
	<option>Miscellaneous</option>
  </Combo>
</Combos>

Problem is I can't find any examples of this sort of searching/Xpath on the
net.  What I want is a nodelist of <Combo> nodes where <level> = x AND
<matchlvl1> = x AND <matchlvl2> = x     etc.

Can anybody help out?

Thanks,
Col


*******

This message and any attachment are confidential and may be privileged or otherwise protected from disclosure.  If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system.  If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.

For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.

Message #2 by Colin.Montgomery@C... on Fri, 17 May 2002 12:49:08 +0100
apologies - wrong list

-----Original Message-----
From: Colin.Montgomery@C...
[mailto:Colin.Montgomery@C...]
Sent: 17 May 2002 12:48
To: ASP Databases
Subject: [asp_databases] XPath query for elements rather than attributes


Hi,

I've got the following XPath query working for the following XML:

/Combos/Combo[@level = '5' and @matchlvl1 = 'Jurisdiction' and matchlvl2 
'UK' ... ]

<Combos>
  <Combo level="5" matchlvl1="Jurisdiction" matchlvl2="UK" matchlvl3="Case
Law" matchlvl4="England" matchlvl5="">
	<option>- - Please choose an option - -</option>
	<option>Citations</option>
	<option>Judgement</option>
	<option>Legislation</option>
	<option>General</option>
	<option>Updating</option>
	<option>Courts</option>
  </Combo>
</Combos>

I've changed the format of the XML so the attributes are now elements -
because I feel it's clearer and have heard many opinions that it's the
correct way to do things.

Now the XML is:

<Combos>
  <Combo>
	<level>3</level>
	<matchlvl1>Jurisdiction</matchlvl1>
	<matchlvl2>UK</matchlvl2>
	<matchlvl3></matchlvl3>
	<matchlvl4></matchlvl4>
	<matchlvl5></matchlvl5>
	<option>- - Please choose an option - -</option>
	<option>Case Law</option>
	<option>Legislation</option>
	<option>Miscellaneous</option>
  </Combo>
</Combos>

Problem is I can't find any examples of this sort of searching/Xpath on the
net.  What I want is a nodelist of <Combo> nodes where <level> = x AND
<matchlvl1> = x AND <matchlvl2> = x     etc.

Can anybody help out?

Thanks,
Col


*******

This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure.  If you are not the intended recipient,
please telephone or email the sender and delete this message and any
attachment from your system.  If you are not the intended recipient you must
not copy this message or attachment or disclose the contents to any other
person.

For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.



  Return to Index