diff --git a/xml/src/processing/xml/XMLElement.java b/xml/src/processing/xml/XMLElement.java index 38090f747..e233f7c78 100644 --- a/xml/src/processing/xml/XMLElement.java +++ b/xml/src/processing/xml/XMLElement.java @@ -199,6 +199,14 @@ public class XMLElement private Hashtable entities; + /** + * Use this to simply ignore unknown entities. This is a necessity because + * lines are not currently parsed, and cause dumb problems + * with Illustrator SVG files. [fry] + */ + private boolean ignoreUnknownEntities = true; + + /** * The line number where the element starts. * @@ -206,7 +214,7 @@ public class XMLElement *
lineNr >= 0
* result >= 0
* 0.0 is returned.
@@ -1471,12 +1574,14 @@ public class XMLElement
* java.util.Hashtable, java.lang.String, boolean)
* getIntAttribute} instead.
*/
+ /*
public int getIntProperty(String name,
Hashtable valueSet,
String defaultKey)
{
return this.getIntAttribute(name, valueSet, defaultKey, false);
}
+ */
/**
@@ -1485,10 +1590,12 @@ public class XMLElement
* @deprecated Use {@link #getStringAttribute(java.lang.String)
* getStringAttribute} instead.
*/
+ /*
public String getProperty(String name)
{
return this.getStringAttribute(name);
}
+ */
/**
@@ -1497,11 +1604,13 @@ public class XMLElement
* @deprecated Use {@link #getStringAttribute(java.lang.String,
* java.lang.String) getStringAttribute} instead.
*/
+ /*
public String getProperty(String name,
String defaultValue)
{
return this.getStringAttribute(name, defaultValue);
}
+ */
/**
@@ -1510,11 +1619,13 @@ public class XMLElement
* @deprecated Use {@link #getIntAttribute(java.lang.String, int)
* getIntAttribute} instead.
*/
+ /*
public int getProperty(String name,
int defaultValue)
{
return this.getIntAttribute(name, defaultValue);
}
+ */
/**
@@ -1523,11 +1634,13 @@ public class XMLElement
* @deprecated Use {@link #getDoubleAttribute(java.lang.String, double)
* getDoubleAttribute} instead.
*/
+ /*
public double getProperty(String name,
double defaultValue)
{
return this.getDoubleAttribute(name, defaultValue);
}
+ */
/**
@@ -1537,6 +1650,7 @@ public class XMLElement
* java.lang.String, java.lang.String, boolean)
* getBooleanAttribute} instead.
*/
+ /*
public boolean getProperty(String key,
String trueValue,
String falseValue,
@@ -1545,6 +1659,7 @@ public class XMLElement
return this.getBooleanAttribute(key, trueValue, falseValue,
defaultValue);
}
+ */
/**
@@ -1554,12 +1669,14 @@ public class XMLElement
* java.util.Hashtable, java.lang.String, boolean)
* getAttribute} instead.
*/
+ /*
public Object getProperty(String name,
Hashtable valueSet,
String defaultKey)
{
return this.getAttribute(name, valueSet, defaultKey, false);
}
+ */
/**
@@ -1569,12 +1686,14 @@ public class XMLElement
* java.util.Hashtable, java.lang.String, boolean)
* getStringAttribute} instead.
*/
+ /*
public String getStringProperty(String name,
Hashtable valueSet,
String defaultKey)
{
return this.getStringAttribute(name, valueSet, defaultKey, false);
}
+ */
/**
@@ -1584,12 +1703,14 @@ public class XMLElement
* java.util.Hashtable, java.lang.String, boolean)
* getIntAttribute} instead.
*/
+ /*
public int getSpecialIntProperty(String name,
Hashtable valueSet,
String defaultKey)
{
return this.getIntAttribute(name, valueSet, defaultKey, true);
}
+ */
/**
@@ -1599,12 +1720,14 @@ public class XMLElement
* java.util.Hashtable, java.lang.String, boolean)
* getDoubleAttribute} instead.
*/
+ /*
public double getSpecialDoubleProperty(String name,
Hashtable valueSet,
String defaultKey)
{
return this.getDoubleAttribute(name, valueSet, defaultKey, true);
}
+ */
/**
@@ -1623,10 +1746,12 @@ public class XMLElement
*
* @deprecated Use {@link #getName() getName} instead.
*/
+ /*
public String getTagName()
{
return this.getName();
}
+ */
/**
@@ -2042,10 +2167,12 @@ public class XMLElement
* @deprecated Use {@link #removeAttribute(java.lang.String)
* removeAttribute} instead.
*/
+ /*
public void removeProperty(String name)
{
this.removeAttribute(name);
}
+ */
/**
@@ -2057,10 +2184,12 @@ public class XMLElement
* @deprecated Use {@link #removeAttribute(java.lang.String)
* removeAttribute} instead.
*/
+ /*
public void removeChild(String name)
{
this.removeAttribute(name);
}
+ */
/**
@@ -2097,10 +2226,12 @@ public class XMLElement
*
* @deprecated Use {@link #setName(java.lang.String) setName} instead.
*/
+ /*
public void setTagName(String name)
{
this.setName(name);
}
+ */
/**
@@ -2168,10 +2299,10 @@ public class XMLElement
writer.write('<');
writer.write(this.name);
if (! this.attributes.isEmpty()) {
- Enumeration enum = this.attributes.keys();
- while (enum.hasMoreElements()) {
+ Enumeration en = this.attributes.keys();
+ while (en.hasMoreElements()) {
writer.write(' ');
- String key = (String) enum.nextElement();
+ String key = (String) en.nextElement();
String value = (String) this.attributes.get(key);
writer.write(key);
writer.write('='); writer.write('"');
@@ -2189,9 +2320,9 @@ public class XMLElement
writer.write('/'); writer.write('>');
} else {
writer.write('>');
- Enumeration enum = this.enumerateChildren();
- while (enum.hasMoreElements()) {
- XMLElement child = (XMLElement) enum.nextElement();
+ Enumeration en = this.enumerateChildren();
+ while (en.hasMoreElements()) {
+ XMLElement child = (XMLElement) en.nextElement();
child.write(writer);
}
writer.write('<'); writer.write('/');
@@ -2747,10 +2878,14 @@ public class XMLElement
buf.append(ch);
} else {
char[] value = (char[]) this.entities.get(key);
+ // [fry] modified this to provide the option of ignoring missing entities
if (value == null) {
- throw this.unknownEntity(key);
+ if (!ignoreUnknownEntities) {
+ throw this.unknownEntity(key);
+ }
+ } else {
+ buf.append(value);
}
- buf.append(value);
}
}