xattribute

Problem Reading XElement Attribute

Anyone knows why this xpath expression "catzero/@id" is not working on this xml document = XDocument.Load("file.xml"); var product = document.XPathSelectElements("//product", nameSpaceResolver).First(); var category = ((IEnumerable) product.XPathEvaluate("catzero/@id")).Cast<XAttribute>().first().value; //catezero/@id is null ...

Old Mac extended attributes in Snow Leopard

Last year I had to convert and old Mac font from around OS 9 for someone to use on a PC. I discovered that back then the font data was stored in the extended attribute com.apple.ResourceFork. The actual file size will show up as 0 in terminal. I was able to get around this by simply printing out the value of that extended attribute using...

XAttribute implementing IComparable during tests, but not when live

I have some code below that is throwing an exception in integration environments but not in my unit tests. Basically I'm sorting some XML elements (linq-2-sql XElement) by an attribute value. All the nodes have the attribute defined. IEnumerable<XElement> elements = ...; // elementes are of the form<recipe name="something"> elements....

Using XNamespace to create nicely formatted XML.

I want to create a Xml file that looks something like this: <Root xmlns:ns1="name1" xmlns:ns2="name2">     <ns1:element1 />     <ns1:element2 />     <ns2:element3 /> </Root> How can I accomplish this using XAttribute, XElement, XNamespace, and XDocument where the namespaces are dynamically added. ...

Sanitize XML Attribute Values

How can i easily sanitize the values I pass into the Value property of an XAttribute. ...

locate extended attributes

Is there a simple way to write a kind of wrapper script or patch for updatedb (or locate) such that locate can find user defined extended attributes (tags) (suppose in an ext3 filesystem, mounted with user_xattr option), too? ...