Skip to content
Commits on Source (11)
......@@ -21,3 +21,4 @@ syntax: glob
*.ipr
*.iws
/.idea/
/bin/
language: java
jdk:
- oraclejdk7
- openjdk7
- openjdk8
branches:
only:
- master
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
......@@ -6,7 +6,7 @@ The gold standard Stax XML API implementation. Now at Github.
[![Build Status](https://travis-ci.org/FasterXML/woodstox.svg)](https://travis-ci.org/FasterXML/woodstox)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.woodstox/woodstox-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.woodstox/woodstox-core/)
[![Javadoc](https://javadoc-emblem.rhcloud.com/doc/com.fasterxml.woodstox/woodstox-core/badge.svg)](http://www.javadoc.io/doc/com.fasterxml.woodstox/woodstox-core)
[![Javadoc](https://javadoc.io/badge/com.fasterxml.woodstox/woodstox-core.svg)](http://www.javadoc.io/doc/com.fasterxml.woodstox/woodstox-core)
# Get it!
......@@ -17,7 +17,7 @@ Coordinates for this are:
* Group id: `com.fasterxml.woodstox`
* Artifact id: `woodstox-core`
* Latest published version: 5.0.2
* Latest published version: 5.0.3 (23-Aug-2016)
* (NOTE! Version `5.0.0` was accidentally released as broken, not containing actual classes -- 5.0.1 is the first functioning 5.x version).
Note that Maven id has changed since Woodstox 4.x.
......@@ -31,3 +31,12 @@ and some other Stax implementations (like [Aalto](../../../aalto-xml).
Optional dependency is [Multi-Schema Validator (MSV)](https://github.com/kohsuke/msv) that is needed if
using XML Schema or RelaxNG validation functionality
## License
Woodstox 5.x is licensed under [Apache 2](http://www.apache.org/licenses/LICENSE-2.0.txt) license.
## Documentation etc
* User mailing list for Qs: [woodstox-user](https://groups.google.com/forum/#!forum/woodstox-user) Google group
* Check out [project Wiki](../../wiki) for javadocs
libwoodstox-java (1:5.1.0-1) UNRELEASED; urgency=medium
* New upstream release.
+ Update dependencies accordingly.
* Update Vcs-* after moving to salsa.
* Update to debhelper 11.
* Bump Standards-Version to 4.1.4.
-- Giovanni Mascellani <gio@debian.org> Sat, 23 Jun 2018 12:23:31 +0200
libwoodstox-java (1:5.0.3-2) experimental; urgency=medium
* Install POM relocations for backward compatibility.
......
......@@ -3,22 +3,22 @@ Section: java
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders: Giovanni Mascellani <gio@debian.org>
Build-Depends: debhelper (>= 10), maven-debian-helper,
Build-Depends: debhelper (>= 11), maven-debian-helper,
libmaven-bundle-plugin-java, libmaven-javadoc-plugin-java,
libmaven-compiler-plugin-java
Build-Depends-Indep: default-jdk, junit4, libmsv-java,
libstax2-api-java (>= 4.0.0), librelaxng-datatype-java,
libstax2-api-java (>= 4.1), librelaxng-datatype-java,
libknopflerfish-osgi-framework-java, libstax-java
Standards-Version: 4.1.1
Standards-Version: 4.1.4
Homepage: https://github.com/FasterXML/woodstox
Vcs-Git: https://anonscm.debian.org/git/pkg-java/libwoodstox-java.git
Vcs-Browser: https://anonscm.debian.org/git/pkg-java/libwoodstox-java.git
Vcs-Browser: https://salsa.debian.org/java-team/libwoodstox-java
Vcs-Git: https://salsa.debian.org/java-team/libwoodstox-java.git
Package: libwoodstox-java
Architecture: all
Depends: ${misc:Depends}, libmsv-java, libstax2-api-java (>= 4.0.0),
librelaxng-datatype-java, libknopflerfish-osgi-framework-java,
libstax-java
Depends: ${misc:Depends}, ${maven:Depends}, libmsv-java,
libstax2-api-java (>= 4.1), librelaxng-datatype-java,
libknopflerfish-osgi-framework-java
Description: High-performance XML processor
Woodstox is a high-performance, validating, namespace-aware,
StAX-compliant (JSR-173), open source XML-processor written in
......
......@@ -4,8 +4,8 @@ Upstream-Contact: Tatu Saloranta <tsaloranta@gmail.com>
Source: https://github.com/FasterXML/woodstox
Files: *
Copyright: © 2004-2016, Tatu Saloranta <tsaloranta@gmail.com>
© 2010-2016, FasterXML.com
Copyright: © 2004-2018, Tatu Saloranta <tsaloranta@gmail.com>
© 2010-2018, FasterXML.com
License: Apache-2.0
On Debian systems, a copy of the Apache license version 2.0 is
available in '/usr/share/common-licenses/Apache-2.0'.
......@@ -20,7 +20,7 @@ License: free
Files: debian/*
Copyright: © 2007, Vincent Fourmond <fourmond@debian.org>
© 2011-2017, Giovanni Mascellani <gio@debian.org>
© 2011-2018, Giovanni Mascellani <gio@debian.org>
License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
......@@ -4,12 +4,12 @@
<parent>
<groupId>com.fasterxml</groupId>
<artifactId>oss-parent</artifactId>
<version>24</version>
<version>33</version>
</parent>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>5.0.3</version>
<version>5.1.0</version>
<packaging>bundle</packaging>
<name>Woodstox</name>
<description>
......@@ -35,7 +35,7 @@
<connection>scm:git:git@github.com:FasterXML/woodstox.git</connection>
<developerConnection>scm:git:git@github.com:FasterXML/woodstox.git</developerConnection>
<url>https://github.com/FasterXML/woodstox</url>
<tag>woodstox-core-5.0.3</tag>
<tag>woodstox-core-5.1.0</tag>
</scm>
<properties>
......@@ -49,6 +49,11 @@
-->
<osgi.export>com.ctc.wstx.*;version=${project.version}</osgi.export>
<!-- 5.1 adds "Automatic-Module-Name" for JDK 9
Note: choice between Maven group id and Java package bit tricky;
choose latter at this point (may change in future)
-->
<jdk.module.name>com.ctc.wstx</jdk.module.name>
</properties>
<licenses>
......@@ -62,7 +67,6 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
......@@ -75,7 +79,6 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<excludes>
<exclude>failing/*.java</exclude>
......@@ -94,26 +97,20 @@
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions combine.children="merge">
<Automatic-Module-Name>${jdk.module.name}</Automatic-Module-Name>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- First mandatory (and transitive) dependencies -->
<dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
<version>1.0-2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<!-- 10-Dec-2015, tatu: For Woodstox 5.1, upgrade to 4.0
-->
<version>3.1.4</version>
<!-- 27-Mar-2018, tatu: Upgraded from 3.1 for Woodstox 5.1 -->
<version>4.1</version>
</dependency>
<!-- Then optional ones (need for build, possibly
......@@ -160,7 +157,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.2.0</version>
<version>1.4.0</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
......@@ -171,7 +168,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
......
......@@ -4,6 +4,15 @@ Project: woodstox
=== Releases ===
------------------------------------------------------------------------
5.1.0 (31-Mar-2018)
#23: Text content is not validated correctly when copying events to `XmlStreamWriter`
(reported by hxc9@github)
#43: `CompactStartElement` appears to incorrectly classify attributes as default
(reported by Jonathan T)
- Add `Automatic-Module-Name` indicator in jar metadata, for Java 9
- Upgrade `stax2-api` dependency to 4.1 (from 3.1)
5.0.3 (23-Aug-2016)
#13: `BasicStreamReader.getElementText()` behavior doesn't match Java documentation
......
......@@ -5,7 +5,6 @@ import java.util.*;
import org.codehaus.stax2.XMLStreamProperties;
import com.ctc.wstx.util.ArgUtil;
import com.ctc.wstx.util.DataUtil;
/**
* Shared common base class for variour configuration container implementations
......@@ -45,13 +44,13 @@ abstract class CommonConfig
///////////////////////////////////////////////////////////////////////
*/
final static int PROP_IMPL_NAME = 1;
final static int PROP_IMPL_VERSION = 2;
final static int CPROP_IMPL_NAME = 1;
final static int CPROP_IMPL_VERSION = 2;
final static int PROP_SUPPORTS_XML11 = 3;
final static int PROP_SUPPORT_XMLID = 4;
final static int CPROP_SUPPORTS_XML11 = 3;
final static int CPROP_SUPPORT_XMLID = 4;
final static int PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE = 5;
final static int CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE = 5;
/**
* Map to use for converting from String property ids to enumeration
......@@ -60,28 +59,24 @@ abstract class CommonConfig
final static HashMap<String,Integer> sStdProperties = new HashMap<String,Integer>(16);
static {
// Basic information about the implementation:
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_NAME,
DataUtil.Integer(PROP_IMPL_NAME));
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_VERSION,
DataUtil.Integer(PROP_IMPL_VERSION));
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_NAME, CPROP_IMPL_NAME);
sStdProperties.put(XMLStreamProperties.XSP_IMPLEMENTATION_VERSION, CPROP_IMPL_VERSION);
// XML version support:
sStdProperties.put(XMLStreamProperties.XSP_SUPPORTS_XML11,
DataUtil.Integer(PROP_SUPPORTS_XML11));
sStdProperties.put(XMLStreamProperties.XSP_SUPPORTS_XML11, CPROP_SUPPORTS_XML11);
// Xml:id support:
sStdProperties.put(XMLStreamProperties.XSP_SUPPORT_XMLID,
DataUtil.Integer(PROP_SUPPORT_XMLID));
sStdProperties.put(XMLStreamProperties.XSP_SUPPORT_XMLID, CPROP_SUPPORT_XMLID);
sStdProperties.put(WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE,
DataUtil.Integer(PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE));
CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE);
/* 23-Apr-2008, tatus: Additional interoperability property,
* one that Sun implementation uses. Can map to Stax2
* property quite easily.
*/
sStdProperties.put("http://java.sun.com/xml/stream/properties/implementation-name",
DataUtil.Integer(PROP_IMPL_NAME));
CPROP_IMPL_NAME);
}
/*
......@@ -110,6 +105,10 @@ abstract class CommonConfig
*/
protected CommonConfig(CommonConfig base) {
mReturnNullForDefaultNamespace = (base == null)
/* 27-Mar-2018, tatu: What the hell... why does it take it from System properties?
* I should have done better code review; Woodstox should not do that.
* System properties are evil for shared libraries, not to be used.
*/
? Boolean.getBoolean(WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE)
: base.mReturnNullForDefaultNamespace;
}
......@@ -256,7 +255,7 @@ abstract class CommonConfig
{
// Only one settable property...
switch (id) {
case PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
case CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
mReturnNullForDefaultNamespace = ArgUtil.convertToBoolean(propName, value);
return true;
}
......@@ -266,15 +265,15 @@ abstract class CommonConfig
protected Object getStdProperty(int id)
{
switch (id) {
case PROP_IMPL_NAME:
case CPROP_IMPL_NAME:
return IMPL_NAME;
case PROP_IMPL_VERSION:
case CPROP_IMPL_VERSION:
return IMPL_VERSION;
case PROP_SUPPORTS_XML11:
case CPROP_SUPPORTS_XML11:
return doesSupportXml11() ? Boolean.TRUE : Boolean.FALSE;
case PROP_SUPPORT_XMLID:
case CPROP_SUPPORT_XMLID:
return doesSupportXmlId() ? Boolean.TRUE : Boolean.FALSE;
case PROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
case CPROP_RETURN_NULL_FOR_DEFAULT_NAMESPACE:
return returnNullForDefaultNamespace() ? Boolean.TRUE : Boolean.FALSE;
default: // sanity check, should never happen
throw new IllegalStateException("Internal error: no handler for property with internal id "+id+".");
......
......@@ -251,85 +251,82 @@ public final class ReaderConfig
final static HashMap<String,Integer> sProperties = new HashMap<String,Integer>(64); // we have about 40 entries
static {
// Standard ones; support for features
sProperties.put(XMLInputFactory.IS_COALESCING,
DataUtil.Integer(PROP_COALESCE_TEXT));
sProperties.put(XMLInputFactory.IS_COALESCING, PROP_COALESCE_TEXT);
sProperties.put(XMLInputFactory.IS_NAMESPACE_AWARE,
DataUtil.Integer(PROP_NAMESPACE_AWARE));
PROP_NAMESPACE_AWARE);
sProperties.put(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
DataUtil.Integer(PROP_REPLACE_ENTITY_REFS));
PROP_REPLACE_ENTITY_REFS);
sProperties.put(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,
DataUtil.Integer(PROP_SUPPORT_EXTERNAL_ENTITIES));
PROP_SUPPORT_EXTERNAL_ENTITIES);
sProperties.put(XMLInputFactory.IS_VALIDATING,
DataUtil.Integer(PROP_VALIDATE_AGAINST_DTD));
PROP_VALIDATE_AGAINST_DTD);
sProperties.put(XMLInputFactory.SUPPORT_DTD,
DataUtil.Integer(PROP_SUPPORT_DTD));
PROP_SUPPORT_DTD);
// Standard ones; pluggable components
sProperties.put(XMLInputFactory.ALLOCATOR,
DataUtil.Integer(PROP_EVENT_ALLOCATOR));
PROP_EVENT_ALLOCATOR);
sProperties.put(XMLInputFactory.REPORTER,
DataUtil.Integer(PROP_WARNING_REPORTER));
PROP_WARNING_REPORTER);
sProperties.put(XMLInputFactory.RESOLVER,
DataUtil.Integer(PROP_XML_RESOLVER));
PROP_XML_RESOLVER);
// StAX2-introduced flags:
sProperties.put(XMLInputFactory2.P_INTERN_NAMES,
DataUtil.Integer(PROP_INTERN_NAMES));
PROP_INTERN_NAMES);
sProperties.put(XMLInputFactory2.P_INTERN_NS_URIS,
DataUtil.Integer(PROP_INTERN_NS_URIS));
PROP_INTERN_NS_URIS);
sProperties.put(XMLInputFactory2.P_REPORT_CDATA,
DataUtil.Integer(PROP_REPORT_CDATA));
PROP_REPORT_CDATA);
sProperties.put(XMLInputFactory2.P_REPORT_PROLOG_WHITESPACE,
DataUtil.Integer(PROP_REPORT_PROLOG_WS));
PROP_REPORT_PROLOG_WS);
sProperties.put(XMLInputFactory2.P_PRESERVE_LOCATION,
DataUtil.Integer(PROP_PRESERVE_LOCATION));
PROP_PRESERVE_LOCATION);
sProperties.put(XMLInputFactory2.P_AUTO_CLOSE_INPUT,
DataUtil.Integer(PROP_AUTO_CLOSE_INPUT));
PROP_AUTO_CLOSE_INPUT);
sProperties.put(XMLInputFactory2.XSP_SUPPORT_XMLID,
DataUtil.Integer(PROP_SUPPORT_XMLID));
PROP_SUPPORT_XMLID);
sProperties.put(XMLInputFactory2.P_DTD_OVERRIDE,
DataUtil.Integer(PROP_DTD_OVERRIDE));
PROP_DTD_OVERRIDE);
// Non-standard ones, flags:
sProperties.put(WstxInputProperties.P_CACHE_DTDS,
DataUtil.Integer(PROP_CACHE_DTDS));
sProperties.put(WstxInputProperties.P_CACHE_DTDS, PROP_CACHE_DTDS);
sProperties.put(WstxInputProperties.P_CACHE_DTDS_BY_PUBLIC_ID,
DataUtil.Integer(PROP_CACHE_DTDS_BY_PUBLIC_ID));
sProperties.put(XMLInputFactory2.P_LAZY_PARSING,
DataUtil.Integer(PROP_LAZY_PARSING));
PROP_CACHE_DTDS_BY_PUBLIC_ID);
sProperties.put(XMLInputFactory2.P_LAZY_PARSING, PROP_LAZY_PARSING);
/*
sProperties.put(WstxInputProperties.P_SUPPORT_DTDPP,
DataUtil.Integer(PROP_SUPPORT_DTDPP));
PROP_SUPPORT_DTDPP));
*/
sProperties.put(WstxInputProperties.P_TREAT_CHAR_REFS_AS_ENTS,
DataUtil.Integer(PROP_TREAT_CHAR_REFS_AS_ENTS));
sProperties.put(WstxInputProperties.P_NORMALIZE_LFS,
DataUtil.Integer(PROP_NORMALIZE_LFS));
PROP_TREAT_CHAR_REFS_AS_ENTS);
sProperties.put(WstxInputProperties.P_NORMALIZE_LFS, PROP_NORMALIZE_LFS);
// Non-standard ones, non-flags:
sProperties.put(WstxInputProperties.P_INPUT_BUFFER_LENGTH,
DataUtil.Integer(PROP_INPUT_BUFFER_LENGTH));
PROP_INPUT_BUFFER_LENGTH);
sProperties.put(WstxInputProperties.P_MIN_TEXT_SEGMENT,
DataUtil.Integer(PROP_MIN_TEXT_SEGMENT));
PROP_MIN_TEXT_SEGMENT);
sProperties.put(WstxInputProperties.P_MAX_ATTRIBUTES_PER_ELEMENT,
DataUtil.Integer(PROP_MAX_ATTRIBUTES_PER_ELEMENT));
PROP_MAX_ATTRIBUTES_PER_ELEMENT);
sProperties.put(WstxInputProperties.P_MAX_ATTRIBUTE_SIZE,
DataUtil.Integer(PROP_MAX_ATTRIBUTE_SIZE));
PROP_MAX_ATTRIBUTE_SIZE);
sProperties.put(WstxInputProperties.P_MAX_CHILDREN_PER_ELEMENT,
DataUtil.Integer(PROP_MAX_CHILDREN_PER_ELEMENT));
PROP_MAX_CHILDREN_PER_ELEMENT);
sProperties.put(WstxInputProperties.P_MAX_TEXT_LENGTH,
DataUtil.Integer(PROP_MAX_TEXT_LENGTH));
PROP_MAX_TEXT_LENGTH);
sProperties.put(WstxInputProperties.P_MAX_ELEMENT_COUNT,
DataUtil.Integer(PROP_MAX_ELEMENT_COUNT));
PROP_MAX_ELEMENT_COUNT);
sProperties.put(WstxInputProperties.P_MAX_ELEMENT_DEPTH,
DataUtil.Integer(PROP_MAX_ELEMENT_DEPTH));
PROP_MAX_ELEMENT_DEPTH);
sProperties.put(WstxInputProperties.P_MAX_ENTITY_DEPTH,
DataUtil.Integer(PROP_MAX_ENTITY_DEPTH));
PROP_MAX_ENTITY_DEPTH);
sProperties.put(WstxInputProperties.P_MAX_ENTITY_COUNT,
DataUtil.Integer(PROP_MAX_ENTITY_COUNT));
sProperties.put(WstxInputProperties.P_MAX_CHARACTERS,
DataUtil.Integer(PROP_MAX_CHARACTERS));
PROP_MAX_ENTITY_COUNT);
sProperties.put(WstxInputProperties.P_MAX_CHARACTERS, PROP_MAX_CHARACTERS);
{
@SuppressWarnings("deprecation")
......@@ -337,15 +334,15 @@ public final class ReaderConfig
sProperties.put(key, Integer.valueOf(PROP_CUSTOM_INTERNAL_ENTITIES));
}
sProperties.put(WstxInputProperties.P_DTD_RESOLVER,
DataUtil.Integer(PROP_DTD_RESOLVER));
PROP_DTD_RESOLVER);
sProperties.put(WstxInputProperties.P_ENTITY_RESOLVER,
DataUtil.Integer(PROP_ENTITY_RESOLVER));
PROP_ENTITY_RESOLVER);
sProperties.put(WstxInputProperties.P_UNDECLARED_ENTITY_RESOLVER,
DataUtil.Integer(PROP_UNDECLARED_ENTITY_RESOLVER));
PROP_UNDECLARED_ENTITY_RESOLVER);
sProperties.put(WstxInputProperties.P_BASE_URL,
DataUtil.Integer(PROP_BASE_URL));
PROP_BASE_URL);
sProperties.put(WstxInputProperties.P_INPUT_PARSING_MODE,
DataUtil.Integer(PROP_INPUT_PARSING_MODE));
PROP_INPUT_PARSING_MODE);
}
/*
......@@ -1414,28 +1411,28 @@ public final class ReaderConfig
// then object values:
case PROP_INPUT_BUFFER_LENGTH:
return DataUtil.Integer(getInputBufferLength());
return getInputBufferLength();
case PROP_MAX_ATTRIBUTES_PER_ELEMENT:
return DataUtil.Integer(getMaxAttributesPerElement());
return getMaxAttributesPerElement();
case PROP_MAX_ATTRIBUTE_SIZE:
return DataUtil.Integer(getMaxAttributeSize());
return getMaxAttributeSize();
case PROP_MAX_CHILDREN_PER_ELEMENT:
return DataUtil.Integer(getMaxChildrenPerElement());
return getMaxChildrenPerElement();
case PROP_MAX_ELEMENT_DEPTH:
return DataUtil.Integer(getMaxElementDepth());
return getMaxElementDepth();
case PROP_MAX_ELEMENT_COUNT:
return Long.valueOf(getMaxElementCount());
return getMaxElementCount();
case PROP_MAX_CHARACTERS:
return Long.valueOf(getMaxCharacters());
return getMaxCharacters();
case PROP_MAX_TEXT_LENGTH:
return Long.valueOf(getMaxTextLength());
return getMaxTextLength();
case PROP_MAX_ENTITY_DEPTH:
return DataUtil.Integer(getMaxEntityDepth());
return getMaxEntityDepth();
case PROP_MAX_ENTITY_COUNT:
return Long.valueOf(getMaxEntityCount());
return getMaxEntityCount();
case PROP_MIN_TEXT_SEGMENT:
return DataUtil.Integer(getShortestReportedTextSegment());
return getShortestReportedTextSegment();
case PROP_CUSTOM_INTERNAL_ENTITIES:
return getCustomInternalEntities();
case PROP_DTD_RESOLVER:
......
......@@ -23,9 +23,9 @@ public final class WstxInputProperties
public final static String UNKNOWN_ATTR_TYPE = "CDATA";
/*
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Simple on/off settings:
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
// // // Normalization:
......@@ -54,13 +54,22 @@ public final class WstxInputProperties
* that they are valid (including white space); if false, will not
* check.
*<p>
* Note that this property will NOT have effect on all encoding problems,
* specifically:
*<ul>
* <li>UTF-8 decoder will still report invalid UTF-8 byte sequences (and same
* for other character encodings).
* </li>
* <li>XML Name character rules follow separate validation which will not be affected
* </li>
*</ul>
*<p>
* Turning this option off may improve parsing performance; leaving
* it on guarantees compatibility with XML 1.0 specs regarding character
* validity rules.
*/
public final static String P_VALIDATE_TEXT_CHARS = "com.ctc.wstx.validateTextChars";
// // // Caching:
/**
......@@ -128,9 +137,9 @@ public final class WstxInputProperties
*
* @deprecated Never implement, let's phase this out (deprecated in 4.2)
*/
@Deprecated
public final static String P_SUPPORT_DTDPP = "com.ctc.wstx.supportDTDPP";
/**
* Whether the Reader will treat character references as entities while parsing
* XML documents.
......@@ -148,9 +157,9 @@ public final class WstxInputProperties
//public final static String P_AUTOMATIC_W3C_SCHEMA = 0x00100000;
/*
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// More complex settings
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
// // // Buffer sizes;
......@@ -308,9 +317,9 @@ public final class WstxInputProperties
// // // DTD defaulting, overriding
/*
////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Helper classes, values enumerations
////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
public final static ParsingMode PARSING_MODE_DOCUMENT = new ParsingMode();
......
......@@ -2284,7 +2284,6 @@ public class FullDTDReader
if (c == 'A') {
keyw = checkDTDKeyword("NY");
if (keyw == null) {
val = null;
vldContent = XMLValidator.CONTENT_ALLOW_ANY_TEXT; // no DTD checks
break;
}
......
......@@ -72,10 +72,13 @@ public abstract class EntityDecl
return mName;
}
// 27-Mar-2018, tatu: Implemented by `BaseEventImpl` so...
/*
@Override
public final Location getLocation() {
return mLocation;
return getLocation();
}
*/
@Override
public abstract String getNotationName();
......@@ -101,18 +104,18 @@ public abstract class EntityDecl
}
/*
///////////////////////////////////////////
////////////////////////////////////////////////////////////
// Implementation of abstract base methods
///////////////////////////////////////////
////////////////////////////////////////////////////////////
*/
@Override
public abstract void writeEnc(Writer w) throws IOException;
/*
///////////////////////////////////////////
////////////////////////////////////////////////////////////
// Extended API for Wstx core
///////////////////////////////////////////
////////////////////////////////////////////////////////////
*/
// // // Access to data
......@@ -137,7 +140,6 @@ public abstract class EntityDecl
* value of the entity can be read.
*/
public abstract WstxInputSource expand(WstxInputSource parent,
XMLResolver res, ReaderConfig cfg,
int xmlVersion)
XMLResolver res, ReaderConfig cfg, int xmlVersion)
throws IOException, XMLStreamException;
}
......@@ -31,9 +31,9 @@ public class CompactStartElement
private final static int OFFSET_VALUE = 3;
/*
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Attribute information
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
*/
/**
......@@ -53,11 +53,10 @@ public class CompactStartElement
*/
private ArrayList<Attribute> mAttrList = null;
/*
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Life cycle
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
*/
protected CompactStartElement(Location loc, QName name, BaseNsContext nsCtxt,
......@@ -69,9 +68,9 @@ public class CompactStartElement
}
/*
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
// StartElement implementation
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
*/
@Override
......@@ -84,7 +83,7 @@ public class CompactStartElement
if (ix < 0) {
return null;
}
return constructAttr(mRawAttrs, ix, !mAttrs.isDefault(ix));
return constructAttr(mRawAttrs, ix, mAttrs.isDefault(ix));
}
@Override
......@@ -151,14 +150,14 @@ public class CompactStartElement
}
/*
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Internal methods
/////////////////////////////////////////////
////////////////////////////////////////////////////////////
*/
public Attribute constructAttr(String[] raw, int rawIndex, boolean isDef)
protected Attribute constructAttr(String[] raw, int rawIndex, boolean isDef)
{
return new AttributeEventImpl(mLocation, raw[rawIndex], raw[rawIndex+1],
raw[rawIndex+2], raw[rawIndex+3], isDef);
return new AttributeEventImpl(getLocation(), raw[rawIndex], raw[rawIndex+1],
raw[rawIndex+2], raw[rawIndex+3], !isDef);
}
}
......@@ -61,17 +61,17 @@ public class DefaultEventAllocator
final static DefaultEventAllocator sStdInstance = new DefaultEventAllocator(true);
/*
////////////////////////////////////////
///////////////////////////////////////////////////////////
// Configuration
////////////////////////////////////////
///////////////////////////////////////////////////////////
*/
protected final boolean mAccurateLocation;
/*
////////////////////////////////////////
///////////////////////////////////////////////////////////
// Recycled objects
////////////////////////////////////////
///////////////////////////////////////////////////////////
*/
/**
......@@ -105,9 +105,9 @@ public class DefaultEventAllocator
}
/*
//////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// XMLEventAllocator implementation
//////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
*/
@Override
......@@ -275,15 +275,14 @@ public class DefaultEventAllocator
}
/*
//////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// ElemCallback implementation
//////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
*/
@Override
public Object withStartElement(Location loc, QName name,
BaseNsContext nsCtxt, ElemAttrs attrs,
boolean wasEmpty)
BaseNsContext nsCtxt, ElemAttrs attrs, boolean wasEmpty)
{
return new CompactStartElement(loc, name, nsCtxt, attrs);
}
......
......@@ -17,7 +17,9 @@ package com.ctc.wstx.msv;
import java.util.*;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import org.codehaus.stax2.validation.*;
......@@ -47,12 +49,13 @@ import com.ctc.wstx.util.TextAccumulator;
*/
public final class GenericMsvValidator
extends XMLValidator
implements com.sun.msv.grammar.IDContextProvider2
implements com.sun.msv.grammar.IDContextProvider2,
XMLStreamConstants
{
/*
////////////////////////////////////
///////////////////////////////////////////////////////////
// Configuration
////////////////////////////////////
///////////////////////////////////////////////////////////
*/
final XMLValidationSchema mParentSchema;
......@@ -62,9 +65,9 @@ public final class GenericMsvValidator
final DocumentDeclaration mVGM;
/*
////////////////////////////////////
///////////////////////////////////////////////////////////
// State, helper objects
////////////////////////////////////
///////////////////////////////////////////////////////////
*/
final ArrayList<Object> mAcceptors = new ArrayList<Object>();
......@@ -80,9 +83,9 @@ public final class GenericMsvValidator
ElementIdMap mIdDefs;
/*
////////////////////////////////////
///////////////////////////////////////////////////////////
// State, positions
////////////////////////////////////
///////////////////////////////////////////////////////////
*/
String mCurrAttrPrefix;
......@@ -99,9 +102,9 @@ public final class GenericMsvValidator
XMLValidationProblem mProblem;
/*
////////////////////////////////////
///////////////////////////////////////////////////////////
// Helper objects
////////////////////////////////////
///////////////////////////////////////////////////////////
*/
final StringRef mErrorRef = new StringRef();
......@@ -112,6 +115,11 @@ public final class GenericMsvValidator
*/
final StartTagInfo mStartTag = new StartTagInfo("", "", "", null, (IDContextProvider2) null);
/**
* Since `StartTagInfo` has no place for prefix, hold reference to one here
*/
protected String mStartTagPrefix = "";
/**
* This object provides limited access to attribute values of the
* currently validated element.
......@@ -119,9 +127,9 @@ public final class GenericMsvValidator
final AttributeProxy mAttributeProxy;
/*
////////////////////////////////////
///////////////////////////////////////////////////////////
// Construction, configuration
////////////////////////////////////
///////////////////////////////////////////////////////////
*/
public GenericMsvValidator(XMLValidationSchema parent, ValidationContext ctxt,
......@@ -213,9 +221,9 @@ public final class GenericMsvValidator
}
/*
///////////////////////////////////////
///////////////////////////////////////////////////////////
// XMLValidator implementation
///////////////////////////////////////
///////////////////////////////////////////////////////////
*/
@Override
......@@ -233,7 +241,6 @@ public final class GenericMsvValidator
public void validateElementStart(String localName, String uri, String prefix)
throws XMLStreamException
{
/* [WSTX-200]: If sub-tree we were to validate has ended, we
* have no current acceptor, and must quite. Ideally we would
* really handle this more cleanly but...
......@@ -261,6 +268,7 @@ public final class GenericMsvValidator
//String qname = (prefix == null || prefix.length() == 0) ? localName : (prefix + ":" +localName);
String qname = localName;
mStartTag.reinit(uri, localName, qname, mAttributeProxy, this);
mStartTagPrefix = prefix;
mCurrAcceptor = mCurrAcceptor.createChildAcceptor(mStartTag, mErrorRef);
/* As per documentation, the side-effect of getting the error message
......@@ -268,7 +276,7 @@ public final class GenericMsvValidator
* never (?) see null acceptor being returned
*/
if (mErrorRef.str != null) {
reportError(mErrorRef);
reportError(mErrorRef, START_ELEMENT, _qname(uri, localName, prefix));
}
if (mProblem != null) { // pending problems (to throw exception on)?
XMLValidationProblem p = mProblem;
......@@ -299,7 +307,7 @@ public final class GenericMsvValidator
if (!mCurrAcceptor.onAttribute2(uri, localName, qname, value, this, mErrorRef, typeRef)
|| mErrorRef.str != null) {
reportError(mErrorRef);
reportError(mErrorRef, ATTRIBUTE, _qname(uri, localName, prefix));
}
if (mProblem != null) { // pending problems (to throw exception on)?
XMLValidationProblem p = mProblem;
......@@ -307,23 +315,18 @@ public final class GenericMsvValidator
mContext.reportProblem(p);
}
}
/* No normalization done by RelaxNG, is there? (at least nothing
* visible to callers that is)
*/
// No normalization done by RelaxNG, is there? (at least nothing
// visible to callers that is)
return null;
}
@Override
public String validateAttribute(String localName, String uri,
String prefix,
char[] valueChars, int valueStart,
int valueEnd)
public String validateAttribute(String localName, String uri, String prefix,
char[] valueChars, int valueStart, int valueEnd)
throws XMLStreamException
{
int len = valueEnd - valueStart;
/* This is very sub-optimal... but MSV doesn't deal with char
* arrays.
*/
// This is very sub-optimal... but MSV doesn't deal with char arrays.
return validateAttribute(localName, uri, prefix,
new String(valueChars, valueStart, len));
}
......@@ -340,7 +343,7 @@ public final class GenericMsvValidator
*/
if (!mCurrAcceptor.onEndAttributes(mStartTag, mErrorRef)
|| mErrorRef.str != null) {
reportError(mErrorRef);
reportError(mErrorRef, XMLStreamConstants.END_ELEMENT, _startTagAsQName());
}
int stringChecks = mCurrAcceptor.getStringCareLevel();
......@@ -375,19 +378,16 @@ public final class GenericMsvValidator
*/
doValidateText(mTextAccumulator);
/* [WSTX-200]: need to avoid problems when doing sub-tree
* validation... not a proper solution, but has to do for
* now
*/
// [WSTX-200]: need to avoid problems when doing sub-tree
// validation... not a proper solution, but has to do for now
int lastIx = mAcceptors.size()-1;
if (lastIx < 0) {
return XMLValidator.CONTENT_ALLOW_WS;
}
Acceptor acc = (Acceptor)mAcceptors.remove(lastIx);
if (acc != null) { // may be null during error recovery? or not?
if (!acc.isAcceptState(mErrorRef) || mErrorRef.str != null) {
reportError(mErrorRef);
reportError(mErrorRef, XMLStreamConstants.END_ELEMENT, _qname(uri, localName, prefix));
}
}
if (lastIx == 0) { // root closed
......@@ -398,7 +398,7 @@ public final class GenericMsvValidator
if (mCurrAcceptor != null && acc != null) {
if (!mCurrAcceptor.stepForward(acc, mErrorRef)
|| mErrorRef.str != null) {
reportError(mErrorRef);
reportError(mErrorRef, XMLStreamConstants.END_ELEMENT, _qname(uri, localName, prefix));
}
int stringChecks = mCurrAcceptor.getStringCareLevel();
switch (stringChecks) {
......@@ -467,9 +467,9 @@ public final class GenericMsvValidator
}
/*
///////////////////////////////////////
///////////////////////////////////////////////////////////
// Attribute info access
///////////////////////////////////////
///////////////////////////////////////////////////////////
*/
// // // Access to type info
......@@ -496,9 +496,9 @@ public final class GenericMsvValidator
}
/*
///////////////////////////////////////
///////////////////////////////////////////////////////////
// Internal methods
///////////////////////////////////////
///////////////////////////////////////////////////////////
*/
PrefixedName getElementPName()
......@@ -519,18 +519,31 @@ public final class GenericMsvValidator
DatatypeRef typeRef = null;
if (!mCurrAcceptor.onText2(str, this, mErrorRef, typeRef)
|| mErrorRef.str != null) {
reportError(mErrorRef);
reportError(mErrorRef, CDATA, _startTagAsQName());
}
}
}
private void reportError(StringRef errorRef)
throws XMLStreamException
private void reportError(StringRef errorRef, int type, QName name) throws XMLStreamException
{
String msg = errorRef.str;
errorRef.str = null;
if (msg == null) {
msg = "Unknown reason";
if (msg == null || msg.isEmpty()) {
switch (type) {
case START_ELEMENT:
msg = "Unknown reason (at start element "+_name(name, "<", ">")+")";
break;
case END_ELEMENT:
msg = "Unknown reason (at end element "+_name(name, "</", ">")+")";
break;
case ATTRIBUTE:
msg = "Unknown reason (at attribute "+_name(name, "'", "'")+")";
break;
case CDATA:
default:
msg = "Unknown reason (at CDATA section, inside element "+_name(name, "<", ">")+")";
break;
}
}
reportError(msg);
}
......@@ -548,4 +561,34 @@ public final class GenericMsvValidator
prob.setReporter(this);
mContext.reportProblem(prob);
}
private String _name(QName qn, String prefix, String suffix) {
if (qn == null) {
return "UNKNOWN";
}
String name = qn.getLocalPart();
String p = qn.getPrefix();
if (p != null && !p.isEmpty()) {
name = p + ":" + name;
}
return prefix + name + suffix;
}
private QName _startTagAsQName() {
return _qname(mStartTag.namespaceURI, mStartTag.localName, mStartTagPrefix);
}
private QName _qname(String ns, String local, String prefix) {
if (prefix == null) {
prefix = "";
}
if (ns == null) {
ns = "";
}
// should we even allow this?
if (local == null) {
local = "";
}
return new QName(ns, local, prefix);
}
}
......@@ -692,9 +692,8 @@ public final class AttributeCollector
if (count == 0) {
return null;
}
/* If we have actual attributes, let's first just create the
* raw array that has all attribute information:
*/
// If we have actual attributes, let's first just create the
// raw array that has all attribute information:
String[] raw = new String[count << 2];
for (int i = 0; i < count; ++i) {
Attribute attr = mAttributes[i];
......
......@@ -63,9 +63,9 @@ public abstract class BasicStreamReader
implements StreamReaderImpl, DTDInfo, LocationInfo
{
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Constants
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
// // // Standalone values:
......@@ -164,9 +164,9 @@ public abstract class BasicStreamReader
final protected static String sPrefixXmlns = DefaultXmlSymbolTable.getXmlnsSymbol();
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Configuration
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
// note: mConfig defined in base class
......@@ -191,9 +191,9 @@ public abstract class BasicStreamReader
protected final int mShortestTextSegment;
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Symbol handling
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -203,10 +203,9 @@ public abstract class BasicStreamReader
final protected ReaderCreator mOwner;
/*
///////////////////////////////////////////////////////////
// Additional XML document information, in addition
// to what StreamScanner has
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Additional XML document information, in addition to what StreamScanner has
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -217,10 +216,9 @@ public abstract class BasicStreamReader
protected int mDocStandalone = DOC_STANDALONE_UNKNOWN;
/*
///////////////////////////////////////////////////////////
// DOCTYPE information from document type declaration
// (if any found)
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// DOCTYPE information from document type declaration (if any found)
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -246,9 +244,9 @@ public abstract class BasicStreamReader
protected String mDtdSystemId;
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Information about currently open subtree, content
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -268,9 +266,9 @@ public abstract class BasicStreamReader
final protected AttributeCollector mAttrCollector;
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Tokenization state
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/// Flag set when DOCTYPE declaration has been parsed
......@@ -352,9 +350,9 @@ public abstract class BasicStreamReader
protected XMLStreamException mPendingException = null;
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// DTD information (entities, content spec stub)
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -384,9 +382,9 @@ public abstract class BasicStreamReader
protected boolean mReturnNullForDefaultNamespace;
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Instance construction, initialization
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -492,9 +490,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// XMLStreamReader, document info
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -542,9 +540,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Public API, configuration
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
@Override
......@@ -571,9 +569,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// XMLStreamReader, current state
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
// // // Attribute access:
......@@ -894,10 +892,8 @@ public abstract class BasicStreamReader
return (mCurrEntity == null) ? null : mCurrEntity.getReplacementText();
}
if (currToken == DTD) {
/* 16-Aug-2004, TSa: Hmmh. Specs are bit ambiguous on whether this
* should return just the internal subset, or the whole
* thing...
*/
// 16-Aug-2004, TSa: Hmmh. Specs are bit ambiguous on whether this
// should return just the internal subset, or the whole thing...
return getDTDInternalSubset();
}
return mTextBuffer.contentsAsString();
......@@ -968,9 +964,7 @@ public abstract class BasicStreamReader
@Override
public boolean hasNext() {
/* 08-Oct-2005, TSa: In multi-doc mode, we have different
* criteria...
*/
// 08-Oct-2005, TSa: In multi-doc mode, we have different criteria...
return (mCurrToken != END_DOCUMENT)
|| (mParseState == STATE_MULTIDOC_HACK);
}
......@@ -1098,9 +1092,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// XMLStreamReader, iterating
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
@Override
......@@ -1268,9 +1262,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// XMLStreamReader2 (StAX2) implementation
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
@Override
......@@ -1542,9 +1536,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// DTDInfo implementation (StAX 2)
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -1608,9 +1602,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// LocationInfo implementation (StAX 2)
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
// // // First, the "raw" offset accessors:
......@@ -1672,9 +1666,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Stax2 validation
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
@Override
......@@ -1709,9 +1703,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// StreamReaderImpl implementation
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
@Override
......@@ -1765,9 +1759,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Support for SAX XMLReader implementation
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
public void fireSaxStartElement(ContentHandler h, Attributes attrs)
......@@ -1864,9 +1858,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, config access
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
protected final boolean hasConfigFlags(int flags) {
......@@ -1874,9 +1868,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, parsing helper methods
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -2050,10 +2044,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
// Internal methods, parsing prolog (before root) and
// epilog
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, parsing prolog (before root) and epilog
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -2680,9 +2673,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, main parsing (inside root)
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -2709,18 +2702,15 @@ public abstract class BasicStreamReader
i = skipToken();
// note: skipToken() updates the start location
} else {
/* Start/end elements are never unfinished (ie. are always
* completely read in)
*/
// Start/end elements are never unfinished (ie. are always
// completely read in)
if (mCurrToken == START_ELEMENT) {
// Start tag may be an empty tag:
if (mStEmptyElem) {
// and if so, we'll then get 'virtual' close tag:
mStEmptyElem = false;
// ... and location info is correct already
/* 27-Feb-2009, TSa: but we do have to handle validation
* of the end tag now
*/
// 27-Feb-2009, TSa: but we do have to handle validation of the end tag now
int vld = mElementStack.validateEndElement();
mVldContent = vld;
mValidateText = (vld == XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT);
......@@ -2752,20 +2742,17 @@ public abstract class BasicStreamReader
char c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
: getNextChar(SUFFIX_IN_CDATA);
if (readCDataPrimary(c)) { // got it all!
/* note: can not be in coalescing mode at this point;
* as we can never have partial cdata without unfinished
* token
*/
// note: can not be in coalescing mode at this point;
// as we can never have partial cdata without unfinished token
// ... still need to have gotten at least 1 char though:
if (mTextBuffer.size() > 0) {
return CDATA;
}
// otherwise need to continue and parse the next event
} else {
/* Hmmh. Have to verify we get at least one char from
* CData section; if so, we are good to go for now;
* if not, need to get that damn char first:
*/
// Hmmh. Have to verify we get at least one char from
// CData section; if so, we are good to go for now;
// if not, need to get that damn char first:
if (mTextBuffer.size() == 0
&& readCDataSecondary(mCfgLazyParsing
? 1 : mShortestTextSegment)) {
......@@ -2794,10 +2781,8 @@ public abstract class BasicStreamReader
}
if (i < 0) {
/* 07-Oct-2005, TSa: May be ok in fragment mode (not otherwise),
* but we can just check if element stack has anything, as that
* handles all cases
*/
// 07-Oct-2005, TSa: May be ok in fragment mode (not otherwise),
// but we can just check if element stack has anything, as that handles all cases
if (!mElementStack.isEmpty()) {
throwUnexpectedEOF();
}
......@@ -3396,9 +3381,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, skipping
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -3725,9 +3710,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, parsing
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
protected void ensureFinishToken() throws XMLStreamException
......@@ -4290,7 +4275,7 @@ public abstract class BasicStreamReader
}
/**
* Method called to read in consequtive beginning parts of a CDATA
* Method called to read in consecutive beginning parts of a CDATA
* segment, up to either end of the segment (]] and >) or until
* first 'hole' in text (buffer end, 2-char lf to convert, entity).
*<p>
......@@ -4541,7 +4526,7 @@ public abstract class BasicStreamReader
}
/**
* Method called to read in consequtive beginning parts of a text
* Method called to read in consecutive beginning parts of a text
* segment, up to either end of the segment (lt char) or until
* first 'hole' in text (buffer end, 2-char lf to convert, entity).
*<p>
......@@ -4576,9 +4561,7 @@ public abstract class BasicStreamReader
if (c == '\r') {
c = '\n';
if (mInputBuffer[ptr] == c) {
/* Ok, whatever happens, can 'skip' \r, to
* point to following \n:
*/
// Ok, whatever happens, can 'skip' \r, to point to following \n:
++start;
// But if that's buffer end, can't skip that
if (++ptr >= len) {
......@@ -4632,11 +4615,10 @@ public abstract class BasicStreamReader
--ptr;
break;
}
/* This would otherwise be risky (may modify value
* of a shared entity value), but since DTDs are
* cached/accessed based on properties including
* lf-normalization there's no harm in 'fixing' it
* in place.
/* This would otherwise be risky (may modify value of
* a shared entity value), but since DTDs are cached/accessed
* based on properties including lf-normalization there's no
* harm in 'fixing' it in place.
*/
inputBuf[ptr-1] = '\n'; // yup
} else {
......@@ -5485,9 +5467,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, low-level input access
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......@@ -5568,9 +5550,9 @@ public abstract class BasicStreamReader
}
/*
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// Internal methods, validation, error handling and reporting
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
*/
/**
......