sboag 00/05/23 14:20:58
Modified: src/org/apache/xalan/xpath/dtm DTM.java
Log:
Added handling of QName stuff in DTM for XMLDocumentHandler.
Revision Changes Path
1.19 +55 -17 xml-xalan/src/org/apache/xalan/xpath/dtm/DTM.java
Index: DTM.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/dtm/DTM.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DTM.java 2000/05/10 20:27:54 1.18
+++ DTM.java 2000/05/23 21:20:57 1.19
@@ -79,6 +79,8 @@
import org.apache.xalan.xpath.xml.StringToStringTableVector;
import org.apache.xalan.xpath.xml.XSLMessages;
import org.apache.xalan.xpath.res.XPATHErrorResources;
+import org.apache.xerces.utils.QName;
+import org.apache.xerces.framework.XMLAttrList;
@@ -416,7 +418,7 @@
notifyAll();
}
}
-
+
/**
* XMLDocumentHandler API: Process element start-tag and its attributes.
* This includes pushing a new namespace context (with any
@@ -434,14 +436,13 @@
* @param attrListIndex int Starting index of this element's attributes
* in the parser's attribute table, or -1 to indicate no attributes.
*/
- public final void startElement(int elementNameIndex,
- org.apache.xerces.framework.XMLAttrList
xmlAttrList,
+ public final void startElement(QName qname,
+ XMLAttrList xmlAttrList,
int attrListIndex)
{
if(DISABLE)return;
// Need to retrive the attrList...
- String name=intToString(elementNameIndex);
String attrname, attrvalue;
// Push a new namespace context
@@ -479,24 +480,15 @@
// Scope some stuff...
int ourslot;
{
- int colonpos = name.indexOf(':');
- String prefix = (colonpos <= 0) ? null : name.substring(0, colonpos);
- // This is ugly, but we have to be able to tell if a default namespace
- // is in effect.
- if((null == prefix) && isDefaultNamespaceInEffect())
- {
- prefix = null;
- }
-
// W0 Low: Node Type.
// W0 High: Namespace
- int w0 = org.w3c.dom.Node.ELEMENT_NODE |
(stringToInt(resolveNamespace(prefix)) << 16);
+ int w0 = org.w3c.dom.Node.ELEMENT_NODE | (qname.uri << 16);
// W1: Parent
int w1 = currentParent;
// W2: Next. Initialize as 0 (unresolved)
int w2 = 0;
// W3: Tagname
- int w3 = elementNameIndex;
+ int w3 = qname.rawname;
// Add this element to the document
ourslot = appendNode(w0, w1, w2, w3);
@@ -507,7 +499,7 @@
previousSibling = 0;
- IntMap elemMap = (IntMap)m_elementDecls.get(elementNameIndex);
+ IntMap elemMap = (IntMap)m_elementDecls.get(qname.rawname);
// Append the attributes
if(attrListIndex!=-1)
@@ -595,7 +587,7 @@
* has been properly terminated.
* @param name int Index of element name in XML4J's symbol table
*/
- public final void endElement(int name)
+ public final void endElement(QName name)
{
if(DISABLE)return;
int thisElement = currentParent;
@@ -635,6 +627,52 @@
throws org.xml.sax.SAXException
{
throw new
SAXException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_SAX_API_NOT_HANDLED,
null)); //"SAX API characters(char ch[]... not handled by the DTM!");
+ }
+
+ /**
+ * callback for an element declaration.
+ *
+ * @param elementType element handle of the element being declared
+ * @param contentSpec contentSpec for the element being declared
+ * @see org.apache.xerces.framework.XMLContentSpec
+ * @exception java.lang.Exception
+ */
+ public void elementDecl(QName elementDecl, XMLContentSpec contentSpec)
throws Exception
+ {
+ }
+
+ /**
+ * callback for an attribute list declaration.
+ *
+ * @param elementType element handle for the attribute's element
+ * @param attrName string pool index of the attribute name
+ * @param attType type of attribute
+ * @param enumString String representing the values of the enumeration,
+ * if the attribute is of enumerated type, or null if it is not.
+ * @param attDefaultType an integer value denoting the DefaultDecl value
+ * @param attDefaultValue string pool index of this attribute's default
value
+ * or -1 if there is no defaultvalue
+ * @exception java.lang.Exception
+ */
+ public void attlistDecl(QName elementDecl, QName attributeDecl,
+ int attType, String enumString,
+ int attDefaultType,
+ int attDefaultValue) throws Exception
+ {
+ }
+
+ /**
+ * callback for the start of the DTD
+ * This function will be called when a <!DOCTYPE...> declaration is
+ * encountered.
+ *
+ * @param rootElementType element handle for the root element of the
document
+ * @param publicId string pool index of the DTD's public ID
+ * @param systemId string pool index of the DTD's system ID
+ * @exception java.lang.Exception
+ */
+ public void startDTD(QName rootElement, int publicId, int systemId) throws
Exception
+ {
}
/**