Does not inherit
asString() compareTo() empty() getLocalName() |
getNamespace() getQualifiedName() getUniqueName() isNull() |
operator=() setLocalName() setNamespace() unsetNamespace() |
XmlName() ~XmlName() |
#include rwsf/core/XmlName.h
The complete information for an XML name consists of a local name and its namespace. rwsf::XmlName represents a complete XML name using a local name represented as a string and an rwsf::XmlNamespace. If the local name has no namespace qualification, the namespace component of an instance of this class will be a namespace equal to the namespace returned by rwsf::XmlNamespace::getEmptyNamespace().
For the element
<rw:book xmlns:rw="http://xml.roguewave.com/"/>
the rwsf::XmlName contains the local name book and an rwsf::XmlNamespace object that contains the prefix string "rw" and the URI string "http://xml.roguewave.com/". The combination of the prefix and the local name is the qualified name, rw:book in this example.
Every XML element must have a name. All classes that represent XML elements contain an rwsf::XmlName. However, HydraAgent allows an rwsf::XmlName to contain the empty string as a local name. An empty local name cannot be represented as valid XML. For objects with an empty local name, a serializer is free to provide an arbitrary name.
rwsf::XmlName does not represent the context of the name. An instance of this class contains no information about relationships among the namespace where the element resides and other namespace declarations in a document. The W3C specifies that the prefix of an XML name is an arbitrary placeholder for the URI. Therefore, a serializer for an rwsf::XmlName may not generate the same qualified name as the object itself. A serializer must preserve the unique name, but is free to replace the prefix with an equivalent prefix, generate a new prefix, or ignore the prefix entirely.
XmlName();
Default constructor.
XmlName(const std::string & localName);
Constructs an object representing the name localName in the empty namespace.
XmlName(const std::string & localName, const rwsf::XmlNamespace & ns);
Constructs an object representing the name localName in the ns namespace.
XmlName(const XmlName & name);
Copy constructor. Constructs a deep copy of name.
~XmlName();
Destructor.
std::string asString() const;
Returns the qualified name of self. (See getQualifiedName() below.)
int compareTo(const XmlName & other) const;
Compares the components of the unique names of self and other. If self's unique name sorts before other's, returns a number less than zero. If the unique names are equal, returns zero. Otherwise, returns a number greater than zero.
bool empty() const;
Returns true if this object is null (i.e., has a blank local name and a null namespace).
const std::string & getLocalName() const;
Returns the local name of self.
const rwsf::XmlNamespace & getNamespace() const;
Returns the namespace of this attribute.
rwsf::XmlNamespace & getNamespace();
Returns the namespace of this attribute.
std::string getQualifiedName() const;
Returns a qualified name for this rwsf::XmlName. If this name is in a namespace with a prefix, the qualified name takes the form prefix:localname. Otherwise, the qualified name is the local name.
std::string getUniqueName() const;
Returns a unique name for this rwsf::XmlName. If this name is in a namespace, the unique name takes the form URI::localname. Otherwise, the unique name is the local name. Since the W3C does not specify a format for representing a unique name as text, the string returned by this function will not be understood by a parser, and should not be used for serialization.
bool isNull() const;
Returns true if this object is null (i.e., has a blank local name and a null namespace).
void setLocalName(const std::string & localName);
Sets the local name of this rwsf::XmlName.
void setNamespace(const rwsf::XmlNamespace & ns);
Sets the namespace of this rwsf::XmlName.
void unsetNamespace();
Clears this name's namespace.
XmlName & operator=(const XmlName & n);
Assignment operator. Makes self a deep copy of n.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.