knoaman 2002/11/28 12:12:45
Modified: c/src/xercesc/framework XMLAttr.hpp XMLAttr.cpp
Log:
Allow creating/setting of XMLAttr using a rawname (i.e. 'prefix:localpart').
Revision Changes Path
1.4 +76 -0 xml-xerces/c/src/xercesc/framework/XMLAttr.hpp
Index: XMLAttr.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLAttr.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLAttr.hpp 4 Nov 2002 15:00:21 -0000 1.3
+++ XMLAttr.hpp 28 Nov 2002 20:12:45 -0000 1.4
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2002/11/28 20:12:45 knoaman
+ * Allow creating/setting of XMLAttr using a rawname (i.e. 'prefix:localpart').
+ *
* Revision 1.3 2002/11/04 15:00:21 tng
* C++ Namespace Support.
*
@@ -181,6 +184,38 @@
, const XMLAttDef::AttTypes type = XMLAttDef::CData
, const bool specified = true
);
+
+ /**
+ * This is the primary constructor which takes all of the information
+ * required to construct a complete attribute object.
+ *
+ * @param uriId The id into the validator's URI pool of the URI
+ * that the prefix mapped to. Only used if namespaces
+ * are enabled/supported.
+ *
+ * @param rawName The raw name of the attribute.
+ *
+ * @param attrValue The value string of the attribute, which should
+ * be fully normalized by XML rules!
+ *
+ * @param type The type of the attribute. This will indicate
+ * the type of normalization done and constrains
+ * the value content. Make sure that the value
+ * set meets the constraints!
+ *
+ * @param specified Indicates whether the attribute was explicitly
+ * specified or not. If not, then it was faulted
+ * in from a FIXED or DEFAULT value.
+ */
+ XMLAttr
+ (
+ const unsigned int uriId
+ , const XMLCh* const rawName
+ , const XMLCh* const attrValue
+ , const XMLAttDef::AttTypes type = XMLAttDef::CData
+ , const bool specified = true
+ );
+
//@}
/** @name Destructor */
@@ -289,6 +324,34 @@
);
/**
+ * This method is called to set up a default constructed object after
+ * the fact, or to reuse a previously used object.
+ *
+ * @param uriId The id into the validator's URI pool of the URI
+ * that the prefix mapped to. Only used if namespaces
+ * are enabled/supported.
+ *
+ * @param attrRawName The raw name of the attribute.
+ *
+ * @param attrValue The value string of the attribute, which should
+ * be fully normalized by XML rules according to the
+ * attribute type.
+ *
+ * @param type The type of the attribute. This will indicate
+ * the type of normalization done and constrains
+ * the value content. Make sure that the value
+ * set meets the constraints!
+ *
+ */
+ void set
+ (
+ const unsigned int uriId
+ , const XMLCh* const attrRawName
+ , const XMLCh* const attrValue
+ , const XMLAttDef::AttTypes type = XMLAttDef::CData
+ );
+
+ /**
* This method will update just the name related fields of the
* attribute object. The other fields are left as is.
*
@@ -450,6 +513,19 @@
{
// Set the name info and the value via their respective calls
fAttName->setName(attrPrefix, attrName, uriId);
+ setValue(attrValue);
+
+ // And store the type
+ fType = type;
+}
+
+inline void XMLAttr::set(const unsigned int uriId
+ , const XMLCh* const attrRawName
+ , const XMLCh* const attrValue
+ , const XMLAttDef::AttTypes type)
+{
+ // Set the name info and the value via their respective calls
+ fAttName->setName(attrRawName, uriId);
setValue(attrValue);
// And store the type
1.3 +26 -1 xml-xerces/c/src/xercesc/framework/XMLAttr.cpp
Index: XMLAttr.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLAttr.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLAttr.cpp 4 Nov 2002 15:00:21 -0000 1.2
+++ XMLAttr.cpp 28 Nov 2002 20:12:45 -0000 1.3
@@ -110,6 +110,31 @@
}
}
+XMLAttr::XMLAttr( const unsigned int uriId
+ , const XMLCh* const rawName
+ , const XMLCh* const attrValue
+ , const XMLAttDef::AttTypes type
+ , const bool specified) :
+
+ fType(type)
+ , fValue(0)
+ , fValueBufSz(0)
+ , fSpecified(specified)
+{
+ try
+ {
+ // Just call the local setters to set up everything. Too much
+ // work is required to replicate that functionality here.
+ fAttName = new QName(rawName, uriId);
+ setValue(attrValue);
+ }
+
+ catch(...)
+ {
+ cleanUp();
+ }
+}
+
// ---------------------------------------------------------------------------
// XMLAttr: Getter methods
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]