# HG changeset patch # User aefimov # Date 1484913000 -10800 # Node ID e56b3e089035589b3ae8cbd4c9dfd8f34ca1bd1e # Parent 35561b665acd1a34333144a6a5b30d577df0e9f5 8169011: Resizing XML parse trees Reviewed-by: joehw diff -r 35561b665acd -r e56b3e089035 src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java --- a/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java Mon Oct 24 17:02:29 2016 +0300 +++ b/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java Fri Jan 20 14:50:00 2017 +0300 @@ -1,13 +1,14 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright 2005 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 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 * @@ -136,7 +137,7 @@ if (DEBUG_START_END_ELEMENT) System.out.println(">>> scanStartElementNS()"); // Note: namespace processing is on by default - fEntityScanner.scanQName(fElementQName, NameType.ATTRIBUTE); + fEntityScanner.scanQName(fElementQName, NameType.ELEMENTSTART); // REVISIT - [Q] Why do we need this local variable? -- mrglavas String rawname = fElementQName.rawname; if (fBindNamespaces) { @@ -346,7 +347,7 @@ protected void scanStartElementName () throws IOException, XNIException { // Note: namespace processing is on by default - fEntityScanner.scanQName(fElementQName, NameType.ATTRIBUTE); + fEntityScanner.scanQName(fElementQName, NameType.ELEMENTSTART); // Must skip spaces here because the DTD scanner // would consume them at the end of the external subset. fSawSpace = fEntityScanner.skipSpaces(); @@ -572,7 +573,7 @@ System.out.println(">>> scanAttribute()"); // name - fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTE); + fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); // equals fEntityScanner.skipSpaces(); diff -r 35561b665acd -r e56b3e089035 src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java --- a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Mon Oct 24 17:02:29 2016 +0300 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Fri Jan 20 14:50:00 2017 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. */ /* @@ -1208,7 +1208,7 @@ // definitions while (!fEntityScanner.skipChar('>', null)) { - String name = fEntityScanner.scanName(NameType.ATTRIBUTE); + String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); if (name == null) { reportFatalError("AttNameRequiredInAttDef", new Object[]{elName}); @@ -1352,7 +1352,7 @@ fMarkUpDepth++; do { skipSeparator(false, !scanningInternalSubset()); - String aName = fEntityScanner.scanName(NameType.ATTRIBUTE); + String aName = fEntityScanner.scanName(NameType.ATTRIBUTENAME); if (aName == null) { reportFatalError("MSG_NAME_REQUIRED_IN_NOTATIONTYPE", new Object[]{elName, atName}); diff -r 35561b665acd -r e56b3e089035 src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java --- a/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Mon Oct 24 17:02:29 2016 +0300 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Fri Jan 20 14:50:00 2017 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. */ /* @@ -411,7 +411,7 @@ if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name - fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTE); + fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); // equals fEntityScanner.skipSpaces(); diff -r 35561b665acd -r e56b3e089035 src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java --- a/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java Mon Oct 24 17:02:29 2016 +0300 +++ b/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java Fri Jan 20 14:50:00 2017 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -562,6 +562,14 @@ switchToXML11Scanner(); } + if (fEventType == XMLStreamConstants.CHARACTERS || + fEventType == XMLStreamConstants.ENTITY_REFERENCE || + fEventType == XMLStreamConstants.PROCESSING_INSTRUCTION || + fEventType == XMLStreamConstants.COMMENT || + fEventType == XMLStreamConstants.CDATA) { + fEntityScanner.checkNodeCount(fEntityScanner.fCurrentEntity); + } + return fEventType; } catch (IOException ex) { // if this error occured trying to resolve the external DTD subset