Namespace is a Flyweight Namespace that can be shared amongst nodes.
Namespace
419420421422423424425426427428429
*/ public boolean save(OutputStream outStream) { Document xmlOutDoc = DocumentHelper.createDocument(); // Building namespace Namespace dfNs = Namespace.get("", TYPES_NAMESPACE_URI); Element typesElem = xmlOutDoc .addElement(new QName(TYPES_TAG_NAME, dfNs)); // Adding default types for (Entry<String, String> entry : defaultContentType.entrySet()) {
327328329330331332333334335336337338339340
// Check the current element @SuppressWarnings("unchecked") List<Namespace> declaredNamespaces = el.declaredNamespaces(); Iterator<Namespace> itNS = declaredNamespaces.iterator(); while (itNS.hasNext()) { Namespace ns = itNS.next(); // Rule M4.2 if (ns.getURI().equals(PackageNamespaces.MARKUP_COMPATIBILITY)) throw new InvalidFormatException( "OPC Compliance error [M4.2]: A format consumer shall consider the use of the Markup Compatibility namespace to be an error."); } // Rule M4.3
125126127128129130131132133134135
.createPart( corePartName, "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"); Document doc = DocumentHelper.createDocument(); Namespace nsWordprocessinML = new Namespace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); Element elDocument = doc.addElement(new QName("document", nsWordprocessinML)); Element elBody = elDocument.addElement(new QName("body", nsWordprocessinML));
266267268269270271272273274275276
.getTargetURI()))); } // Create a content Document doc = DocumentHelper.createDocument(); Namespace nsWordprocessinML = new Namespace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); Element elDocument = doc.addElement(new QName("document", nsWordprocessinML)); Element elBody = elDocument.addElement(new QName("body", nsWordprocessinML));
116117118119120121122123124125126
258259260261262263264265266267268
9899100101102103104105106107108109
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 = modElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) ); valueElement
979899100101102103104105106107108
{ Object value = ne2.nextElement(); if ( ParserUtils.needsBase64Encoding( value ) ) { Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI ); Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI ); attributeElement.getDocument().getRootElement().add( xsdNamespace ); attributeElement.getDocument().getRootElement().add( xsiNamespace ); Element valueElement = attributeElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) );