You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@locus.apache.org on 2000/08/29 23:04:32 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/parsers DOMParser.java
lehors 00/08/29 14:04:32
Modified: java/src/org/apache/xerces/parsers DOMParser.java
Log:
startElement creates and adds to the document a doctype
when there is none, so that the grammar can be made available through it.
This is now only done if grammar access is requested and if there is anything
to copy
Revision Changes Path
1.26 +8 -11 xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- DOMParser.java 2000/06/27 03:23:41 1.25
+++ DOMParser.java 2000/08/29 21:04:31 1.26
@@ -108,7 +108,7 @@
* DOMParser provides a parser which produces a W3C DOM tree as its output
*
*
- * @version $Id: DOMParser.java,v 1.25 2000/06/27 03:23:41 andyc Exp $
+ * @version $Id: DOMParser.java,v 1.26 2000/08/29 21:04:31 lehors Exp $
*/
public class DOMParser
extends XMLParser
@@ -1090,7 +1090,8 @@
// copy schema grammar, if needed
if (!fSeenRootElement) {
fSeenRootElement = true;
- if (fDocumentImpl != null) {
+ if (fDocumentImpl != null
+ && fGrammarAccess && fGrammarResolver.size() > 0) {
if (fDocumentType == null) {
String rootName = elementName;
String systemId = ""; // REVISIT: How do we get this value? -Ac
@@ -1106,15 +1107,11 @@
// at the DOM Level 2 CR didn't yield any
// information. -Ac
}
- if (fGrammarAccess) {
- if (fGrammarResolver.size() > 0) {
- Enumeration schemas = fGrammarResolver.nameSpaceKeys();
- Document schemaDocument = fGrammarResolver.getGrammar((String)schemas.nextElement()).getGrammarDocument();
- if (schemaDocument != null) {
- Element schema = schemaDocument.getDocumentElement();
- XUtil.copyInto(schema, fDocumentType);
- }
- }
+ Enumeration schemas = fGrammarResolver.nameSpaceKeys();
+ Document schemaDocument = fGrammarResolver.getGrammar((String)schemas.nextElement()).getGrammarDocument();
+ if (schemaDocument != null) {
+ Element schema = schemaDocument.getDocumentElement();
+ XUtil.copyInto(schema, fDocumentType);
}
}
}