Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

XSECEnv Class Reference
[Internal Classes]

#include <XSECEnv.hpp>

Collaboration diagram for XSECEnv:

Collaboration graph
[legend]
List of all members.

Detailed Description

Holds environmental information.

The various XSEC classes need to be able to retrieve information about the environment they are operating in (namespace prefixes, owning document etc.) - this class is used to provide and hold this info.


Public Member Functions

Constructors and Destructors
 XSECEnv (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc)
 Contructor.
 XSECEnv (const XSECEnv &theOther)
virtual ~XSECEnv ()
Prefix handling.
void setDSIGNSPrefix (const XMLCh *prefix)
 Set the prefix be used for the DSIG namespace.
void setECNSPrefix (const XMLCh *prefix)
 Set the prefix be used for the Exclusive Canonicalisation namespace.
void setXPFNSPrefix (const XMLCh *prefix)
 Set the prefix be used for the XPath-Filter2 namespace.
void setXENCNSPrefix (const XMLCh *prefix)
 Set prefix for XENC nodes.
void setXKMSNSPrefix (const XMLCh *prefix)
 Set prefix for XKMS nodes.
const XMLCh * getDSIGNSPrefix () const
 Get the NS Prefix being used for DSIG elements.
const XMLCh * getECNSPrefix () const
 Get the NS being used for EC nodes.
const XMLCh * getXPFNSPrefix () const
 Get the NS being used for XPath Filter2 nodes.
const XMLCh * getXENCNSPrefix (void) const
 Get namespace prefix for XENC nodes.
const XMLCh * getXKMSNSPrefix (void) const
 Get namespace prefix for XKMS nodes.
Pretty Printing Functions
void setPrettyPrintFlag (bool flag)
 Set Pretty Print flag.
bool getPrettyPrintFlag (void) const
 Return the current value of the PrettyPrint flag.
void doPrettyPrint (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) const
 Do a pretty print output.
General information functions
XERCES_CPP_NAMESPACE_QUALIFIER
DOMDocument * 
getParentDocument () const
void setParentDocument (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc)
Resolver manipulation
void setURIResolver (XSECURIResolver *resolver)
 Register a URIResolver.
XSECURIResolvergetURIResolver (void) const
 Return a pointer to the resolver being used.
ID handling
void setIdByAttributeName (bool flag)
 Set Id finding behaviour.
bool getIdByAttributeName (void) const
 Determine Id finding behaviour.
void registerIdAttributeName (const XMLCh *name)
 Add an attribute name to be searched for when looking for Id attributes.
bool deregisterIdAttributeName (const XMLCh *name)
 Remove an attribute name to be searched for when looking for Id attributes.
bool isRegisteredIdAttributeName (const XMLCh *name) const
 Determine if an attribute name is registered as an Id name.
void registerIdAttributeNameNS (const XMLCh *ns, const XMLCh *name)
 Add an attribute name and namespace to be searched for when looking for Id attributes.
bool deregisterIdAttributeNameNS (const XMLCh *ns, const XMLCh *name)
 Remove an attribute name and namespace to be searched for when looking for Id attributes.
bool isRegisteredIdAttributeNameNS (const XMLCh *ns, const XMLCh *name) const
 Determine if an attribute name and namespace is registered as an Id name.
int getIdAttributeNameListSize () const
 Get number of Attribute Names registered as Id attributes.
const XMLCh * getIdAttributeNameListItem (int index) const
const XMLCh * getIdAttributeNameListItemNS (int index) const
bool getIdAttributeNameListItemIsNS (int index) const
Formatters
XSECSafeBufferFormattergetSBFormatter (void) const
 Get a safeBufferFormatter.


Constructor & Destructor Documentation

XSECEnv::XSECEnv XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  doc  ) 
 

Contructor.

XSECEnv::XSECEnv const XSECEnv theOther  ) 
 

virtual XSECEnv::~XSECEnv  )  [virtual]
 


Member Function Documentation

bool XSECEnv::deregisterIdAttributeName const XMLCh *  name  ) 
 

Remove an attribute name to be searched for when looking for Id attributes.

This allows a user to de-register a particular name to be used to identify Id attributes.

Parameters:
name Name to remove from the list of those used to find Id attributes
Returns:
true if found and removed, false if was not in the list

bool XSECEnv::deregisterIdAttributeNameNS const XMLCh *  ns,
const XMLCh *  name
 

