Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
From-SVN: r107049
This commit is contained in:
@@ -109,7 +109,7 @@ public final class JAXPFactory
|
||||
// (flags can't necessarily be set before parsing)
|
||||
new JaxpParser().getXMLReader().setFeature(name, value);
|
||||
|
||||
flags.put(name, new Boolean(value));
|
||||
flags.put(name, Boolean.valueOf(value));
|
||||
}
|
||||
catch (SAXNotRecognizedException e)
|
||||
{
|
||||
|
||||
@@ -717,7 +717,9 @@ final public class SAXDriver
|
||||
}
|
||||
else
|
||||
{
|
||||
in.setSystemId(absolutize(baseURI, in.getSystemId(), false));
|
||||
in.setSystemId(absolutize(baseURI,
|
||||
in.getSystemId(),
|
||||
entityResolver != base));
|
||||
source = entityResolver.resolveEntity(in.getPublicId(),
|
||||
in.getSystemId());
|
||||
if (source == null)
|
||||
|
||||
@@ -210,13 +210,15 @@ public class DomDocument
|
||||
*/
|
||||
public Element getElementById(String id)
|
||||
{
|
||||
DomDoctype doctype = (DomDoctype) getDoctype();
|
||||
|
||||
if (doctype == null || !doctype.hasIds()
|
||||
|| id == null || id.length() == 0)
|
||||
if (id == null || id.length() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DomDoctype doctype = (DomDoctype) getDoctype();
|
||||
if (doctype != null && !doctype.hasIds())
|
||||
{
|
||||
doctype = null;
|
||||
}
|
||||
|
||||
// yes, this is linear in size of document.
|
||||
// it'd be easy enough to maintain a hashtable.
|
||||
@@ -233,25 +235,39 @@ public class DomDocument
|
||||
if (current.getNodeType() == ELEMENT_NODE)
|
||||
{
|
||||
DomElement element = (DomElement) current;
|
||||
DTDElementTypeInfo info =
|
||||
doctype.getElementTypeInfo(current.getNodeName());
|
||||
if (info != null &&
|
||||
id.equals(element.getAttribute(info.idAttrName)))
|
||||
if (doctype != null)
|
||||
{
|
||||
return element;
|
||||
}
|
||||
else if (element.userIdAttrs != null)
|
||||
{
|
||||
for (Iterator i = element.userIdAttrs.iterator();
|
||||
i.hasNext(); )
|
||||
DTDElementTypeInfo info =
|
||||
doctype.getElementTypeInfo(current.getNodeName());
|
||||
if (info != null &&
|
||||
id.equals(element.getAttribute(info.idAttrName)))
|
||||
{
|
||||
Node idAttr = (Node) i.next();
|
||||
if (id.equals(idAttr.getNodeValue()))
|
||||
return element;
|
||||
}
|
||||
else if (element.userIdAttrs != null)
|
||||
{
|
||||
for (Iterator i = element.userIdAttrs.iterator();
|
||||
i.hasNext(); )
|
||||
{
|
||||
return element;
|
||||
Node idAttr = (Node) i.next();
|
||||
if (id.equals(idAttr.getNodeValue()))
|
||||
{
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// xml:id
|
||||
String xmlId = element.getAttribute("xml:id");
|
||||
if (xmlId == null)
|
||||
{
|
||||
xmlId = element.getAttributeNS(XMLConstants.XML_NS_URI,
|
||||
"id");
|
||||
}
|
||||
if (id.equals(xmlId))
|
||||
{
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
// descend?
|
||||
|
||||
@@ -376,31 +376,31 @@ public class GnomeDocument
|
||||
name = name.toLowerCase();
|
||||
if ("canonical-form".equals(name))
|
||||
{
|
||||
return new Boolean(canonicalForm);
|
||||
return Boolean.valueOf(canonicalForm);
|
||||
}
|
||||
else if ("cdata-sections".equals(name))
|
||||
{
|
||||
return new Boolean(cdataSections);
|
||||
return Boolean.valueOf(cdataSections);
|
||||
}
|
||||
else if ("check-character-normalization".equals(name))
|
||||
{
|
||||
return new Boolean(checkCharacterNormalization);
|
||||
return Boolean.valueOf(checkCharacterNormalization);
|
||||
}
|
||||
else if ("comments".equals(name))
|
||||
{
|
||||
return new Boolean(comments);
|
||||
return Boolean.valueOf(comments);
|
||||
}
|
||||
else if ("datatype-normalization".equals(name))
|
||||
{
|
||||
return new Boolean(datatypeNormalization);
|
||||
return Boolean.valueOf(datatypeNormalization);
|
||||
}
|
||||
else if ("element-content-whitespace".equals(name))
|
||||
{
|
||||
return new Boolean(elementContentWhitespace);
|
||||
return Boolean.valueOf(elementContentWhitespace);
|
||||
}
|
||||
else if ("entities".equals(name))
|
||||
{
|
||||
return new Boolean(entities);
|
||||
return Boolean.valueOf(entities);
|
||||
}
|
||||
else if ("error-handler".equals(name))
|
||||
{
|
||||
@@ -408,43 +408,43 @@ public class GnomeDocument
|
||||
}
|
||||
else if ("infoset".equals(name))
|
||||
{
|
||||
return new Boolean(!validateIfSchema &&
|
||||
!entities &&
|
||||
!datatypeNormalization &&
|
||||
!cdataSections &&
|
||||
namespaceDeclarations &&
|
||||
wellFormed &&
|
||||
elementContentWhitespace &&
|
||||
comments &&
|
||||
namespaces);
|
||||
return Boolean.valueOf(!validateIfSchema &&
|
||||
!entities &&
|
||||
!datatypeNormalization &&
|
||||
!cdataSections &&
|
||||
namespaceDeclarations &&
|
||||
wellFormed &&
|
||||
elementContentWhitespace &&
|
||||
comments &&
|
||||
namespaces);
|
||||
}
|
||||
else if ("namespaces".equals(name))
|
||||
{
|
||||
return new Boolean(namespaces);
|
||||
return Boolean.valueOf(namespaces);
|
||||
}
|
||||
else if ("namespace-declarations".equals(name))
|
||||
{
|
||||
return new Boolean(namespaceDeclarations);
|
||||
return Boolean.valueOf(namespaceDeclarations);
|
||||
}
|
||||
else if ("normalize-characters".equals(name))
|
||||
{
|
||||
return new Boolean(normalizeCharacters);
|
||||
return Boolean.valueOf(normalizeCharacters);
|
||||
}
|
||||
else if ("split-cdata-sections".equals(name))
|
||||
{
|
||||
return new Boolean(splitCdataSections);
|
||||
return Boolean.valueOf(splitCdataSections);
|
||||
}
|
||||
else if ("validate".equals(name))
|
||||
{
|
||||
return new Boolean(validate);
|
||||
return Boolean.valueOf(validate);
|
||||
}
|
||||
else if ("validate-if-schema".equals(name))
|
||||
{
|
||||
return new Boolean(validateIfSchema);
|
||||
return Boolean.valueOf(validateIfSchema);
|
||||
}
|
||||
else if ("well-formed".equals(name))
|
||||
{
|
||||
return new Boolean(wellFormed);
|
||||
return Boolean.valueOf(wellFormed);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -497,7 +497,7 @@ public class GnomeDocument
|
||||
}
|
||||
else if (value instanceof String)
|
||||
{
|
||||
return new Boolean ((String) value).booleanValue();
|
||||
return Boolean.valueOf ((String) value).booleanValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1607,7 +1607,7 @@ public final class ValidationConsumer extends EventFilter
|
||||
throw new RuntimeException ("patchNext");
|
||||
}
|
||||
|
||||
if (table != null && (flags | F_LOOPHEAD) != 0)
|
||||
if (table != null && (flags & F_LOOPHEAD) != 0)
|
||||
table.put (this, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,8 @@ public class XMLOutputFactoryImpl
|
||||
{
|
||||
if (IS_PREFIX_DEFAULTING.equals(name))
|
||||
prefixDefaulting = ((Boolean) value).booleanValue();
|
||||
throw new IllegalArgumentException(name);
|
||||
else
|
||||
throw new IllegalArgumentException(name);
|
||||
}
|
||||
|
||||
public Object getProperty(String name)
|
||||
|
||||
@@ -39,7 +39,10 @@ package gnu.xml.stream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
@@ -57,16 +60,56 @@ public class XMLStreamWriterImpl
|
||||
implements XMLStreamWriter
|
||||
{
|
||||
|
||||
/**
|
||||
* The underlying character stream to write to.
|
||||
*/
|
||||
protected final Writer writer;
|
||||
|
||||
/**
|
||||
* The encoding being used.
|
||||
* Note that this must match the encoding of the character stream.
|
||||
*/
|
||||
protected final String encoding;
|
||||
|
||||
/**
|
||||
* Whether prefix defaulting is being used.
|
||||
* If true and a prefix has not been defined for a namespace specified on
|
||||
* an element or an attribute, a new prefix and namespace declaration will
|
||||
* be created.
|
||||
*/
|
||||
protected final boolean prefixDefaulting;
|
||||
|
||||
/**
|
||||
* The namespace context used to determine the namespace-prefix mappings
|
||||
* in scope.
|
||||
*/
|
||||
protected NamespaceContext namespaceContext;
|
||||
|
||||
/**
|
||||
* The stack of elements in scope.
|
||||
* Used to close the remaining elements.
|
||||
*/
|
||||
private LinkedList elements;
|
||||
private boolean inStartElement;
|
||||
private boolean emptyElement;
|
||||
private NamespaceSupport namespaces;
|
||||
|
||||
/**
|
||||
* Whether a start element has been opened but not yet closed.
|
||||
*/
|
||||
private boolean inStartElement;
|
||||
|
||||
/**
|
||||
* Whether we are in an empty element.
|
||||
*/
|
||||
private boolean emptyElement;
|
||||
|
||||
private NamespaceSupport namespaces;
|
||||
private int count = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @see #writer
|
||||
* @see #encoding
|
||||
* @see #prefixDefaulting
|
||||
*/
|
||||
protected XMLStreamWriterImpl(Writer writer, String encoding,
|
||||
boolean prefixDefaulting)
|
||||
{
|
||||
@@ -77,6 +120,10 @@ public class XMLStreamWriterImpl
|
||||
namespaces = new NamespaceSupport();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the end of a start-element event.
|
||||
* This will close the element if it was defined to be an empty element.
|
||||
*/
|
||||
private void endStartElement()
|
||||
throws IOException
|
||||
{
|
||||
@@ -128,7 +175,7 @@ public class XMLStreamWriterImpl
|
||||
if (!isDeclared)
|
||||
{
|
||||
if (prefixDefaulting)
|
||||
prefix = XMLConstants.DEFAULT_NS_PREFIX;
|
||||
prefix = createPrefix(namespaceURI);
|
||||
else
|
||||
throw new XMLStreamException("namespace " + namespaceURI +
|
||||
" has not been declared");
|
||||
@@ -140,13 +187,13 @@ public class XMLStreamWriterImpl
|
||||
writer.write(':');
|
||||
}
|
||||
writer.write(localName);
|
||||
if (prefixDefaulting && !isDeclared)
|
||||
inStartElement = true;
|
||||
if (!isDeclared)
|
||||
{
|
||||
writeNamespace(prefix, namespaceURI);
|
||||
}
|
||||
|
||||
elements.addLast(new String[] { prefix, localName });
|
||||
inStartElement = true;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@@ -156,6 +203,26 @@ public class XMLStreamWriterImpl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new unique prefix in the document.
|
||||
* Subclasses may override this method to provide a suitably unique prefix
|
||||
* for the given namespace.
|
||||
* @param namespaceURI the namespace URI
|
||||
*/
|
||||
protected String createPrefix(String namespaceURI)
|
||||
{
|
||||
Set prefixes = new HashSet();
|
||||
for (Enumeration e = namespaces.getPrefixes(); e.hasMoreElements(); )
|
||||
prefixes.add(e.nextElement());
|
||||
String ret;
|
||||
do
|
||||
{
|
||||
ret = "ns" + (count++);
|
||||
}
|
||||
while (prefixes.contains(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void writeStartElement(String prefix, String localName,
|
||||
String namespaceURI)
|
||||
throws XMLStreamException
|
||||
@@ -656,6 +723,12 @@ public class XMLStreamWriterImpl
|
||||
throw new IllegalArgumentException(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the specified text, ensuring that the content is suitably encoded
|
||||
* for XML.
|
||||
* @param text the text to write
|
||||
* @param inAttr whether we are in an attribute value
|
||||
*/
|
||||
private void writeEncoded(String text, boolean inAttr)
|
||||
throws IOException
|
||||
{
|
||||
|
||||
@@ -694,7 +694,11 @@ public class StreamSerializer
|
||||
{
|
||||
buf = new StringBuffer(text.substring(0, i));
|
||||
}
|
||||
buf.append("'");
|
||||
if (mode == Stylesheet.OUTPUT_HTML)
|
||||
// HTML does not define ', use character entity ref
|
||||
buf.append("'");
|
||||
else
|
||||
buf.append("'");
|
||||
}
|
||||
else if (c == '"' && inAttr)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* TransformerImpl.java --
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -505,6 +505,12 @@ class TransformerImpl
|
||||
{
|
||||
URL url = new URL(systemId);
|
||||
URLConnection connection = url.openConnection();
|
||||
// We need to call setDoInput(false), because our
|
||||
// implementation of the file protocol allows writing
|
||||
// (unlike Sun), but it will fail with a FileNotFoundException
|
||||
// if we also open the connection for input and the output
|
||||
// file doesn't yet exist.
|
||||
connection.setDoInput(false);
|
||||
connection.setDoOutput(true);
|
||||
out = connection.getOutputStream();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user