You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ra...@apache.org on 2006/09/29 20:19:01 UTC
svn commit: r451375 -
/jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java
Author: rahul
Date: Fri Sep 29 11:19:00 2006
New Revision: 451375
URL: http://svn.apache.org/viewvc?view=rev&rev=451375
Log:
Add CustomDigester package scoped class, deprecated at the onset. Ideally, this should never be released. Opens the door to better XPath support.
SCXML-24
Added:
jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java (with props)
Added: jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java?view=auto&rev=451375
==============================================================================
--- jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java (added)
+++ jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java Fri Sep 29 11:19:00 2006
@@ -0,0 +1,63 @@
+/*
+ *
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.commons.scxml.io;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.ArrayStack;
+import org.apache.commons.digester.Digester;
+
+/**
+ * <p><code>Digester</code> that exposes a <code>getCurrentNamespaces()</code>
+ * method, for capturing namespace snapshots.</p>
+ *
+ * @deprecated Will be removed after the 1.8 release of Commons Digester.
+ */
+final class CustomDigester extends Digester {
+
+ /**
+ * Get the most current namespaces for all prefixes.
+ *
+ * @return Map A map with namespace prefixes as keys and most current
+ * namespace URIs for the corresponding prefixes as values
+ *
+ */
+ public Map getCurrentNamespaces() {
+ if (!namespaceAware) {
+ log.warn("Digester is not namespace aware");
+ }
+ Map currentNamespaces = new HashMap();
+ Iterator nsIterator = namespaces.entrySet().iterator();
+ while (nsIterator.hasNext()) {
+ Map.Entry nsEntry = (Map.Entry) nsIterator.next();
+ try {
+ currentNamespaces.put(nsEntry.getKey(),
+ ((ArrayStack) nsEntry.getValue()).peek());
+ } catch (RuntimeException e) {
+ // rethrow, after logging
+ log.error(e.getMessage(), e);
+ throw e;
+ }
+ }
+ return currentNamespaces;
+ }
+
+}
+
Propchange: jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/io/CustomDigester.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org