public static void writeProperty(XMLStreamWriter xmlStreamWriter, HierarchicalProperty prop)
      throws XMLStreamException
   {
      String uri = prop.getName().getNamespaceURI();

      String prefix = xmlStreamWriter.getNamespaceContext().getPrefix(uri);

      if (prefix == null)
      {
         prefix = "";
      }

      String local = prop.getName().getLocalPart();

      if (prop.getValue() == null)
      {

         if (prop.getChildren().size() != 0)
         {
            xmlStreamWriter.writeStartElement(prefix, local, uri);
            if (!uri.equalsIgnoreCase("DAV:"))
            {
               xmlStreamWriter.writeNamespace(prefix, uri);
            }

            writeAttributes(xmlStreamWriter, prop);

            for (int i = 0; i < prop.getChildren().size(); i++)
            {
               HierarchicalProperty property = prop.getChildren().get(i);
               writeProperty(xmlStreamWriter, property);
            }
            xmlStreamWriter.writeEndElement();
         }
         else
         {
            xmlStreamWriter.writeEmptyElement(prefix, local, uri);
            if (!uri.equalsIgnoreCase("DAV:"))
            {
               xmlStreamWriter.writeNamespace(prefix, uri);
            }

            writeAttributes(xmlStreamWriter, prop);
         }

      }
      else
      {
         xmlStreamWriter.writeStartElement(prefix, local, uri);

         if (!uri.equalsIgnoreCase("DAV:"))
         {
            xmlStreamWriter.writeNamespace(prefix, uri);
         }

         writeAttributes(xmlStreamWriter, prop);
         xmlStreamWriter.writeCharacters(prop.getValue());
         
         xmlStreamWriter.writeEndElement();
      }
   }
public static void writeProperty ( XMLStreamWriter xmlStreamWriter , HierarchicalProperty prop ) throws XMLStreamException { String uri = prop . getName ( ) . getNamespaceURI ( ) ; String prefix = xmlStreamWriter . getNamespaceContext ( ) . getPrefix ( uri ) ; if ( prefix == null ) { prefix = "" ; } String local = prop . getName ( ) . getLocalPart ( ) ; if ( prop . getValue ( ) == null ) { if ( prop . getChildren ( ) . size ( ) != 0 ) { xmlStreamWriter . writeStartElement ( prefix , local , uri ) ; if ( ! uri . equalsIgnoreCase ( "DAV:" ) ) { xmlStreamWriter . writeNamespace ( prefix , uri ) ; } writeAttributes ( xmlStreamWriter , prop ) ; for ( int i = 0 ; i < prop . getChildren ( ) . size ( ) ; i ++ ) { HierarchicalProperty property = prop . getChildren ( ) . get ( i ) ; writeProperty ( xmlStreamWriter , property ) ; } xmlStreamWriter . writeEndElement ( ) ; } else { xmlStreamWriter . writeEmptyElement ( prefix , local , uri ) ; if ( ! uri . equalsIgnoreCase ( "DAV:" ) ) { xmlStreamWriter . writeNamespace ( prefix , uri ) ; } writeAttributes ( xmlStreamWriter , prop ) ; } } else { xmlStreamWriter . writeStartElement ( prefix , local , uri ) ; if ( ! uri . equalsIgnoreCase ( "DAV:" ) ) { xmlStreamWriter . writeNamespace ( prefix , uri ) ; } writeAttributes ( xmlStreamWriter , prop ) ; xmlStreamWriter . writeCharacters ( prop . getValue ( ) ) ; xmlStreamWriter . writeEndElement ( ) ; } }
Writes the statuses of property into XML.

@param xmlStreamWriter XML writer
@param prop property
@throws XMLStreamException {@link XMLStreamException}