ReplaceChild - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


XMLTools

  

ReplaceChild

  

replace a child node of an XML tree

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

ReplaceChild( spec, xmlTree )

Parameters

spec

-

equation acceptable to subsop

xmlTree

-

Maple XML tree; XML element

Description

• 

The ReplaceChild(spec, xmlTree) command replaces a specific child of an XML document tree with new content.

• 

The first argument is an equation whose left-hand side specifies which child to replace, and whose right-hand side is the replacement content. The syntax mimics that of subsop. A new XML document tree is returned with the replacement content appearing instead of the child element specified in the left-hand side of the first argument.

Examples

withXMLTools:

docXMLElementa,,XMLElementb,colour=red,foo,XMLElementc,colour=blue,bar,XMLElementd,,baz:

Printdoc

<a>
  <b colour = 'red'>foo</b>
  <c colour = 'blue'>bar</c>
  <d>baz</d>
</a>

PrintReplaceChild2=XMLElementNEW&comma;&comma;text&comma;doc

<a>
  <b colour = 'red'>foo</b>
  <NEW>text</NEW>
  <d>baz</d>
</a>

See Also

subsop

XMLTools

XMLTools[GetChild]

XMLTools[RemoveChild]

XMLTools[XMLElement]