List of usage examples for org.apache.commons.digester Digester getCurrentNamespaces
public Map<String, String> getCurrentNamespaces()
From source file:org.xchain.framework.digester.DigesterNamespaceContext.java
public DigesterNamespaceContext(Digester digester) { this.xmlns = digester.getCurrentNamespaces(); }
From source file:org.xchain.framework.digester.SerializationRule.java
public void begin(String namespaceUri, String name, Attributes attributes) throws Exception { // get the digester. Digester digester = getDigester(); // store the old content handlers. oldCustomContentHandler = digester.getCustomContentHandler(); if (digester instanceof ExtendedDigester) { oldCustomLexicalHandler = ((ExtendedDigester) digester).getCustomLexicalHandler(); }/*from w w w. j a v a 2 s. c o m*/ // create the handler. handler = new RuleSerializationHandler(); // set up the handlers that will do the serialization. handler.setWrappedHandler(newHandler()); // set the new handlers. digester.setCustomContentHandler(handler); if (digester instanceof ExtendedDigester) { ((ExtendedDigester) digester).setCustomLexicalHandler(handler); } // push the buffer onto the stack. digester.push(buffer); // start the document. handler.startDocument(); // set all of the namespaces that are defined on the digester. Iterator currentNamespaceIterator = digester.getCurrentNamespaces().entrySet().iterator(); while (currentNamespaceIterator.hasNext()) { Map.Entry currentNamespace = (Map.Entry) currentNamespaceIterator.next(); handler.startPrefixMapping((String) currentNamespace.getKey(), (String) currentNamespace.getValue()); } // send the current element to the handler. if (digester.getNamespaceAware()) { handler.startElement(namespaceUri, name, digester.getCurrentElementName(), attributes); } else { handler.startElement(namespaceUri, name, name, attributes); } }