Asn1XmlUtil Class Reference

List of all members.

Static Public Member Functions

static string CaptureElement (System.Xml.XmlReader reader, bool contentOnly, bool injectNsDecls)
static void EncodeDouble (Asn1XmlEncoder buffer, double data)
static void EncodeDouble (Asn1XmlEncoder buffer, double data, System.String elemName, System.String nsPrefix)
static void EncodeNSAttrs (Asn1XmlEncoder buffer, Asn1XmlNamespace[] nsArray)
static double GetMinusZero ()
static string GetTextContent (System.Xml.XmlReader reader)
static System.String GetXMLString (System.String data)
static bool IsMinusZero (double value)
static void KeepNullsInString (bool keep)
static String[] TokenizeXsdList (String listValue)

Detailed Description

This class contains some general purpose static utility functions for XML encoding or decoding.


Member Function Documentation

static string CaptureElement ( System.Xml.XmlReader  reader,
bool  contentOnly,
bool  injectNsDecls 
) [static]

Capture the XML text for an element, returning it in a string object. Optionally, this method can capture the element's content only.

PRE: The reader is positioned on the start tag of the element to be captured, call it E. POST: The reader is positioned on the event following element E.

Parameters:
contentOnly if TRUE, only capture the content of the current element. Otherwise, captures the current element's tags, namespace declarations, and attributes, as well as the content.
injectNsDecls if TRUE, the outermost element(s) should include namespace declarations for prefixes used by those elements but not declared.
static void EncodeDouble ( Asn1XmlEncoder  buffer,
double  data 
) [static]

This method encodes an ASN.1 real value using the XML encoding (non-XER).

Parameters:
buffer Encode message buffer object
value Value to be encoded.
static void EncodeDouble ( Asn1XmlEncoder  buffer,
double  data,
System.String  elemName,
System.String  nsPrefix 
) [static]

This method encodes an ASN.1 real value using the XML encoding (non-XER).

Parameters:
buffer Encode message buffer object
value Value to be encoded.
elemName Element name
nsPrefix Element namespace prefix value
static void EncodeNSAttrs ( Asn1XmlEncoder  buffer,
Asn1XmlNamespace[]  nsArray 
) [static]

This method encodes XML namespace attributes in the form 'xmlns[:prefix]="uri"'.

Parameters:
nsArray Array of XML namespace prefix/URI mappings.
static double GetMinusZero (  )  [static]

This method returns double value for "minus zero" (-0) special XML value.

Returns:
double value for "-0".
static string GetTextContent ( System.Xml.XmlReader  reader  )  [static]

Return the current text node and subsequent text content until an EndElement is found.

This will throw an exception if any Element nodes are encountered. PRE: The reader is positioned on a Text or CDATA event. POST: The reader is positioned just past the closing EndElement.

static System.String GetXMLString ( System.String  data  )  [static]

This method will convert the given string value into XML character content by escaping special characters in the sting such as ampersand (&), left angle bracket (>), etc.

Parameters:
data String to convert
Returns:
Converted string value
static bool IsMinusZero ( double  value  )  [static]

This method will return true, if value is "minus zero" (-0) special XML value.

Parameters:
value value to test
Returns:
true, if this value is "-0".
static void KeepNullsInString ( bool  keep  )  [static]

This method allows users to toggle the output of a null entity code in XML strings. Null bytes are not permitted in any XML document, but are permissible in ASN.1 strings. When converting, users may elect to retain null bytes as entities (&x0;) by passing

true

to this function. By default, null bytes are dropped.

Parameters:
keep Boolean switch to keep or ignore null bytes.
static String [] TokenizeXsdList ( String  listValue  )  [static]

Return an array of strings representing the (lexical) values of an xsd:list

Parameters:
listValue the lexical value of the xsd:list. It need not have whitepspace collapse applied yet.
Returns:
array of lexical values, one per value in the listValue. No empty strings will appear in the array.