xml-attribute

What is the best way to parse an XML boolean attribute (in .NET)?

An XML attribute declared as xs:boolean can acceptable be "true", "false", "0" or "1". However, in .NET, Boolean.Parse() will only accept "true" or "false". If it sees a "0" or "1", it throws a "Bad Format" exception. So, given that, what's the best way to parse such a value into a Boolean? (Unfortunately, I'm limited to .NET 2.0 solu...

XML: attributes or children?

In XSD, SOAP and other XML conventions you'll often see things like: <book> <title>Harry Potter</title> <author>J.K. Rowling</author> </book> Now I'm wondering, what happened to attributes? To me it makes more sense to write this as: <book title="Harry Potter" author="J.K. Rowling" /> But apparently, for some reason, smarter peop...

How do I retrieve an XML Element where an attribute is either X or Y?

Consider this xml: <parent> <child name="alpha" /> </parent> and also this xml <parent> <child name="beta" /> </parent> There should be only a sinlge node at /parent/child with either alpha or beeta as it's name value. To clarrify... there will never be 2 child nodes one each named alpha and beta I'm trying to create a si...

How to Parse through nsXml Parser.

Hey All, i am very new to iphone Development and i am asked to use nsxml parser to parse xml from a google api. i have parsed another url which has xml but i am not able to parse google's because it is using id's to store data rather than inside tag. i.e. <forecast_information> <city data="Anaheim, CA"/> <postal_code data="anah...

Is there a way to make a serialized member to serialize as an attribute?

Is there a way to make a serialized member to serialize as an attribute: <Serializable> Public Class Person Public Property Name As String End Class I want than when this class is xml-serialized, it should produce: <Person Name="John Doe" /> And what I mean is that instead of the Name property should be serialized as an elemen...

get xml attribute named xlink:href using xsl

How can I get the value of an attribute called xlink:href of an xml node in xsl template? I have this xml node: <DCPType> <HTTP> <Get> <OnlineResource test="hello" xlink:href="http://localhost/wms/default.aspx" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" /> </Get> </HTTP> </DCPType> When I try the f...

How to change the attribute value of svg file

Hello, In samplexml.svg there is a node <image width="744" height="1052" xlink:href="image1.png"/> I need to replace "image1.png" with another value like "image2.png". Please guide me with sample code how to to that. I could get the attribute value "image1.png". Here is the code: $xdoc = new DomDocument; $xdoc->Load('samplexml.svg'...