Easiest Way to Modify XML Attribute?

  • Thread starter Thread starter beachnut
  • Start date Start date
B

beachnut

Hi, all.

I am passed an XML chunk via a string parameter,
which I must parse to get some attribute values,
run some computation on those, poke the result
into another attribute, and return that chunk
to the caller with only the result changed.

I was messing with MemoryString and XMLReader,
but maybe SAX isn't the way to go?

What's the best way to do this?

Thanks in advance!

bn
 
beachnut said:
Hi, all.

I am passed an XML chunk via a string parameter,
which I must parse to get some attribute values,
run some computation on those, poke the result
into another attribute, and return that chunk
to the caller with only the result changed.

I was messing with MemoryString and XMLReader,
but maybe SAX isn't the way to go?

What's the best way to do this?

Thanks in advance!

bn

I think you want XmlDocument.
Use an XPath query in SelectSingleNode to select what you want:
either directly the argument you want
or the node possibly containing the argument (then use the Arguments
collection to find your argument)

Hans Kesting
 
beachnut wrote:

I am passed an XML chunk via a string parameter,
which I must parse to get some attribute values,
run some computation on those, poke the result
into another attribute, and return that chunk
to the caller with only the result changed.

I was messing with MemoryString and XMLReader,
but maybe SAX isn't the way to go?

XmlReader is not SAX but anyway,
What's the best way to do this?

if you want to parse, modify and save XML then XmlDocument is the right
solution.
 
Back
Top