Linq to XML and BrowserCap file

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I understand how to use Linq to XML to perform queries against XElements, etc...

How would you use it to perform queries against specific " case " statements to find a specific value?
How would you use it to insert another " case " statement?

Below, is an example of a browserCap file.
<?xml version="1.0" encoding="utf-8" ?><br/>
<!-- <br/>
Customized browserCaps settings.<br/>
--><br/>
<browserCaps><br/>
<use var="HTTP_USER_AGENT" /><br/>
<filter><br/>
<!-- Acer --><br/>
< case match ="E110.* <br/>
isColor = "true"<br/>
isMobileDevice = "true"<br/>
maximumRenderedPageSize = "30000"<br/>
MobileDeviceManufacturer = "Acer"<br/>
MobileDeviceModel = "AcerE110"<br/>
numberOfSoftkeys = "2"<br/>
phoneID = "2300"<br/>
preferredImageMime = "image/png"<br/>
preferredRenderingMime = "application/xhtml+xml"<br/>
preferredRenderingType = "xhtml-basic"<br/>
screenBitDepth = "16"<br/>
screenCharactersHeight = "12"<br/>
screenCharactersWidth = "14"<br/>
screenPixelsHeight = "128"<br/>
screenPixelsWidth = "160"<br/>
type = "Acer E110"<br/>
</ case >

<

For instance, if I query against this file for E110 , it
will find it, but the contents of the XElement will be the
entire file and not just the above case statement.

Bill Yeager

View the full article
 
Back
Top