/** * Accumulate all namespace declarations in a single {@link Namespace} instance. * This includes the Document-level {@link Namespace} but also all Bundle-level {@link Namespace}s. * * <p>This method is particular useful before serialization to XML since JAXB doesn't offer us the * means to generate prefix declaration in inner Elements. Hence, all namespaces need to be declared * at the root of the xml document. * * @param document Document from which Namespaces are accumulated * @return a new instance of {@link Namespace} */ static public Namespace accumulateAllNamespaces(Document document) { Namespace res=new Namespace(document.getNamespace()); for (Bundle b: pu.getNamedBundle(document)) { Namespace ns=b.getNamespace(); if (ns!=null) res.extendWith(ns); } return res; }
/** * Accumulate all namespace declarations in a single {@link Namespace} instance. * This includes the Document-level {@link Namespace} but also all Bundle-level {@link Namespace}s. * * <p>This method is particular useful before serialization to XML since JAXB doesn't offer us the * means to generate prefix declaration in inner Elements. Hence, all namespaces need to be declared * at the root of the xml document. * * @param document Document from which Namespaces are accumulated * @return a new instance of {@link Namespace} */ static public Namespace accumulateAllNamespaces(Document document) { Namespace res=new Namespace(document.getNamespace()); for (Bundle b: pu.getNamedBundle(document)) { Namespace ns=b.getNamespace(); if (ns!=null) res.extendWith(ns); } return res; }
public Document doAction(Document doc) { List<Bundle> bRecords = new LinkedList<Bundle>(); List<Statement> sRecords = new LinkedList<Statement>(); Namespace docNamespace=doc.getNamespace(); Namespace.withThreadNamespace(docNamespace); c.startDocument(doc.getNamespace()); for (Statement s : u.getStatement(doc)) { sRecords.add((Statement) u.doAction(s, this)); } for (Bundle bu : u.getNamedBundle(doc)) { Namespace.withThreadNamespace(new Namespace(docNamespace)); Bundle o = doAction(bu,u); if (o != null) bRecords.add(o); } return c.newDocument(doc.getNamespace(), sRecords, bRecords); }
public Document doAction(Document doc) { List<Bundle> bRecords = new LinkedList<Bundle>(); List<Statement> sRecords = new LinkedList<Statement>(); Namespace docNamespace=doc.getNamespace(); Namespace.withThreadNamespace(docNamespace); c.startDocument(doc.getNamespace()); for (Statement s : u.getStatement(doc)) { sRecords.add((Statement) u.doAction(s, this)); } for (Bundle bu : u.getNamedBundle(doc)) { Namespace.withThreadNamespace(new Namespace(docNamespace)); Bundle o = doAction(bu,u); if (o != null) bRecords.add(o); } return c.newDocument(doc.getNamespace(), sRecords, bRecords); }