Remove an attribute name and namespace to be searched for when looking for Id attributes.

This allows a user to de-register a particular name to be used to identify Id attributes.

Parameters:
ns Namespace in which attribute resides
name Name to remove from the list of those used to find Id attributes
Returns:
true if found and removed, false if was not in the list

void XSECEnv::doPrettyPrint XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *  node  )  const
 

Do a pretty print output.

The library calls this function to perform CR/LF outputting

At the moment htis is really redundant, but it is more a holder so that we can set up something in the library to allow users to install a pretty print function.

Parameters:
node Node to append pretty print content to

const XMLCh* XSECEnv::getDSIGNSPrefix  )  const [inline]
 

Get the NS Prefix being used for DSIG elements.

Returns:
A pointer to the buffer holding the prefix
See also:
setDSIGNSPrefix

const XMLCh* XSECEnv::getECNSPrefix  )  const [inline]
 

Get the NS being used for EC nodes.

Returns:
A pointer to the buffer holding the prefix
See also:
setECNSPrefix

const XMLCh* XSECEnv::getIdAttributeNameListItem int  index  )  const
 

bool XSECEnv::getIdAttributeNameListItemIsNS int  index  )  const
 

const XMLCh* XSECEnv::getIdAttributeNameListItemNS int  index  )  const
 

int XSECEnv::getIdAttributeNameListSize  )  const
 

Get number of Attribute Names registered as Id attributes.

Returns:
the number of elements in the list

bool XSECEnv::getIdByAttributeName void   )  const
 

Determine Id finding behaviour.

Allows a caller to determine whether the library is currently searching for Id attributes by name

Returns:
The value of the IdByAttributeName flag

XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* XSECEnv::getParentDocument  )  const [inline]
 

Get the DOMDocument that the super class is operating within.

Mainly used by the library itself.

Returns:
The DOM_Document node.

bool XSECEnv::getPrettyPrintFlag void   )  const [inline]
 

Return the current value of the PrettyPrint flag.

Returns:
The value of the pretty print flag

XSECSafeBufferFormatter* XSECEnv::getSBFormatter void   )  const [inline]
 

Get a safeBufferFormatter.

Return a UTF-8 safeBuffer formatter

Returns:
A pointer to a safeBuffer formatter

XSECURIResolver* XSECEnv::getURIResolver void   )  const
 

Return a pointer to the resolver being used.

Returns:
A pointer to the URIResolver registered in this signature

const XMLCh* XSECEnv::getXENCNSPrefix void   )  const [inline]
 

Get namespace prefix for XENC nodes.

Find the string being used by the library to prefix nodes in the xenc: namespace.

Returns:
XENC namespace prefix

const XMLCh* XSECEnv::getXKMSNSPrefix void   )  const [inline]
 

Get namespace prefix for XKMS nodes.

Find the string being used by the library to prefix nodes in the xkms: namespace.

Returns:
XKMS namespace prefix

const XMLCh* XSECEnv::getXPFNSPrefix  )  const [inline]
 

Get the NS being used for XPath Filter2 nodes.

Returns:
A pointer to the buffer holding the prefix
See also:
setXPFNSPrefix

bool XSECEnv::isRegisteredIdAttributeName const XMLCh *  name  )  const
 

Determine if an attribute name is registered as an Id name.

Parameters:
name String to check in the idAttributeName list
Returns:
true if the passed in name is registered as an Attribute name

bool XSECEnv::isRegisteredIdAttributeNameNS const XMLCh *  ns,
const XMLCh *  name
const
 

Determine if an attribute name and namespace is registered as an Id name.

Parameters:
ns Namespace in which attribute resides
name String to check in the idAttributeName list
Returns:
true if the passed in name is registered as an Attribute name

void XSECEnv::registerIdAttributeName const XMLCh *  name  ) 
 

Add an attribute name to be searched for when looking for Id attributes.

This allows a user to add an attribute name to be used to identify Id attributes when they are not set to be of Type=ID in the DOM

Note:
Two names are registered by default - "Id" and "id". These can be removed by calling deregisterIdAttributeName
Parameters:
name Name to append to the list of those used to find Id attributes

void XSECEnv::registerIdAttributeNameNS const XMLCh *  ns,
const XMLCh *  name
 

