element.getDocument().getRootElement().add( xsiNamespace );
Element valueElement = newElement.addElement( "value" ).addText(
ParserUtils.base64Encode( value ) );
valueElement
.addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
}
else
{
newElement.addElement( "value" ).setText( value.getString() );
}
}
}
}
// PRESENT FILTER
else if ( filter instanceof PresentFilter )
{
Element newElement = element.addElement( "present" );
newElement.addAttribute( "name", ( ( PresentFilter ) filter ).getAttributeDescription() );
}
// EXTENSIBLEMATCH
else if ( filter instanceof ExtensibleMatchFilter )
{
Element newElement = element.addElement( "extensibleMatch" );
ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) filter;
Value<?> value = extensibleMatchFilter.getMatchValue();
if ( value != null )
{
if ( ParserUtils.needsBase64Encoding( value ) )
{
Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
element.getDocument().getRootElement().add( xsdNamespace );
element.getDocument().getRootElement().add( xsiNamespace );
Element valueElement = newElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) );
valueElement.addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
}
else
{
newElement.addElement( "value" ).setText( value.getString() );
}