Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
XMLTools[AddAttribute] - add an attribute to an XML element
Calling Sequence
AddAttribute(xmlTree, attrName, attrValue)
AddAttribute(xmlTree, attr)
Parameters
xmlTree
-
Maple XML tree; XML element
attrName
string; attribute name
attrValue
string; attribute value
attr
equation of the form attrName = attrValue; attribute specification
Description
The AddAttribute(xmlTree, attr) command creates a new XML element from a given one by adding the specified attributes. The AddAttribute(xmlTree, attrName, attrValue) form of the calling sequence is equivalent to the AddAttribute(xmlTree, attr) form.
The input tree xmlTree must not already have an attribute with the specified attribute name . The behavior of this function is unspecified if the XML tree xmlTree already has an attribute named attrName.
The attribute encoded as attrName = attrValue is added to the attributes of xmlTree, and the new XML tree is returned. The position of the new attribute among any other attributes that may already exist in the tree is unspecified.
Examples
The next example returns an error since the attribute value is not of type string.
Error, (in XMLTools:-AddAttribute) invalid input: addAttribute2 expects its 2nd argument, attr, to be of type string = string, but received "size" = 2
See Also
XMLTools, XMLTools[RemoveAttribute]
Download Help Document