venu 2003/12/17 04:08:33
Modified: java/src/org/apache/xerces/parsers Tag: jaxp13-2_6-branch
XML11Configuration.java
java/src/org/apache/xml/serialize Tag: jaxp13-2_6-branch
HTMLSerializer.java HTMLdtd.java OutputFormat.java
Log:
Picking up fixes made by michael in main branch . Thanks to michael.
Revision Changes Path
No revision
No revision
1.11.2.1 +102 -127
xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java
Index: XML11Configuration.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/XML11Configuration.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- XML11Configuration.java 18 Nov 2003 18:32:42 -0000 1.11
+++ XML11Configuration.java 17 Dec 2003 12:08:32 -0000 1.11.2.1
@@ -1367,140 +1367,115 @@
} // checkProperty(String)
- /**
- * Adds a component to the parser configuration. This method will
- * also add all of the component's recognized features and properties
- * to the list of default recognized features and properties.
- *
- * @param component The component to add.
- */
- protected void addComponent(XMLComponent component) {
- // don't add a component more than once
- if (fComponents.contains(component)) {
- return;
- }
- fComponents.addElement(component);
+ /**
+ * Adds a component to the parser configuration. This method will
+ * also add all of the component's recognized features and properties
+ * to the list of default recognized features and properties.
+ *
+ * @param component The component to add.
+ */
+ protected void addComponent(XMLComponent component) {
+
+ // don't add a component more than once
+ if (fComponents.contains(component)) {
+ return;
+ }
+ fComponents.addElement(component);
+ addRecognizedParamsAndSetDefaults(component);
+
+ } // addComponent(XMLComponent)
+
+ /**
+ * Adds common component to the parser configuration. This method will
+ * also add all of the component's recognized features and properties
+ * to the list of default recognized features and properties.
+ *
+ * @param component The component to add.
+ */
+ protected void addCommonComponent(XMLComponent component) {
+
+ // don't add a component more than once
+ if (fCommonComponents.contains(component)) {
+ return;
+ }
+ fCommonComponents.addElement(component);
+ addRecognizedParamsAndSetDefaults(component);
- // register component's recognized features
- String[] recognizedFeatures = component.getRecognizedFeatures();
- addRecognizedFeatures(recognizedFeatures);
+ } // addCommonComponent(XMLComponent)
+
+ /**
+ * Adds an XML 1.1 component to the parser configuration. This method will
+ * also add all of the component's recognized features and properties
+ * to the list of default recognized features and properties.
+ *
+ * @param component The component to add.
+ */
+ protected void addXML11Component(XMLComponent component) {
+
+ // don't add a component more than once
+ if (fXML11Components.contains(component)) {
+ return;
+ }
+ fXML11Components.addElement(component);
+ addRecognizedParamsAndSetDefaults(component);
- // register component's recognized properties
- String[] recognizedProperties = component.getRecognizedProperties();
- addRecognizedProperties(recognizedProperties);
-
- // set default values
- if (recognizedFeatures != null) {
- for (int i = 0; i < recognizedFeatures.length; i++) {
- String featureId = recognizedFeatures[i];
- Boolean state = component.getFeatureDefault(featureId);
- if (state != null) {
- super.setFeature(featureId,
state.booleanValue());
- }
- }
- }
- if (recognizedProperties != null) {
- for (int i = 0; i < recognizedProperties.length; i++) {
- String propertyId = recognizedProperties[i];
- Object value =
component.getPropertyDefault(propertyId);
- if (value != null) {
- super.setProperty(propertyId, value);
- }
- }
- }
-
- } // addComponent(XMLComponent)
+ } // addXML11Component(XMLComponent)
- /**
- * Adds common component to the parser configuration. This method will
- * also add all of the component's recognized features and properties
- * to the list of default recognized features and properties.
- *
- * @param component The component to add.
- */
- protected void addCommonComponent(XMLComponent component) {
- // don't add a component more than once
- if (fCommonComponents.contains(component)) {
- return;
- }
- fCommonComponents.addElement(component);
-
- // register component's recognized features
- String[] recognizedFeatures = component.getRecognizedFeatures();
- addRecognizedFeatures(recognizedFeatures);
+ /**
+ * Adds all of the component's recognized features and properties
+ * to the list of default recognized features and properties, and
+ * sets default values on the configuration for features and
+ * properties which were previously absent from the configuration.
+ *
+ * @param component The component whose recognized features
+ * and properties will be added to the configuration
+ */
+ protected void addRecognizedParamsAndSetDefaults(XMLComponent component) {
- // register component's recognized properties
- String[] recognizedProperties = component.getRecognizedProperties();
- addRecognizedProperties(recognizedProperties);
-
- // set default values
- if (recognizedFeatures != null) {
- for (int i = 0; i < recognizedFeatures.length; i++) {
- String featureId = recognizedFeatures[i];
- Boolean state = component.getFeatureDefault(featureId);
- if (state != null) {
- super.setFeature(featureId,
state.booleanValue());
- }
- }
- }
- if (recognizedProperties != null) {
- for (int i = 0; i < recognizedProperties.length; i++) {
- String propertyId = recognizedProperties[i];
- Object value =
component.getPropertyDefault(propertyId);
- if (value != null) {
- super.setProperty(propertyId, value);
- }
- }
- }
-
- } // addCommonComponent(XMLComponent)
-
- /**
- * Adds an XML 1.1 component to the parser configuration. This method will
- * also add all of the component's recognized features and properties
- * to the list of default recognized features and properties.
- *
- * @param component The component to add.
- */
- protected void addXML11Component(XMLComponent component) {
- // don't add a component more than once
- if (fXML11Components.contains(component)) {
- return;
- }
- fXML11Components.addElement(component);
-
- // register component's recognized features
- String[] recognizedFeatures = component.getRecognizedFeatures();
- addRecognizedFeatures(recognizedFeatures);
+ // register component's recognized features
+ String[] recognizedFeatures = component.getRecognizedFeatures();
+ addRecognizedFeatures(recognizedFeatures);
- // register component's recognized properties
- String[] recognizedProperties = component.getRecognizedProperties();
- addRecognizedProperties(recognizedProperties);
-
- // set default values
- if (recognizedFeatures != null) {
- for (int i = 0; i < recognizedFeatures.length; i++) {
- String featureId = recognizedFeatures[i];
- Boolean state = component.getFeatureDefault(featureId);
- if (state != null) {
- checkFeature(featureId);
- fFeatures.put(featureId, state);
- }
- }
- }
- if (recognizedProperties != null) {
- for (int i = 0; i < recognizedProperties.length; i++) {
- String propertyId = recognizedProperties[i];
- Object value =
component.getPropertyDefault(propertyId);
- if (value != null) {
- checkProperty(propertyId);
- fProperties.put(propertyId, value);
- }
- }
- }
-
- } // addXML11Component(XMLComponent)
-
+ // register component's recognized properties
+ String[] recognizedProperties = component.getRecognizedProperties();
+ addRecognizedProperties(recognizedProperties);
+
+ // set default values
+ if (recognizedFeatures != null) {
+ for (int i = 0; i < recognizedFeatures.length; ++i) {
+ String featureId = recognizedFeatures[i];
+ Boolean state = component.getFeatureDefault(featureId);
+ if (state != null) {
+ // Do not overwrite values already set on the configuration.
+ if (!fFeatures.containsKey(featureId)) {
+ fFeatures.put(featureId, state);
+ // For newly added components who recognize this feature
+ // but did not offer a default value, we need to make
+ // sure these components will get an opportunity to read
+ // the value before parsing begins.
+ fConfigUpdated = true;
+ }
+ }
+ }
+ }
+ if (recognizedProperties != null) {
+ for (int i = 0; i < recognizedProperties.length; ++i) {
+ String propertyId = recognizedProperties[i];
+ Object value = component.getPropertyDefault(propertyId);
+ if (value != null) {
+ // Do not overwrite values already set on the configuration.
+ if (!fProperties.containsKey(propertyId)) {
+ fProperties.put(propertyId, value);
+ // For newly added components who recognize this property
+ // but did not offer a default value, we need to make
+ // sure these components will get an opportunity to read
+ // the value before parsing begins.
+ fConfigUpdated = true;
+ }
+ }
+ }
+ }
+ }
private void initXML11Components() {
if (!f11Initialized) {
No revision
No revision
1.23.2.2 +11 -3 xml-xerces/java/src/org/apache/xml/serialize/HTMLSerializer.java
Index: HTMLSerializer.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xml/serialize/HTMLSerializer.java,v
retrieving revision 1.23.2.1
retrieving revision 1.23.2.2
diff -u -r1.23.2.1 -r1.23.2.2
--- HTMLSerializer.java 9 Dec 2003 11:08:23 -0000 1.23.2.1
+++ HTMLSerializer.java 17 Dec 2003 12:08:33 -0000 1.23.2.2
@@ -672,7 +672,11 @@
// HTML: If public identifier specified, print it with
// system identifier, if specified.
if ( _docTypePublicId != null && ( ! _xhtml || _docTypeSystemId !=
null ) ) {
- _printer.printText( "<!DOCTYPE HTML PUBLIC " );
+ if (_xhtml) {
+ _printer.printText( "<!DOCTYPE html
PUBLIC " );
+ }else{
+ _printer.printText( "<!DOCTYPE HTML
PUBLIC " );
+ }
printDoctypeURL( _docTypePublicId );
if ( _docTypeSystemId != null ) {
if ( _indenting ) {
@@ -685,7 +689,11 @@
_printer.printText( '>' );
_printer.breakLine();
} else if ( _docTypeSystemId != null ) {
- _printer.printText( "<!DOCTYPE HTML SYSTEM " );
+ if (_xhtml) {
+ _printer.printText( "<!DOCTYPE html SYSTEM " );
+ }else{
+ _printer.printText( "<!DOCTYPE HTML SYSTEM " );
+ }
printDoctypeURL( _docTypeSystemId );
_printer.printText( '>' );
_printer.breakLine();
1.15.4.1 +9 -8 xml-xerces/java/src/org/apache/xml/serialize/HTMLdtd.java
Index: HTMLdtd.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/HTMLdtd.java,v
retrieving revision 1.15
retrieving revision 1.15.4.1
diff -u -r1.15 -r1.15.4.1
--- HTMLdtd.java 25 Apr 2003 20:22:02 -0000 1.15
+++ HTMLdtd.java 17 Dec 2003 12:08:33 -0000 1.15.4.1
@@ -89,27 +89,28 @@
{
/**
- * Public identifier for HTML document type.
+ * Public identifier for HTML 4.01 (Strict) document type.
*/
- public static final String HTMLPublicId = "-//W3C//DTD HTML 4.0//EN";
+ public static final String HTMLPublicId = "-//W3C//DTD HTML 4.01//EN";
/**
- * System identifier for HTML document type.
+ * System identifier for HTML 4.01 (Strict) document type.
*/
public static final String HTMLSystemId =
- "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd";
+ "http://www.w3.org/TR/html4/strict.dtd";
/**
- * Public identifier for XHTML document type.
+ * Public identifier for XHTML 1.0 (Strict) document type.
*/
public static final String XHTMLPublicId =
"-//W3C//DTD XHTML 1.0 Strict//EN";
/**
- * System identifier for XHTML document type.
+ * System identifier for XHTML 1.0 (Strict) document type.
*/
public static final String XHTMLSystemId =
- "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd";
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
+
/**
* Table of reverse character reference mapping. Character codes are held
* as single-character strings, mapped to their reference name.
1.19.4.1 +8 -8 xml-xerces/java/src/org/apache/xml/serialize/OutputFormat.java
Index: OutputFormat.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/OutputFormat.java,v
retrieving revision 1.19
retrieving revision 1.19.4.1
diff -u -r1.19 -r1.19.4.1
--- OutputFormat.java 13 May 2003 13:23:48 -0000 1.19
+++ OutputFormat.java 17 Dec 2003 12:08:33 -0000 1.19.4.1
@@ -106,27 +106,27 @@
{
/**
- * Public identifier for HTML document type.
+ * Public identifier for HTML 4.01 (Strict) document type.
*/
- public static final String HTMLPublicId = "-//W3C//DTD HTML 4.0//EN";
+ public static final String HTMLPublicId = "-//W3C//DTD HTML 4.01//EN";
/**
- * System identifier for HTML document type.
+ * System identifier for HTML 4.01 (Strict) document type.
*/
public static final String HTMLSystemId =
- "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd";
+ "http://www.w3.org/TR/html4/strict.dtd";
/**
- * Public identifier for XHTML document type.
+ * Public identifier for XHTML 1.0 (Strict) document type.
*/
public static final String XHTMLPublicId =
"-//W3C//DTD XHTML 1.0 Strict//EN";
/**
- * System identifier for XHTML document type.
+ * System identifier for XHTML 1.0 (Strict) document type.
*/
public static final String XHTMLSystemId =
- "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd";
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]