protected void marshallEncryptionDocument(EncryptionDocument ed, LittleEndianByteArrayOutputStream os) { XmlOptions xo = new XmlOptions(); xo.setCharacterEncoding("UTF-8"); Map<String,String> nsMap = new HashMap<>(); nsMap.put(passwordUri.toString(),"p"); nsMap.put(certificateUri.toString(), "c"); xo.setUseDefaultNamespace(); xo.setSaveSuggestedPrefixes(nsMap); xo.setSaveNamespacesFirst(); xo.setSaveAggressiveNamespaces(); // setting standalone doesn't work with xmlbeans-2.3 & 2.6 // ed.documentProperties().setStandalone(true); xo.setSaveNoXmlDecl(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { bos.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n".getBytes("UTF-8")); ed.save(bos, xo); bos.writeTo(os); } catch (IOException e) { throw new EncryptedDocumentException("error marshalling encryption info document", e); } }
public void setSaveNamespacesFirst(boolean b) { if (b) super.setSaveNamespacesFirst(); else remove( SAVE_NAMESPACES_FIRST ); }
public void setSaveNamespacesFirst(boolean b) { if (b) super.setSaveNamespacesFirst(); else remove( SAVE_NAMESPACES_FIRST ); }
public void setSaveNamespacesFirst(boolean b) { if (b) super.setSaveNamespacesFirst(); else remove( SAVE_NAMESPACES_FIRST ); }
/** * @return the default XmlOptions used in responses */ public static XmlOptions getXmlOptions() { return new XmlOptions() .setSaveNamespacesFirst() .setSaveSuggestedPrefixes(PREFIXES) .setSaveAggressiveNamespaces() .setSavePrettyPrint(); }
protected void marshallEncryptionDocument(EncryptionDocument ed, LittleEndianByteArrayOutputStream os) { XmlOptions xo = new XmlOptions(); xo.setCharacterEncoding("UTF-8"); Map<String,String> nsMap = new HashMap<>(); nsMap.put(passwordUri.toString(),"p"); nsMap.put(certificateUri.toString(), "c"); xo.setUseDefaultNamespace(); xo.setSaveSuggestedPrefixes(nsMap); xo.setSaveNamespacesFirst(); xo.setSaveAggressiveNamespaces(); // setting standalone doesn't work with xmlbeans-2.3 & 2.6 // ed.documentProperties().setStandalone(true); xo.setSaveNoXmlDecl(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { bos.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n".getBytes("UTF-8")); ed.save(bos, xo); bos.writeTo(os); } catch (IOException e) { throw new EncryptedDocumentException("error marshalling encryption info document", e); } }
public XmlOptions getSaveOptions( boolean prettyPrint ) { XmlOptions opts = new XmlOptions(); opts.setSaveOuter() ; // opts.setSaveImplicitNamespaces( ImplicitNamespaces ) ; opts.setSaveNamespacesFirst() ; opts.setSaveAggressiveNamespaces() ; if( prettyPrint ) { opts.setSavePrettyPrint() ; opts.setSavePrettyPrintIndent( prettyPrintIndent ) ; } return opts ; }
/** * Get the XML options for SOS 1.0.0 * * @return SOS 1.0.0 XML options */ public XmlOptions getXmlOptions() { if (xmlOptions == null) { lock.lock(); try { if (xmlOptions == null) { xmlOptions = new XmlOptions(); Map<String, String> prefixes = getPrefixMap(); xmlOptions.setSaveSuggestedPrefixes(prefixes); xmlOptions.setSaveImplicitNamespaces(prefixes); xmlOptions.setSaveAggressiveNamespaces(); if (prettyPrint) { xmlOptions.setSavePrettyPrint(); } xmlOptions.setSaveNamespacesFirst(); xmlOptions.setCharacterEncoding(characterEncoding); } } finally { lock.unlock(); } } return xmlOptions; }
/** * Get the XML options for SOS 1.0.0 * * @return SOS 1.0.0 XML options */ public XmlOptions getXmlOptions() { if (xmlOptions == null) { lock.lock(); try { if (xmlOptions == null) { xmlOptions = new XmlOptions(); Map<String, String> prefixes = getPrefixMap(); xmlOptions.setSaveSuggestedPrefixes(prefixes); xmlOptions.setSaveImplicitNamespaces(prefixes); xmlOptions.setSaveAggressiveNamespaces(); if (prettyPrint) { xmlOptions.setSavePrettyPrint(); } xmlOptions.setSaveNamespacesFirst(); xmlOptions.setCharacterEncoding(characterEncoding); } } finally { lock.unlock(); } } return xmlOptions; }
/** * Returns the <code>XmlOptions</code> required to produce * a text representation of the emitted XML. * If <code>prettyPrint</code> is true, the text will be * indented according to the <code>prettyPrintIndent</code> setting. * * @param prettyPrint * @return XmlOptions */ public XmlOptions getSaveOptions( boolean prettyPrint ) { XmlOptions opts = new XmlOptions(); opts.setSaveOuter() ; // opts.setSaveImplicitNamespaces( ImplicitNamespaces ) ; opts.setSaveNamespacesFirst() ; opts.setSaveAggressiveNamespaces() ; if( prettyPrint ) { opts.setSavePrettyPrint() ; opts.setSavePrettyPrintIndent( prettyPrintIndent ) ; } return opts ; }