org.apache.directory.shared.dsmlv2
Class ParserUtils

java.lang.Object
  extended by org.apache.directory.shared.dsmlv2.ParserUtils

public class ParserUtils
extends java.lang.Object

This class is a Helper class for the DSML Parser

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
static java.lang.String BASE64BINARY
           
static java.lang.String XML_SCHEMA_INSTANCE_URI
           
static java.lang.String XML_SCHEMA_URI
           
static java.lang.String XSD
           
static java.lang.String XSI
           
 
Constructor Summary
ParserUtils()
           
 
Method Summary
static void addControls(org.dom4j.Element element, java.util.List<Control> controls)
          Adds Controls to the given Element.
static java.lang.String base64Encode(java.lang.Object value)
          Encodes the value as a Base64 String
static java.lang.String getXsiTypeAttributeValue(org.xmlpull.v1.XmlPullParser xpp)
          Returns the value of the attribute 'type' of the "XMLSchema-instance' namespace if it exists
static boolean isBase64BinaryValue(org.xmlpull.v1.XmlPullParser parser, java.lang.String attrValue)
          Tells is the given value is a Base64 binary value
static boolean isRequestIdNeeded(Dsmlv2Container container)
          Indicates if a request ID is needed.
static boolean needsBase64Encoding(java.lang.Object value)
          Indicates if the value needs to be encoded as Base64
static int parseAndVerifyRequestID(java.lang.String attributeValue, org.xmlpull.v1.XmlPullParser xpp)
          Parses and verify the parsed value of the requestID
static org.dom4j.Document styleDocument(org.dom4j.Document document)
          XML Pretty Printer XSLT Tranformation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_SCHEMA_URI

public static final java.lang.String XML_SCHEMA_URI
See Also:
Constant Field Values

XML_SCHEMA_INSTANCE_URI

public static final java.lang.String XML_SCHEMA_INSTANCE_URI
See Also:
Constant Field Values

BASE64BINARY

public static final java.lang.String BASE64BINARY
See Also:
Constant Field Values

XSI

public static final java.lang.String XSI
See Also:
Constant Field Values

XSD

public static final java.lang.String XSD
See Also:
Constant Field Values
Constructor Detail

ParserUtils

public ParserUtils()
Method Detail

getXsiTypeAttributeValue

public static java.lang.String getXsiTypeAttributeValue(org.xmlpull.v1.XmlPullParser xpp)
Returns the value of the attribute 'type' of the "XMLSchema-instance' namespace if it exists

Parameters:
xpp - the XPP parser to use
Returns:
the value of the attribute 'type' of the "XMLSchema-instance' namespace if it exists

isBase64BinaryValue

public static boolean isBase64BinaryValue(org.xmlpull.v1.XmlPullParser parser,
                                          java.lang.String attrValue)
Tells is the given value is a Base64 binary value

Parameters:
parser - the XPP parser to use
attrValue - the attribute value
Returns:
true if the value of the current tag is Base64BinaryEncoded, false if not

needsBase64Encoding

public static boolean needsBase64Encoding(java.lang.Object value)
Indicates if the value needs to be encoded as Base64

Parameters:
value - the value to check
Returns:
true if the value needs to be encoded as Base64

base64Encode

public static java.lang.String base64Encode(java.lang.Object value)
Encodes the value as a Base64 String

Parameters:
value - the value to encode
Returns:
the value encoded as a Base64 String

parseAndVerifyRequestID

public static int parseAndVerifyRequestID(java.lang.String attributeValue,
                                          org.xmlpull.v1.XmlPullParser xpp)
                                   throws org.xmlpull.v1.XmlPullParserException
Parses and verify the parsed value of the requestID

Parameters:
attributeValue - the value of the attribute
xpp - the XmlPullParser
Returns:
the int value of the resquestID
Throws:
org.xmlpull.v1.XmlPullParserException - if RequestID isn't an Integer and if requestID equals 0

addControls

public static void addControls(org.dom4j.Element element,
                               java.util.List<Control> controls)
Adds Controls to the given Element.

Parameters:
element - the element to add the Controls to
controls - a List of Controls

isRequestIdNeeded

public static boolean isRequestIdNeeded(Dsmlv2Container container)
                                 throws org.xmlpull.v1.XmlPullParserException
Indicates if a request ID is needed.

Parameters:
container - the associated container
Returns:
true if a request ID is needed (ie Processing=Parallel and ResponseOrder=Unordered)
Throws:
org.xmlpull.v1.XmlPullParserException - if the batch request has not been parsed yet

styleDocument

public static org.dom4j.Document styleDocument(org.dom4j.Document document)
XML Pretty Printer XSLT Tranformation

Parameters:
document - the Dom4j Document
Returns:
the transformed document


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.