You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Sir Woody Hackswell <wo...@hackswell.com> on 2003/03/27 15:45:46 UTC
RFC: Schema annotation support
Hello, all!
I have a project in which I need to be able to use the <xsd:annotation>
from a schema. After hours of studying undocumented code in the validators/
directory (hint hint... why are there no docs on the validators?) I came to
the conclusion that annotations seem to be completely ignored after
validation. A user has no way of getting that information back!
So... I hacked the code. I'll submit for review my basic (and I mean
BASIC!) API here. I'll take suggestions on what is really needed... not
just what I need. I hope that this will make it into Xerces-C++ some day.
:)
-Richard Balint
Ball Aerospace & Technology Corp.
New Class: SchemaAnnot class
----------------------------
VALIDATORS_EXPORT SchemaAnnot
{ public :
//-----------------------------------------
// Constructors and Destructors
//-----------------------------------------
SchemaAnnot();
SchemaAnnot
(
const DOMNode* appinfo
, const DOMNode* documentation
);
virtual ~SchemaAnnot();
// Reset SchemaAnnot.appinfo and SchemaAnnot.documentation to null
void clear();
void setAppInfo( const DOMNode* appinfo );
void setDocumentation( const DOMNode* documentation );
const DOMNode* getAppInfoNode();
const DOMNode* getDocumentationNode();
bool hasAnnotation();
private :
bool fHasAnnotation;
DOMNode* fDocumentation;
DOMNode* fAppInfo; };
}
This class is insanely simple. I just wanted to get appinfo and
documentation out of the schema. ;) This method returns cloned DOMNodes,
and their children (the data).
Additions to SchemaElementDecl API:
-----------------------------------
virtual bool hasAnnotation() const;
SchemaAnnot* getAnnotation() const;
void setAnnotation(const DOMNode* appinfo, const DOMNode* documentation);
void setAnnotation(const SchemaAnnot* annotation);
additional private member: SchemaAnnot* fAnnotation;
Additions to TraverseSchema:
----------------------------
*Additional code to pull out the annotations and attach it to the
SchemaElementDecl's.
*additional private member: SchemaAnnot* fCurrentAnnotation;
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org