jkesselm 2002/11/13 14:35:38
Modified: java/bin Tag: xslt20 xercesImpl.jar
java/src/org/apache/xml/dtm/ref/xni2dtm Tag: xslt20
DTM2XNI.java XNI2DTM.java XPath2Type.java
Log:
Modifications to make Xalan xslt20 branch comptable with current
Xerces (specifically, adapt to changes made in XNI APIs).
CAVEAT: These changes have not yet been fully tested. They pass
smoketest, but it is quite possible that some of the new functionality
-- specifically, schema type support and validation-on-demand --
has been broken. These will need to be tested carefully. However,
I felt that being able to compile and run against current Xerces was
important enough to be worth checking in.
Revision Changes Path
No revision
No revision
1.6.2.1.2.1 +2047 -2126xml-xalan/java/bin/xercesImpl.jar
<<Binary file>>
No revision
No revision
1.1.4.1.2.1 +28 -3
xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/DTM2XNI.java
Index: DTM2XNI.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/DTM2XNI.java,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -r1.1.4.1 -r1.1.4.1.2.1
--- DTM2XNI.java 14 Aug 2002 19:45:35 -0000 1.1.4.1
+++ DTM2XNI.java 13 Nov 2002 22:35:28 -0000 1.1.4.1.2.1
@@ -103,7 +103,14 @@
* */
protected org.apache.xerces.xni.Augmentations m_augs=
new org.apache.xerces.util.AugmentationsImpl();
-
+
+ // needed by new XNI APIs. Has to be _maintained_ in synch with the
+ // stream. Simplest, of course, might be to do another variant on
+ // our pseudo-SAX NamespaceSupportAtDTMNode and just update which node
+ // it's viewing as we traverse. Will that work without doing full
+ // namespace fix-up?
+ protected org.apache.xml.dtm.ref.xni2dtm.NamespaceContextAtDTMNode
m_namespaceContext;
+
/** Manefest constant: Augmentation flag for structure we added, which
* may need to be stripped out again after validation
* This flag is also referenced in XNI2DTM
@@ -186,6 +193,12 @@
m_XMLDocumentHandler = handler;
}
+ /** Get XNI listener */
+ public XMLDocumentHandler getDocumentHandler()
+ {
+ return m_XMLDocumentHandler;
+ }
+
/** Set source to read from */
public void setSource(DTM dtm,int nodeHandle)
{
@@ -231,8 +244,12 @@
docaugs.putItem(DTM2XNI_ADDED_STRUCTURE,DTM2XNI_ADDED_STRUCTURE);
}
+ // This now requires .xni.NamespaceContext as its third argument
+ // (before the augmentations). Still working on figuring out how to
+ // build one... GONK!
+ m_namespaceContext=new NamespaceContextAtDTMNode(m_dtm,pos);
m_XMLDocumentHandler.startDocument(null, m_dtm.getDocumentEncoding(pos),
- docaugs);
+ m_namespaceContext,docaugs);
// Generate the synthesized context
// %REVIEW% Reuse one rather than recreating?
@@ -407,6 +424,9 @@
// already dealt with in traverse().
break;
case DTM.ELEMENT_NODE :
+ // Update XNI namespace context to display status at this element
+ m_namespaceContext.setCurrentNode(m_dtm,node);
+
// %REVIEW% Reuse one rather than recreating?
org.apache.xerces.xni.XMLAttributes attrs =
new org.apache.xerces.util.XMLAttributesImpl();
@@ -494,7 +514,7 @@
// into the validation stream has been taken out of the
// XSLT2 spec, at least for now. I'm happy; it was a mess,
// even with the use of annotations to strip these out again.
-
+
String ns = m_dtm.getNamespaceURI(node);
if(null!=ns && ns.length()==0)
ns = null;
@@ -600,6 +620,11 @@
m_augs.putItem(DTM2XNI_ADDED_STRUCTURE,DTM2XNI_ADDED_STRUCTURE);
m_XMLDocumentHandler.endPrefixMapping(prefix,m_augs);
}
+
+ // Update our namespace context to display status at this element
+ m_namespaceContext=(NamespaceContextAtDTMNode)
+ m_namespaceContext.getParentContext();
+
break;
case DTM.CDATA_SECTION_NODE :
break;
1.2.4.1.2.7 +36 -1
xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XNI2DTM.java
Index: XNI2DTM.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XNI2DTM.java,v
retrieving revision 1.2.4.1.2.6
retrieving revision 1.2.4.1.2.7
diff -u -r1.2.4.1.2.6 -r1.2.4.1.2.7
--- XNI2DTM.java 10 Oct 2002 14:58:35 -0000 1.2.4.1.2.6
+++ XNI2DTM.java 13 Nov 2002 22:35:30 -0000 1.2.4.1.2.7
@@ -62,6 +62,7 @@
import org.apache.xerces.impl.xs.ElementPSVImpl;
import org.apache.xerces.impl.xs.psvi.XSSimpleTypeDefinition;
import org.apache.xerces.impl.xs.psvi.XSTypeDefinition;
+import org.apache.xerces.xni.NamespaceContext;
import org.apache.xerces.xni.Augmentations;
import org.apache.xerces.xni.QName;
import org.apache.xerces.xni.XMLAttributes;
@@ -71,6 +72,7 @@
import org.apache.xerces.xni.XMLResourceIdentifier;
import org.apache.xerces.xni.XMLString;
import org.apache.xerces.xni.XNIException;
+import org.apache.xerces.xni.parser.XMLDocumentSource;
import org.apache.xerces.xni.parser.XMLErrorHandler;
import org.apache.xerces.xni.parser.XMLParseException;
import org.apache.xerces.xni.parser.XMLPullParserConfiguration;
@@ -132,6 +134,9 @@
* @see setIncrementalXNISource
*/
private XMLPullParserConfiguration m_incrementalXNISource = null;
+
+ /** XNI expects us to retain this even if we aren't using it */
+ protected XMLDocumentSource m_documentSource;
/** The XNI Document locator
* %REVIEW% Should we be storing a SAX locator instead? */
@@ -566,6 +571,8 @@
* @throws XNIException Any XNI exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startDocument
+ * @deprecated
+ * @see org.apache.xml.dtm.ref.xni2dtm.XNI2DTM#startDocument(XMLLocator
locator,String encoding,NamespaceContext namespaceContext,Augmentations augs)
*/
public void startDocument(XMLLocator locator,String encoding,Augmentations
augs)
throws XNIException
@@ -577,6 +584,23 @@
}
/**
+ * XNI XMLDocumentHandler: Receive notification of the beginning of the
document.
+ *
+ * @throws XNIException Any XNI exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#startDocument
+ */
+ public void startDocument(XMLLocator locator,String encoding,
+ NamespaceContext namespaceContext,Augmentations augs)
+ throws XNIException
+ {
+ try
+ { super.startDocument(); }
+ catch(SAXException e)
+ { throw new XNIException(e); }
+ }
+
+ /**
* XNI XMLDocumentHandler: Receive notification of the end of the document.
*
* @throws XNIException Any XNI exception, possibly
@@ -894,7 +918,7 @@
} // Attribute list loop
- if(DTM2XNI.SUPPRESS_XSI_ATTRIBUTES)
+ if(DTM2XNI.SUPPRESS_XSI_ATTRIBUTES && augs!=null)
{
// Were any XNI attributes passed _around_ the validator,
// using element augmentations? If so, magic them back
@@ -1425,4 +1449,15 @@
public void endConditional(Augmentations augmentations)
throws XNIException
{ /*no op*/ }
+
+ /** @see XMLDocumentHandler#setDocumentSource */
+ public void setDocumentSource(XMLDocumentSource src)
+ {
+ m_documentSource=src;
+ }
+ /** @see XMLDocumentHandler#getDocumentSource */
+ public XMLDocumentSource getDocumentSource()
+ {
+ return m_documentSource;
+ }
} // XNI2DTM
1.1.2.1.2.5 +9 -2
xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XPath2Type.java
Index: XPath2Type.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/xni2dtm/Attic/XPath2Type.java,v
retrieving revision 1.1.2.1.2.4
retrieving revision 1.1.2.1.2.5
diff -u -r1.1.2.1.2.4 -r1.1.2.1.2.5
--- XPath2Type.java 27 Aug 2002 20:51:18 -0000 1.1.2.1.2.4
+++ XPath2Type.java 13 Nov 2002 22:35:33 -0000 1.1.2.1.2.5
@@ -379,8 +379,15 @@
* */
protected void heavyResolveTypeName(ItemPSVI psvi, boolean attr)
{
- heavyResolveTypeName(psvi,psvi.getMemberTypeDefinition(),
- psvi.getTypeDefinition(), attr);
+ if(psvi!=null)
+ heavyResolveTypeName(psvi,
+ psvi.getMemberTypeDefinition(),
+ psvi.getTypeDefinition(), attr);
+ else
+ {
+ m_namespace = "http://www.w3.org/2001/XMLSchema";
+ m_localName = attr ? "anySimpleType" : "anyType";
+ }
}
/** Modification of the XPath2 type-name resolution algorithm
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]