Add an attribute name and namespace to be searched for when looking for Id attributes.

This allows a user to add an attribute name in a parcicular namespace to be used to identify Id attributes when they are not set to be of Type=ID in the DOM

Note:
Two names are registered by default - "Id" and "id". These can be removed by calling deregisterIdAttributeName
Parameters:
ns Namespace URI in which attribute appears
name Name to append to the list of those used to find Id attributes

void XSECEnv::setDSIGNSPrefix const XMLCh *  prefix  ) 
 

Set the prefix be used for the DSIG namespace.

When the XSEC library creates XML Element nodes, it uses the prefix here for all nodes created. By default, the library assumes that the default namespace is used.

The #createBlankSignature function will use this prefix to setup the dsig namespace. E.g. (assuming a call has been made to set the prefix to "ds") the <Signature> element will have a namespace attribute added of

xmlns:ds="http://www.w3.org/2000/09/xmldsig#"

If no prefix has been set, this attribute will be set as the default namespace

See also:
#createBlankSignature
Parameters:
prefix The UTF-16 encoided NS prefix to use for the XML Digital Signature nodes

void XSECEnv::setECNSPrefix const XMLCh *  prefix  ) 
 

Set the prefix be used for the Exclusive Canonicalisation namespace.

The Exclusive Canonicalisation specification defines a new namespace for the InclusiveNamespaces node. This function can be used to set the prefix that the library will use when creating nodes within this namespace.

xmlns:ds="http://www.w3.org/2001/10/xml-exc-c14n#"

If no prefix is set, the default namespace will be used

See also:
#createBlankSignature
Parameters:
prefix The UTF-16 encoided NS prefix to use for the XML Exclusive Canonicalisation nodes

void XSECEnv::setIdByAttributeName bool  flag  ) 
 

Set Id finding behaviour.

The library de-references "#obj" URI references to ID attributes within a DOM document. Currently, the library first uses DOM calls to find if the Id has been properly set within the document via the parser or one of the DOM Level 3 calls to set an Id.

If no Id is found of the correct name, the library then starts searching for attributes of a given name with the required value. This list defaults to "id" and "Id", but can be modified via a call to addIdAttributeName()

The setIdByAttributeName call enables or disables the second part of the Id search. I.e. when the Id doesn't exist as an attribute of Type=ID, whether or not to search for an attribute of a name in the list of names. By default this behaviour is enabled.

Warning:
This is currently enabled by default for backwards compatibility reasons only. Future version may reverse this and ship disabled by default, as this behaviour is a potential security risk.
Parameters:
flag Enable (true) or Disable (false) searching for Id attributes by name

void XSECEnv::setParentDocument XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  doc  )  [inline]
 

Set the DOMDocument that the super class is operating within.

Mainly used by the library itself.

Parameters:
doc The Document node.

void XSECEnv::setPrettyPrintFlag bool  flag  )  [inline]
 

Set Pretty Print flag.

The pretty print flag controls whether the library will output CR/LF after the elements it adds to a document

By default the library will do pretty printing (flag is true)

Parameters:
flag Value to set the flag (true = do pretty printing)

void XSECEnv::setURIResolver XSECURIResolver resolver  ) 
 

Register a URIResolver.

Registers a URIResolver to be used by the Signature when dereferencing a URI in a Reference element

void XSECEnv::setXENCNSPrefix const XMLCh *  prefix  ) 
 

Set prefix for XENC nodes.

Set the namespace prefix the library will use when creating nodes in the XENC namespace

void XSECEnv::setXKMSNSPrefix const XMLCh *  prefix  ) 
 

Set prefix for XKMS nodes.

Set the namespace prefix the library will use when creating nodes in the XKMS namespace

void XSECEnv::setXPFNSPrefix const XMLCh *  prefix  ) 
 

Set the prefix be used for the XPath-Filter2 namespace.

The XPathFilter definition uses its own namespace. This method can be used to set the prefix that the library will use when creating elements in this namespace

xmlns:ds="http://www.w3.org/2002/06/xmldsig-filter2"

If no prefix is set, the default namespace will be used

See also:
#createBlankSignature
Parameters:
prefix The UTF-16 encoided NS prefix to use for the XPath filter nodes


The documentation for this class was generated from the following file:
Generated on Sun Jul 3 17:45:39 2005 for XML-Security-C by  doxygen 1.4.2