You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2006/01/23 17:30:33 UTC

svn commit: r371577 - /xerces/java/trunk/src/org/apache/xerces/impl/dtd/DTDGrammar.java

Author: mrglavas
Date: Mon Jan 23 08:30:31 2006
New Revision: 371577

URL: http://svn.apache.org/viewcvs?rev=371577&view=rev
Log:
Addressing JIRA Issue #618:
http://issues.apache.org/jira/browse/XERCESJ-618

Adding a method for retrieving the content spec index for an element declaration.
This has been requested by several members of the community over the years since
there is no other way to get this information aside from hacking up a local copy
of the class.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/dtd/DTDGrammar.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/dtd/DTDGrammar.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/dtd/DTDGrammar.java?rev=371577&r1=371576&r2=371577&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dtd/DTDGrammar.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dtd/DTDGrammar.java Mon Jan 23 08:30:31 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2002,2004,2005 The Apache Software Foundation.
+ * Copyright 1999-2002,2004-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.
@@ -1432,6 +1432,20 @@
         contentSpec.value      = fContentSpecValue[chunk][index];
         contentSpec.otherValue = fContentSpecOtherValue[chunk][index];
         return true;
+    }
+    
+    /**
+     * Returns the index to the content spec for the given element 
+     * declaration, or <code>-1</code> if the element declaration
+     * index was invalid.
+     */
+    public int getContentSpecIndex(int elementDeclIndex) {
+        if (elementDeclIndex < 0 || elementDeclIndex >= fElementDeclCount) {
+            return -1;
+        }
+        final int chunk = elementDeclIndex >> CHUNK_SHIFT;
+        final int index = elementDeclIndex & CHUNK_MASK;
+        return fElementDeclContentSpecIndex[chunk][index];
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org