first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
24
rus/WEB-INF/lib/serializer-2.7.1_src/META-INF/MANIFEST.MF
Normal file
24
rus/WEB-INF/lib/serializer-2.7.1_src/META-INF/MANIFEST.MF
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Manifest-Version: 1.0
|
||||
Created-By: 1.3.1 (IBM Corporation)
|
||||
Main-Class: org.apache.xml.serializer.Version
|
||||
Class-Path: xml-apis.jar
|
||||
|
||||
Name: org/apache/xml/serializer/
|
||||
Comment: Serializer to write out XML, HTML etc. as a stream of charact
|
||||
ers from an input DOM or from input SAX events.
|
||||
Specification-Title: XSL Transformations (XSLT), at http://www.w3.org/
|
||||
TR/xslt
|
||||
Specification-Vendor: W3C Recommendation 16 November 1999
|
||||
Specification-Version: 1.0
|
||||
Implementation-Title: org.apache.xml.serializer
|
||||
Implementation-Version: 2.7.1
|
||||
Implementation-Vendor: Apache Software Foundation
|
||||
Implementation-URL: http://xml.apache.org/xalan-j/usagepatterns.html
|
||||
|
||||
Name: org/apache/xml/serializer/utils/
|
||||
Comment: Utilities used internally by the Serializer. Not for external
|
||||
use.
|
||||
Implementation-Title: org.apache.xml.serializer.utils
|
||||
Implementation-Version: 2.7.1
|
||||
Implementation-Vendor: Apache Software Foundation
|
||||
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
public final class AttributesImplSerializer extends AttributesImpl {
|
||||
private final Hashtable m_indexFromQName = new Hashtable();
|
||||
|
||||
private final StringBuffer m_buff = new StringBuffer();
|
||||
|
||||
private static final int MAX = 12;
|
||||
|
||||
private static final int MAXMinus1 = 11;
|
||||
|
||||
public final int getIndex(String qname) {
|
||||
int j;
|
||||
if (getLength() < 12) {
|
||||
j = super.getIndex(qname);
|
||||
return j;
|
||||
}
|
||||
Integer i = (Integer)this.m_indexFromQName.get(qname);
|
||||
if (i == null) {
|
||||
j = -1;
|
||||
} else {
|
||||
j = i.intValue();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
public final void addAttribute(String uri, String local, String qname, String type, String val) {
|
||||
int index = getLength();
|
||||
super.addAttribute(uri, local, qname, type, val);
|
||||
if (index < 11)
|
||||
return;
|
||||
if (index == 11) {
|
||||
switchOverToHash(12);
|
||||
} else {
|
||||
Integer i = new Integer(index);
|
||||
this.m_indexFromQName.put(qname, i);
|
||||
this.m_buff.setLength(0);
|
||||
this.m_buff.append('{').append(uri).append('}').append(local);
|
||||
String key = this.m_buff.toString();
|
||||
this.m_indexFromQName.put(key, i);
|
||||
}
|
||||
}
|
||||
|
||||
private void switchOverToHash(int numAtts) {
|
||||
for (int index = 0; index < numAtts; index++) {
|
||||
String qName = getQName(index);
|
||||
Integer i = new Integer(index);
|
||||
this.m_indexFromQName.put(qName, i);
|
||||
String uri = getURI(index);
|
||||
String local = getLocalName(index);
|
||||
this.m_buff.setLength(0);
|
||||
this.m_buff.append('{').append(uri).append('}').append(local);
|
||||
String key = this.m_buff.toString();
|
||||
this.m_indexFromQName.put(key, i);
|
||||
}
|
||||
}
|
||||
|
||||
public final void clear() {
|
||||
int len = getLength();
|
||||
super.clear();
|
||||
if (12 <= len)
|
||||
this.m_indexFromQName.clear();
|
||||
}
|
||||
|
||||
public final void setAttributes(Attributes atts) {
|
||||
super.setAttributes(atts);
|
||||
int numAtts = atts.getLength();
|
||||
if (12 <= numAtts)
|
||||
switchOverToHash(numAtts);
|
||||
}
|
||||
|
||||
public final int getIndex(String uri, String localName) {
|
||||
int j;
|
||||
if (getLength() < 12) {
|
||||
j = super.getIndex(uri, localName);
|
||||
return j;
|
||||
}
|
||||
this.m_buff.setLength(0);
|
||||
this.m_buff.append('{').append(uri).append('}').append(localName);
|
||||
String key = this.m_buff.toString();
|
||||
Integer i = (Integer)this.m_indexFromQName.get(key);
|
||||
if (i == null) {
|
||||
j = -1;
|
||||
} else {
|
||||
j = i.intValue();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,342 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.ResourceBundle;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import org.apache.xml.serializer.utils.SystemIDResolver;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.apache.xml.serializer.utils.WrappedRuntimeException;
|
||||
|
||||
final class CharInfo {
|
||||
CharInfo(String x0, String x1, boolean x2, null x3) {
|
||||
this(x0, x1, x2);
|
||||
}
|
||||
|
||||
public static final String HTML_ENTITIES_RESOURCE = SerializerBase.PKG_NAME + ".HTMLEntities";
|
||||
|
||||
public static final String XML_ENTITIES_RESOURCE = SerializerBase.PKG_NAME + ".XMLEntities";
|
||||
|
||||
private final int[] array_of_bits = createEmptySetOfIntegers(65535);
|
||||
|
||||
private int firstWordNotUsed = 0;
|
||||
|
||||
private final boolean[] shouldMapAttrChar_ASCII = new boolean[128];
|
||||
|
||||
private final boolean[] shouldMapTextChar_ASCII = new boolean[128];
|
||||
|
||||
private final CharKey m_charKey = new CharKey();
|
||||
|
||||
boolean onlyQuotAmpLtGt = true;
|
||||
|
||||
private CharInfo(String entitiesResource, String method, boolean internal) {
|
||||
this();
|
||||
this.m_charToString = new HashMap();
|
||||
ResourceBundle entities = null;
|
||||
boolean noExtraEntities = true;
|
||||
if (internal)
|
||||
try {
|
||||
entities = ResourceBundle.getBundle(entitiesResource);
|
||||
} catch (Exception e) {}
|
||||
if (entities != null) {
|
||||
Enumeration keys = entities.getKeys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String name = (String)keys.nextElement();
|
||||
String value = entities.getString(name);
|
||||
int code = Integer.parseInt(value);
|
||||
boolean extra = defineEntity(name, (char)code);
|
||||
if (extra)
|
||||
noExtraEntities = false;
|
||||
}
|
||||
} else {
|
||||
InputStream is = null;
|
||||
try {
|
||||
BufferedReader bufferedReader;
|
||||
if (internal) {
|
||||
is = CharInfo.class.getResourceAsStream(entitiesResource);
|
||||
} else {
|
||||
ClassLoader cl = ObjectFactory.findClassLoader();
|
||||
if (cl == null) {
|
||||
is = ClassLoader.getSystemResourceAsStream(entitiesResource);
|
||||
} else {
|
||||
is = cl.getResourceAsStream(entitiesResource);
|
||||
}
|
||||
if (is == null)
|
||||
try {
|
||||
URL url = new URL(entitiesResource);
|
||||
is = url.openStream();
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
if (is == null)
|
||||
throw new RuntimeException(Utils.messages.createMessage("ER_RESOURCE_COULD_NOT_FIND", new Object[] { entitiesResource, entitiesResource }));
|
||||
try {
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(is));
|
||||
}
|
||||
String line = bufferedReader.readLine();
|
||||
while (line != null) {
|
||||
if (line.length() == 0 || line.charAt(0) == '#') {
|
||||
line = bufferedReader.readLine();
|
||||
continue;
|
||||
}
|
||||
int index = line.indexOf(' ');
|
||||
if (index > 1) {
|
||||
String name = line.substring(0, index);
|
||||
index++;
|
||||
if (index < line.length()) {
|
||||
String value = line.substring(index);
|
||||
index = value.indexOf(' ');
|
||||
if (index > 0)
|
||||
value = value.substring(0, index);
|
||||
int code = Integer.parseInt(value);
|
||||
boolean extra = defineEntity(name, (char)code);
|
||||
if (extra)
|
||||
noExtraEntities = false;
|
||||
}
|
||||
}
|
||||
line = bufferedReader.readLine();
|
||||
}
|
||||
is.close();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(Utils.messages.createMessage("ER_RESOURCE_COULD_NOT_LOAD", new Object[] { entitiesResource, e.toString(), entitiesResource, e.toString() }));
|
||||
} finally {
|
||||
if (is != null)
|
||||
try {
|
||||
is.close();
|
||||
} catch (Exception except) {}
|
||||
}
|
||||
}
|
||||
this.onlyQuotAmpLtGt = noExtraEntities;
|
||||
if ("xml".equals(method))
|
||||
this.shouldMapTextChar_ASCII[34] = false;
|
||||
if ("html".equals(method)) {
|
||||
this.shouldMapAttrChar_ASCII[60] = false;
|
||||
this.shouldMapTextChar_ASCII[34] = false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean defineEntity(String name, char value) {
|
||||
StringBuffer sb = new StringBuffer("&");
|
||||
sb.append(name);
|
||||
sb.append(';');
|
||||
String entityString = sb.toString();
|
||||
boolean extra = defineChar2StringMapping(entityString, value);
|
||||
return extra;
|
||||
}
|
||||
|
||||
String getOutputStringForChar(char value) {
|
||||
this.m_charKey.setChar(value);
|
||||
return (String)this.m_charToString.get(this.m_charKey);
|
||||
}
|
||||
|
||||
final boolean shouldMapAttrChar(int value) {
|
||||
if (value < 128)
|
||||
return this.shouldMapAttrChar_ASCII[value];
|
||||
return get(value);
|
||||
}
|
||||
|
||||
final boolean shouldMapTextChar(int value) {
|
||||
if (value < 128)
|
||||
return this.shouldMapTextChar_ASCII[value];
|
||||
return get(value);
|
||||
}
|
||||
|
||||
private static CharInfo getCharInfoBasedOnPrivilege(String entitiesFileName, String method, boolean internal) {
|
||||
return (CharInfo)AccessController.doPrivileged(new PrivilegedAction(entitiesFileName, method, internal) {
|
||||
private final String val$entitiesFileName;
|
||||
|
||||
private final String val$method;
|
||||
|
||||
private final boolean val$internal;
|
||||
|
||||
{
|
||||
this.val$entitiesFileName = val$entitiesFileName;
|
||||
this.val$method = val$method;
|
||||
this.val$internal = val$internal;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
return new CharInfo(this.val$entitiesFileName, this.val$method, this.val$internal);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static CharInfo getCharInfo(String entitiesFileName, String method) {
|
||||
CharInfo charInfo = (CharInfo)m_getCharInfoCache.get(entitiesFileName);
|
||||
if (charInfo != null)
|
||||
return mutableCopyOf(charInfo);
|
||||
try {
|
||||
charInfo = getCharInfoBasedOnPrivilege(entitiesFileName, method, true);
|
||||
m_getCharInfoCache.put(entitiesFileName, charInfo);
|
||||
return mutableCopyOf(charInfo);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
return getCharInfoBasedOnPrivilege(entitiesFileName, method, false);
|
||||
} catch (Exception exception) {
|
||||
if (entitiesFileName.indexOf(':') < 0) {
|
||||
String absoluteEntitiesFileName = SystemIDResolver.getAbsoluteURIFromRelative(entitiesFileName);
|
||||
} else {
|
||||
try {
|
||||
String str = SystemIDResolver.getAbsoluteURI(entitiesFileName, null);
|
||||
} catch (TransformerException te) {
|
||||
throw new WrappedRuntimeException(te);
|
||||
}
|
||||
}
|
||||
return getCharInfoBasedOnPrivilege(entitiesFileName, method, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static CharInfo mutableCopyOf(CharInfo charInfo) {
|
||||
CharInfo copy = new CharInfo();
|
||||
int max = charInfo.array_of_bits.length;
|
||||
System.arraycopy(charInfo.array_of_bits, 0, copy.array_of_bits, 0, max);
|
||||
copy.firstWordNotUsed = charInfo.firstWordNotUsed;
|
||||
max = charInfo.shouldMapAttrChar_ASCII.length;
|
||||
System.arraycopy(charInfo.shouldMapAttrChar_ASCII, 0, copy.shouldMapAttrChar_ASCII, 0, max);
|
||||
max = charInfo.shouldMapTextChar_ASCII.length;
|
||||
System.arraycopy(charInfo.shouldMapTextChar_ASCII, 0, copy.shouldMapTextChar_ASCII, 0, max);
|
||||
copy.m_charToString = (HashMap)charInfo.m_charToString.clone();
|
||||
copy.onlyQuotAmpLtGt = charInfo.onlyQuotAmpLtGt;
|
||||
return copy;
|
||||
}
|
||||
|
||||
private static Hashtable m_getCharInfoCache = new Hashtable();
|
||||
|
||||
private HashMap m_charToString;
|
||||
|
||||
static final char S_HORIZONAL_TAB = '\t';
|
||||
|
||||
static final char S_LINEFEED = '\n';
|
||||
|
||||
static final char S_CARRIAGERETURN = '\r';
|
||||
|
||||
static final char S_SPACE = ' ';
|
||||
|
||||
static final char S_QUOTE = '"';
|
||||
|
||||
static final char S_LT = '<';
|
||||
|
||||
static final char S_GT = '>';
|
||||
|
||||
static final char S_NEL = '\u0085';
|
||||
|
||||
static final char S_LINE_SEPARATOR = '
';
|
||||
|
||||
static final int ASCII_MAX = 128;
|
||||
|
||||
private static final int SHIFT_PER_WORD = 5;
|
||||
|
||||
private static final int LOW_ORDER_BITMASK = 31;
|
||||
|
||||
private static int arrayIndex(int i) {
|
||||
return i >> 5;
|
||||
}
|
||||
|
||||
private static int bit(int i) {
|
||||
int ret = 1 << (i & 0x1F);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int[] createEmptySetOfIntegers(int max) {
|
||||
this.firstWordNotUsed = 0;
|
||||
int[] arr = new int[arrayIndex(max - 1) + 1];
|
||||
return arr;
|
||||
}
|
||||
|
||||
private final void set(int i) {
|
||||
setASCIItextDirty(i);
|
||||
setASCIIattrDirty(i);
|
||||
int j = i >> 5;
|
||||
int k = j + 1;
|
||||
if (this.firstWordNotUsed < k)
|
||||
this.firstWordNotUsed = k;
|
||||
this.array_of_bits[j] = this.array_of_bits[j] | 1 << (i & 0x1F);
|
||||
}
|
||||
|
||||
private final boolean get(int i) {
|
||||
boolean in_the_set = false;
|
||||
int j = i >> 5;
|
||||
if (j < this.firstWordNotUsed)
|
||||
in_the_set = ((this.array_of_bits[j] & 1 << (i & 0x1F)) != 0);
|
||||
return in_the_set;
|
||||
}
|
||||
|
||||
private boolean extraEntity(String outputString, int charToMap) {
|
||||
boolean extra = false;
|
||||
if (charToMap < 128)
|
||||
switch (charToMap) {
|
||||
case 34:
|
||||
if (!outputString.equals("""))
|
||||
extra = true;
|
||||
break;
|
||||
case 38:
|
||||
if (!outputString.equals("&"))
|
||||
extra = true;
|
||||
break;
|
||||
case 60:
|
||||
if (!outputString.equals("<"))
|
||||
extra = true;
|
||||
break;
|
||||
case 62:
|
||||
if (!outputString.equals(">"))
|
||||
extra = true;
|
||||
break;
|
||||
default:
|
||||
extra = true;
|
||||
break;
|
||||
}
|
||||
return extra;
|
||||
}
|
||||
|
||||
private void setASCIItextDirty(int j) {
|
||||
if (0 <= j && j < 128)
|
||||
this.shouldMapTextChar_ASCII[j] = true;
|
||||
}
|
||||
|
||||
private void setASCIIattrDirty(int j) {
|
||||
if (0 <= j && j < 128)
|
||||
this.shouldMapAttrChar_ASCII[j] = true;
|
||||
}
|
||||
|
||||
boolean defineChar2StringMapping(String outputString, char inputChar) {
|
||||
CharKey character = new CharKey(inputChar);
|
||||
this.m_charToString.put(character, outputString);
|
||||
set(inputChar);
|
||||
boolean extraMapping = extraEntity(outputString, inputChar);
|
||||
return extraMapping;
|
||||
}
|
||||
|
||||
private CharInfo() {}
|
||||
|
||||
private static class CharKey {
|
||||
private char m_char;
|
||||
|
||||
public CharKey(char key) {
|
||||
this.m_char = key;
|
||||
}
|
||||
|
||||
public CharKey() {}
|
||||
|
||||
public final void setChar(char c) {
|
||||
this.m_char = c;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return this.m_char;
|
||||
}
|
||||
|
||||
public final boolean equals(Object obj) {
|
||||
return (((CharKey)obj).m_char == this.m_char);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.ls.LSSerializerFilter;
|
||||
|
||||
public interface DOM3Serializer {
|
||||
void serializeDOM3(Node paramNode) throws IOException;
|
||||
|
||||
void setErrorHandler(DOMErrorHandler paramDOMErrorHandler);
|
||||
|
||||
DOMErrorHandler getErrorHandler();
|
||||
|
||||
void setNodeFilter(LSSerializerFilter paramLSSerializerFilter);
|
||||
|
||||
LSSerializerFilter getNodeFilter();
|
||||
|
||||
void setNewLine(char[] paramArrayOfchar);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public interface DOMSerializer {
|
||||
void serialize(Node paramNode) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
final class ElemContext {
|
||||
final int m_currentElemDepth;
|
||||
|
||||
ElemDesc m_elementDesc = null;
|
||||
|
||||
String m_elementLocalName = null;
|
||||
|
||||
String m_elementName = null;
|
||||
|
||||
String m_elementURI = null;
|
||||
|
||||
boolean m_isCdataSection;
|
||||
|
||||
boolean m_isRaw = false;
|
||||
|
||||
private ElemContext m_next;
|
||||
|
||||
final ElemContext m_prev;
|
||||
|
||||
boolean m_startTagOpen = false;
|
||||
|
||||
ElemContext() {
|
||||
this.m_prev = this;
|
||||
this.m_currentElemDepth = 0;
|
||||
}
|
||||
|
||||
private ElemContext(ElemContext previous) {
|
||||
this.m_prev = previous;
|
||||
previous.m_currentElemDepth++;
|
||||
}
|
||||
|
||||
final ElemContext pop() {
|
||||
return this.m_prev;
|
||||
}
|
||||
|
||||
final ElemContext push() {
|
||||
ElemContext frame = this.m_next;
|
||||
if (frame == null) {
|
||||
frame = new ElemContext(this);
|
||||
this.m_next = frame;
|
||||
}
|
||||
frame.m_startTagOpen = true;
|
||||
return frame;
|
||||
}
|
||||
|
||||
final ElemContext push(String uri, String localName, String qName) {
|
||||
ElemContext frame = this.m_next;
|
||||
if (frame == null) {
|
||||
frame = new ElemContext(this);
|
||||
this.m_next = frame;
|
||||
}
|
||||
frame.m_elementName = qName;
|
||||
frame.m_elementLocalName = localName;
|
||||
frame.m_elementURI = uri;
|
||||
frame.m_isCdataSection = false;
|
||||
frame.m_startTagOpen = true;
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import org.apache.xml.serializer.utils.StringToIntTable;
|
||||
|
||||
public final class ElemDesc {
|
||||
private int m_flags;
|
||||
|
||||
private StringToIntTable m_attrs = null;
|
||||
|
||||
static final int EMPTY = 2;
|
||||
|
||||
private static final int FLOW = 4;
|
||||
|
||||
static final int BLOCK = 8;
|
||||
|
||||
static final int BLOCKFORM = 16;
|
||||
|
||||
static final int BLOCKFORMFIELDSET = 32;
|
||||
|
||||
private static final int CDATA = 64;
|
||||
|
||||
private static final int PCDATA = 128;
|
||||
|
||||
static final int RAW = 256;
|
||||
|
||||
private static final int INLINE = 512;
|
||||
|
||||
private static final int INLINEA = 1024;
|
||||
|
||||
static final int INLINELABEL = 2048;
|
||||
|
||||
static final int FONTSTYLE = 4096;
|
||||
|
||||
static final int PHRASE = 8192;
|
||||
|
||||
static final int FORMCTRL = 16384;
|
||||
|
||||
static final int SPECIAL = 32768;
|
||||
|
||||
static final int ASPECIAL = 65536;
|
||||
|
||||
static final int HEADMISC = 131072;
|
||||
|
||||
static final int HEAD = 262144;
|
||||
|
||||
static final int LIST = 524288;
|
||||
|
||||
static final int PREFORMATTED = 1048576;
|
||||
|
||||
static final int WHITESPACESENSITIVE = 2097152;
|
||||
|
||||
static final int HEADELEM = 4194304;
|
||||
|
||||
static final int HTMLELEM = 8388608;
|
||||
|
||||
public static final int ATTRURL = 2;
|
||||
|
||||
public static final int ATTREMPTY = 4;
|
||||
|
||||
ElemDesc(int flags) {
|
||||
this.m_flags = flags;
|
||||
}
|
||||
|
||||
private boolean is(int flags) {
|
||||
return ((this.m_flags & flags) != 0);
|
||||
}
|
||||
|
||||
int getFlags() {
|
||||
return this.m_flags;
|
||||
}
|
||||
|
||||
void setAttr(String name, int flags) {
|
||||
if (null == this.m_attrs)
|
||||
this.m_attrs = new StringToIntTable();
|
||||
this.m_attrs.put(name, flags);
|
||||
}
|
||||
|
||||
public boolean isAttrFlagSet(String name, int flags) {
|
||||
return (null != this.m_attrs) ? (((this.m_attrs.getIgnoreCase(name) & flags) != 0)) : false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,421 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import javax.xml.transform.SourceLocator;
|
||||
import javax.xml.transform.Transformer;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
public class EmptySerializer implements SerializationHandler {
|
||||
protected static final String ERR = "EmptySerializer method not over-ridden";
|
||||
|
||||
protected void couldThrowIOException() throws IOException {}
|
||||
|
||||
protected void couldThrowSAXException() throws SAXException {}
|
||||
|
||||
protected void couldThrowSAXException(char[] chars, int off, int len) throws SAXException {}
|
||||
|
||||
protected void couldThrowSAXException(String elemQName) throws SAXException {}
|
||||
|
||||
protected void couldThrowException() throws Exception {}
|
||||
|
||||
void aMethodIsCalled() {}
|
||||
|
||||
public ContentHandler asContentHandler() throws IOException {
|
||||
couldThrowIOException();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setContentHandler(ContentHandler ch) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public Properties getOutputFormat() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
aMethodIsCalled();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void serialize(Node node) throws IOException {
|
||||
couldThrowIOException();
|
||||
}
|
||||
|
||||
public void setCdataSectionElements(Vector URI_and_localNames) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public boolean setEscaping(boolean escape) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setIndent(boolean indent) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setIndentAmount(int spaces) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setOutputFormat(Properties format) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setOutputStream(OutputStream output) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setWriter(Writer writer) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setTransformer(Transformer transformer) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public Transformer getTransformer() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void flushPending() throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void addAttributes(Attributes atts) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void addAttribute(String name, String value) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void characters(String chars) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void endElement(String elemName) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void startDocument() throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void startElement(String uri, String localName, String qName) throws SAXException {
|
||||
couldThrowSAXException(qName);
|
||||
}
|
||||
|
||||
public void startElement(String qName) throws SAXException {
|
||||
couldThrowSAXException(qName);
|
||||
}
|
||||
|
||||
public void namespaceAfterStartElement(String uri, String prefix) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void entityReference(String entityName) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public NamespaceMappings getNamespaceMappings() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getPrefix(String uri) {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getNamespaceURI(String name, boolean isElement) {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getNamespaceURIFromPrefix(String prefix) {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDocumentLocator(Locator arg0) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void startPrefixMapping(String arg0, String arg1) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void endPrefixMapping(String arg0) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void startElement(String arg0, String arg1, String arg2, Attributes arg3) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void endElement(String arg0, String arg1, String arg2) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void characters(char[] arg0, int arg1, int arg2) throws SAXException {
|
||||
couldThrowSAXException(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void processingInstruction(String arg0, String arg1) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void skippedEntity(String arg0) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void comment(String comment) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void startDTD(String arg0, String arg1, String arg2) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void endDTD() throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void startEntity(String arg0) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void endEntity(String arg0) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void startCDATA() throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void endCDATA() throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void comment(char[] arg0, int arg1, int arg2) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public String getDoctypePublic() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDoctypeSystem() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getIndent() {
|
||||
aMethodIsCalled();
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getIndentAmount() {
|
||||
aMethodIsCalled();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getMediaType() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getOmitXMLDeclaration() {
|
||||
aMethodIsCalled();
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getStandalone() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCdataSectionElements(Hashtable h) throws Exception {
|
||||
couldThrowException();
|
||||
}
|
||||
|
||||
public void setDoctype(String system, String pub) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setDoctypePublic(String doctype) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setDoctypeSystem(String doctype) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setEncoding(String encoding) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setMediaType(String mediatype) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setOmitXMLDeclaration(boolean b) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setStandalone(String standalone) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void elementDecl(String arg0, String arg1) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void internalEntityDecl(String arg0, String arg1) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void warning(SAXParseException arg0) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void error(SAXParseException arg0) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void fatalError(SAXParseException arg0) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public DOMSerializer asDOMSerializer() throws IOException {
|
||||
couldThrowIOException();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setNamespaceMappings(NamespaceMappings mappings) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setSourceLocator(SourceLocator locator) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void addUniqueAttribute(String name, String value, int flags) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void characters(Node node) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void addXSLAttribute(String qName, String value, String uri) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void notationDecl(String arg0, String arg1, String arg2) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void unparsedEntityDecl(String arg0, String arg1, String arg2, String arg3) throws SAXException {
|
||||
couldThrowSAXException();
|
||||
}
|
||||
|
||||
public void setDTDEntityExpansion(boolean expand) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public String getOutputProperty(String name) {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getOutputPropertyDefault(String name) {
|
||||
aMethodIsCalled();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOutputProperty(String name, String val) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public void setOutputPropertyDefault(String name, String val) {
|
||||
aMethodIsCalled();
|
||||
}
|
||||
|
||||
public Object asDOM3Serializer() throws IOException {
|
||||
couldThrowIOException();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
public final class EncodingInfo {
|
||||
private final char m_highCharInContiguousGroup;
|
||||
|
||||
final String name;
|
||||
|
||||
final String javaName;
|
||||
|
||||
private InEncoding m_encoding;
|
||||
|
||||
public boolean isInEncoding(char ch) {
|
||||
if (this.m_encoding == null)
|
||||
this.m_encoding = new EncodingImpl(this);
|
||||
return this.m_encoding.isInEncoding(ch);
|
||||
}
|
||||
|
||||
public boolean isInEncoding(char high, char low) {
|
||||
if (this.m_encoding == null)
|
||||
this.m_encoding = new EncodingImpl(this);
|
||||
return this.m_encoding.isInEncoding(high, low);
|
||||
}
|
||||
|
||||
public EncodingInfo(String name, String javaName, char highChar) {
|
||||
this.name = name;
|
||||
this.javaName = javaName;
|
||||
this.m_highCharInContiguousGroup = highChar;
|
||||
}
|
||||
|
||||
private class EncodingImpl implements InEncoding {
|
||||
private final String m_encoding;
|
||||
|
||||
private final int m_first;
|
||||
|
||||
private final int m_explFirst;
|
||||
|
||||
private final int m_explLast;
|
||||
|
||||
private final int m_last;
|
||||
|
||||
private EncodingInfo.InEncoding m_before;
|
||||
|
||||
private EncodingInfo.InEncoding m_after;
|
||||
|
||||
private static final int RANGE = 128;
|
||||
|
||||
private final boolean[] m_alreadyKnown;
|
||||
|
||||
private final boolean[] m_isInEncoding;
|
||||
|
||||
private final EncodingInfo this$0;
|
||||
|
||||
EncodingImpl(EncodingInfo.null x1) {
|
||||
this(x0);
|
||||
}
|
||||
|
||||
public boolean isInEncoding(char ch1) {
|
||||
boolean bool;
|
||||
int codePoint = Encodings.toCodePoint(ch1);
|
||||
if (codePoint < this.m_explFirst) {
|
||||
if (this.m_before == null)
|
||||
this.m_before = new EncodingImpl(this.this$0, this.m_encoding, this.m_first, this.m_explFirst - 1, codePoint);
|
||||
bool = this.m_before.isInEncoding(ch1);
|
||||
} else if (this.m_explLast < codePoint) {
|
||||
if (this.m_after == null)
|
||||
this.m_after = new EncodingImpl(this.this$0, this.m_encoding, this.m_explLast + 1, this.m_last, codePoint);
|
||||
bool = this.m_after.isInEncoding(ch1);
|
||||
} else {
|
||||
int idx = codePoint - this.m_explFirst;
|
||||
if (this.m_alreadyKnown[idx]) {
|
||||
bool = this.m_isInEncoding[idx];
|
||||
} else {
|
||||
bool = EncodingInfo.inEncoding(ch1, this.m_encoding);
|
||||
this.m_alreadyKnown[idx] = true;
|
||||
this.m_isInEncoding[idx] = bool;
|
||||
}
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
public boolean isInEncoding(char high, char low) {
|
||||
boolean bool;
|
||||
int codePoint = Encodings.toCodePoint(high, low);
|
||||
if (codePoint < this.m_explFirst) {
|
||||
if (this.m_before == null)
|
||||
this.m_before = new EncodingImpl(this.this$0, this.m_encoding, this.m_first, this.m_explFirst - 1, codePoint);
|
||||
bool = this.m_before.isInEncoding(high, low);
|
||||
} else if (this.m_explLast < codePoint) {
|
||||
if (this.m_after == null)
|
||||
this.m_after = new EncodingImpl(this.this$0, this.m_encoding, this.m_explLast + 1, this.m_last, codePoint);
|
||||
bool = this.m_after.isInEncoding(high, low);
|
||||
} else {
|
||||
int idx = codePoint - this.m_explFirst;
|
||||
if (this.m_alreadyKnown[idx]) {
|
||||
bool = this.m_isInEncoding[idx];
|
||||
} else {
|
||||
bool = EncodingInfo.inEncoding(high, low, this.m_encoding);
|
||||
this.m_alreadyKnown[idx] = true;
|
||||
this.m_isInEncoding[idx] = bool;
|
||||
}
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
private EncodingImpl() {
|
||||
this(this$0, this$0.javaName, 0, Integer.MAX_VALUE, 0);
|
||||
}
|
||||
|
||||
private EncodingImpl(EncodingInfo this$0, String encoding, int first, int last, int codePoint) {
|
||||
this.this$0 = this$0;
|
||||
this.m_alreadyKnown = new boolean[128];
|
||||
this.m_isInEncoding = new boolean[128];
|
||||
this.m_first = first;
|
||||
this.m_last = last;
|
||||
this.m_explFirst = codePoint;
|
||||
this.m_explLast = codePoint + 127;
|
||||
this.m_encoding = encoding;
|
||||
if (this$0.javaName != null) {
|
||||
if (0 <= this.m_explFirst && this.m_explFirst <= 127)
|
||||
if ("UTF8".equals(this$0.javaName) || "UTF-16".equals(this$0.javaName) || "ASCII".equals(this$0.javaName) || "US-ASCII".equals(this$0.javaName) || "Unicode".equals(this$0.javaName) || "UNICODE".equals(this$0.javaName) || this$0.javaName.startsWith("ISO8859"))
|
||||
for (int unicode = 1; unicode < 127; unicode++) {
|
||||
int idx = unicode - this.m_explFirst;
|
||||
if (0 <= idx && idx < 128) {
|
||||
this.m_alreadyKnown[idx] = true;
|
||||
this.m_isInEncoding[idx] = true;
|
||||
}
|
||||
}
|
||||
if (this$0.javaName == null)
|
||||
for (int idx = 0; idx < this.m_alreadyKnown.length; idx++) {
|
||||
this.m_alreadyKnown[idx] = true;
|
||||
this.m_isInEncoding[idx] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean inEncoding(char ch, String encoding) {
|
||||
boolean bool;
|
||||
try {
|
||||
char[] cArray = new char[1];
|
||||
cArray[0] = ch;
|
||||
String s = new String(cArray);
|
||||
byte[] bArray = s.getBytes(encoding);
|
||||
bool = inEncoding(ch, bArray);
|
||||
} catch (Exception e) {
|
||||
bool = false;
|
||||
if (encoding == null)
|
||||
bool = true;
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
private static boolean inEncoding(char high, char low, String encoding) {
|
||||
boolean bool;
|
||||
try {
|
||||
char[] cArray = new char[2];
|
||||
cArray[0] = high;
|
||||
cArray[1] = low;
|
||||
String s = new String(cArray);
|
||||
byte[] bArray = s.getBytes(encoding);
|
||||
bool = inEncoding(high, bArray);
|
||||
} catch (Exception e) {
|
||||
bool = false;
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
private static boolean inEncoding(char ch, byte[] data) {
|
||||
boolean bool;
|
||||
if (data == null || data.length == 0) {
|
||||
bool = false;
|
||||
} else if (data[0] == 0) {
|
||||
bool = false;
|
||||
} else if (data[0] == 63 && ch != '?') {
|
||||
bool = false;
|
||||
} else {
|
||||
bool = true;
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
public final char getHighChar() {
|
||||
return this.m_highCharInContiguousGroup;
|
||||
}
|
||||
|
||||
private static interface InEncoding {
|
||||
boolean isInEncoding(char param1Char);
|
||||
|
||||
boolean isInEncoding(char param1Char1, char param1Char2);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
import org.apache.xml.serializer.utils.WrappedRuntimeException;
|
||||
|
||||
public final class Encodings {
|
||||
private static final String ENCODINGS_FILE = SerializerBase.PKG_PATH + "/Encodings.properties";
|
||||
|
||||
static final String DEFAULT_MIME_ENCODING = "UTF-8";
|
||||
|
||||
static Writer getWriter(OutputStream output, String encoding) throws UnsupportedEncodingException {
|
||||
for (int i = 0; i < _encodings.length; i++) {
|
||||
if ((_encodings[i]).name.equalsIgnoreCase(encoding))
|
||||
try {
|
||||
String javaName = (_encodings[i]).javaName;
|
||||
OutputStreamWriter osw = new OutputStreamWriter(output, javaName);
|
||||
return osw;
|
||||
} catch (IllegalArgumentException iae) {
|
||||
|
||||
} catch (UnsupportedEncodingException usee) {}
|
||||
}
|
||||
try {
|
||||
return new OutputStreamWriter(output, encoding);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new UnsupportedEncodingException(encoding);
|
||||
}
|
||||
}
|
||||
|
||||
static EncodingInfo getEncodingInfo(String encoding) {
|
||||
String normalizedEncoding = toUpperCaseFast(encoding);
|
||||
EncodingInfo ei = (EncodingInfo)_encodingTableKeyJava.get(normalizedEncoding);
|
||||
if (ei == null)
|
||||
ei = (EncodingInfo)_encodingTableKeyMime.get(normalizedEncoding);
|
||||
if (ei == null)
|
||||
ei = new EncodingInfo(null, null, '\000');
|
||||
return ei;
|
||||
}
|
||||
|
||||
public static boolean isRecognizedEncoding(String encoding) {
|
||||
String normalizedEncoding = encoding.toUpperCase();
|
||||
EncodingInfo ei = (EncodingInfo)_encodingTableKeyJava.get(normalizedEncoding);
|
||||
if (ei == null)
|
||||
ei = (EncodingInfo)_encodingTableKeyMime.get(normalizedEncoding);
|
||||
if (ei != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String toUpperCaseFast(String s) {
|
||||
String str;
|
||||
boolean different = false;
|
||||
int mx = s.length();
|
||||
char[] chars = new char[mx];
|
||||
for (int i = 0; i < mx; i++) {
|
||||
char ch = s.charAt(i);
|
||||
if ('a' <= ch && ch <= 'z') {
|
||||
ch = (char)(ch + -32);
|
||||
different = true;
|
||||
}
|
||||
chars[i] = ch;
|
||||
}
|
||||
if (different) {
|
||||
str = String.valueOf(chars);
|
||||
} else {
|
||||
str = s;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static String getMimeEncoding(String encoding) {
|
||||
if (null == encoding) {
|
||||
try {
|
||||
encoding = System.getProperty("file.encoding", "UTF8");
|
||||
if (null != encoding) {
|
||||
String jencoding = (encoding.equalsIgnoreCase("Cp1252") || encoding.equalsIgnoreCase("ISO8859_1") || encoding.equalsIgnoreCase("8859_1") || encoding.equalsIgnoreCase("UTF8")) ? "UTF-8" : convertJava2MimeEncoding(encoding);
|
||||
encoding = (null != jencoding) ? jencoding : "UTF-8";
|
||||
} else {
|
||||
encoding = "UTF-8";
|
||||
}
|
||||
} catch (SecurityException se) {
|
||||
encoding = "UTF-8";
|
||||
}
|
||||
} else {
|
||||
encoding = convertJava2MimeEncoding(encoding);
|
||||
}
|
||||
return encoding;
|
||||
}
|
||||
|
||||
private static String convertJava2MimeEncoding(String encoding) {
|
||||
EncodingInfo enc = (EncodingInfo)_encodingTableKeyJava.get(toUpperCaseFast(encoding));
|
||||
if (null != enc)
|
||||
return enc.name;
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public static String convertMime2JavaEncoding(String encoding) {
|
||||
for (int i = 0; i < _encodings.length; i++) {
|
||||
if ((_encodings[i]).name.equalsIgnoreCase(encoding))
|
||||
return (_encodings[i]).javaName;
|
||||
}
|
||||
return encoding;
|
||||
}
|
||||
|
||||
private static EncodingInfo[] loadEncodingInfo() {
|
||||
try {
|
||||
SecuritySupport ss = SecuritySupport.getInstance();
|
||||
InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(), ENCODINGS_FILE);
|
||||
Properties props = new Properties();
|
||||
if (is != null) {
|
||||
props.load(is);
|
||||
is.close();
|
||||
}
|
||||
int totalEntries = props.size();
|
||||
List encodingInfo_list = new ArrayList();
|
||||
Enumeration keys = props.keys();
|
||||
for (int i = 0; i < totalEntries; i++) {
|
||||
String javaName = (String)keys.nextElement();
|
||||
String val = props.getProperty(javaName);
|
||||
int len = lengthOfMimeNames(val);
|
||||
if (len == 0) {
|
||||
String mimeName = javaName;
|
||||
char highChar = '\000';
|
||||
} else {
|
||||
char c;
|
||||
try {
|
||||
String highVal = val.substring(len).trim();
|
||||
c = (char)Integer.decode(highVal).intValue();
|
||||
} catch (NumberFormatException e) {
|
||||
c = '\000';
|
||||
}
|
||||
String mimeNames = val.substring(0, len);
|
||||
StringTokenizer st = new StringTokenizer(mimeNames, ",");
|
||||
boolean first = true;
|
||||
for (; st.hasMoreTokens();
|
||||
first = false) {
|
||||
String str = st.nextToken();
|
||||
EncodingInfo ei = new EncodingInfo(str, javaName, c);
|
||||
encodingInfo_list.add(ei);
|
||||
_encodingTableKeyMime.put(str.toUpperCase(), ei);
|
||||
if (first)
|
||||
_encodingTableKeyJava.put(javaName.toUpperCase(), ei);
|
||||
}
|
||||
}
|
||||
}
|
||||
EncodingInfo[] ret_ei = new EncodingInfo[encodingInfo_list.size()];
|
||||
encodingInfo_list.toArray(ret_ei);
|
||||
return ret_ei;
|
||||
} catch (MalformedURLException mue) {
|
||||
throw new WrappedRuntimeException(mue);
|
||||
} catch (IOException ioe) {
|
||||
throw new WrappedRuntimeException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
private static int lengthOfMimeNames(String val) {
|
||||
int len = val.indexOf(' ');
|
||||
if (len < 0)
|
||||
len = val.length();
|
||||
return len;
|
||||
}
|
||||
|
||||
static boolean isHighUTF16Surrogate(char ch) {
|
||||
return ('?' <= ch && ch <= '?');
|
||||
}
|
||||
|
||||
static boolean isLowUTF16Surrogate(char ch) {
|
||||
return ('?' <= ch && ch <= '?');
|
||||
}
|
||||
|
||||
static int toCodePoint(char highSurrogate, char lowSurrogate) {
|
||||
int codePoint = (highSurrogate - 55296 << 10) + lowSurrogate - 56320 + 65536;
|
||||
return codePoint;
|
||||
}
|
||||
|
||||
static int toCodePoint(char ch) {
|
||||
int codePoint = ch;
|
||||
return codePoint;
|
||||
}
|
||||
|
||||
public static char getHighChar(String encoding) {
|
||||
char c;
|
||||
String normalizedEncoding = toUpperCaseFast(encoding);
|
||||
EncodingInfo ei = (EncodingInfo)_encodingTableKeyJava.get(normalizedEncoding);
|
||||
if (ei == null)
|
||||
ei = (EncodingInfo)_encodingTableKeyMime.get(normalizedEncoding);
|
||||
if (ei != null) {
|
||||
c = ei.getHighChar();
|
||||
} else {
|
||||
c = '\000';
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
private static final Hashtable _encodingTableKeyJava = new Hashtable();
|
||||
|
||||
private static final Hashtable _encodingTableKeyMime = new Hashtable();
|
||||
|
||||
private static final EncodingInfo[] _encodings = loadEncodingInfo();
|
||||
}
|
||||
|
|
@ -0,0 +1,260 @@
|
|||
##
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
##
|
||||
#
|
||||
# $Id: Encodings.properties 468654 2006-10-28 07:09:23Z minchau $
|
||||
#
|
||||
# Each entry in this properties file is:
|
||||
# 1) The Java name for the encoding
|
||||
# 2) A comma separated list of the MIME names for the encoding,
|
||||
# with the first one being the preferred MIME name.
|
||||
# 3) An optional high char. Characters at or below this value are
|
||||
# definately in the encoding, but characters above it may or may not be.
|
||||
# This value is given only for performance reasons.
|
||||
# A value of zero is the same as no value at all.
|
||||
#
|
||||
# For example this line in this file:
|
||||
# ASCII ASCII,US-ASCII 0x007F
|
||||
# Means the Java name for the encoding is "ASCII". The MIME names for this
|
||||
# encoding which may appear in a stylesheet are "ASCII" or "US-ASCII"
|
||||
# and the optional high code point value is given, and it is 0X007F
|
||||
# which means that the contiguous block of chars from
|
||||
# 0x0001 to 0x007F ( 127 in base 10) are all in the encoding.
|
||||
# Higher values above this char might be in the encoding, although in the
|
||||
# case of this particular encoding there are no higher chars.
|
||||
#
|
||||
#
|
||||
# <JAVA name encoding>, <PREFERRED name MIME>
|
||||
#
|
||||
#
|
||||
ASCII ASCII,US-ASCII 0x007F
|
||||
#
|
||||
# Big5, Traditional Chinese
|
||||
Big5 BIG5,csBig5 0x007F
|
||||
#Big5 with Hong Kong extensions, Traditional Chinese (incorporating 2001 revision)
|
||||
Big5_HKSCS BIG5-HKSCS 0x007F
|
||||
# USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia
|
||||
Cp037 EBCDIC-CP-US,EBCDIC-CP-CA,EBCDIC-CP-WT,EBCDIC-CP-NL,IBM037 0x0019
|
||||
# IBM Austria, Germany
|
||||
Cp273 IBM273,csIBM273 0x0019
|
||||
Cp274 csIBM274,EBCDIC-BE
|
||||
Cp275 csIBM275,EBCDIC-BR
|
||||
# IBM Denmark, Norway
|
||||
Cp277 EBCDIC-CP-DK,EBCDIC-CP-NO,IBM277,csIBM277 0x0019
|
||||
# IBM Finland, Sweden
|
||||
Cp278 EBCDIC-CP-FI,EBCDIC-CP-SE,IBM278,csIBM278 0x0019
|
||||
# IBM Italy
|
||||
Cp280 EBCDIC-CP-IT,IBM280,csIBM280 0x0019
|
||||
Cp281 EBCDIC-JP-E,csIBM281
|
||||
# IBM Catalan/Spain, Spanish Latin America
|
||||
Cp284 EBCDIC-CP-ES,IBM284,csIBM284 0x0019
|
||||
# IBM United Kingdom, Ireland
|
||||
Cp285 EBCDIC-CP-GB,IBM284,csIBM285 0x0019
|
||||
Cp290 EBCDIC-JP-kana,IBM290,csIBM290 0x0019
|
||||
# IBM France
|
||||
Cp297 EBCDIC-CP-FR,IBM297,csIBM297 0x0019
|
||||
# IBM Arabic
|
||||
Cp420 EBCDIC-CP-AR1,IBM420,csIBM420 0x0019
|
||||
Cp423 EBCDIC-CP-GR,IBM423,csIBM423
|
||||
# IBM Hebrew
|
||||
Cp424 EBCDIC-CP-HE,IBM424,csIBM424 0x0019
|
||||
Cp437 437,IBM437,csPC8CodePage437 0x007F
|
||||
# EBCDIC 500V1
|
||||
Cp500 EBCDIC-CP-CH,EBCDIC-CP-BE,IBM500,csIBM500 0x0019
|
||||
# PC Baltic
|
||||
Cp775 IBM775,csPC775Baltic 0x007F
|
||||
# IBM Thailand extended SBCS
|
||||
Cp838 IBM-Thai,838,csIBMThai 0x0019
|
||||
# MS-DOS Latin-1
|
||||
Cp850 850,csPC850Multilingual,IBM850 0x007F
|
||||
Cp851 851,IBM851,csIBM851
|
||||
# MS-DOS Latin-2
|
||||
Cp852 IBM852,852,csPCp852 0x007F
|
||||
# IBM Cyrillic
|
||||
Cp855 IBM855,855,csIBM855 0x007F
|
||||
# IBM Turkish
|
||||
Cp857 IBM857,857,csIBM857 0x007F
|
||||
# Variant of Cp850 with Euro character
|
||||
Cp858 IBM00858 0x007F
|
||||
# MS-DOS Portuguese
|
||||
Cp860 860,csIBM860,IBM860 0x007F
|
||||
# MS-DOS Icelandic
|
||||
Cp861 IBM861,861,csIBM861,cp-is 0x007F
|
||||
#
|
||||
Cp862 IBM862,862,csPCi62LatinHebrew 0x007F
|
||||
# MS-DOS Canadian French
|
||||
Cp863 IBM863,863,csIBM863 0x007F
|
||||
# PC Arabic
|
||||
Cp864 IBM864,864,csIBM864 0x007F
|
||||
# MS-DOS Nordic
|
||||
Cp865 IBM865,865,csIBM865 0x007F
|
||||
# MS-DOS Russian
|
||||
Cp866 IBM866,866,csIBM866 0x007F
|
||||
# MS-DOS Pakistan
|
||||
Cp868 IBM868,cp-ar,csIBM868 0x007F
|
||||
# IBM Modern Greek
|
||||
Cp869 IBM869,869,cp-gr,csIBM869 0x007F
|
||||
# IBM Multilingual Latin-2
|
||||
Cp870 EBCDIC-CP-ROECE,EBCDIC-CP-YU,IBM870,csIBM870 0x0019
|
||||
# IBM Iceland
|
||||
Cp871 EBCDIC-CP-IS,IBM871,csIBM871 0x0019
|
||||
Cp880 EBCDIC-Cyrillic,IBM880,csIBM880
|
||||
Cp891 IBM891,csIBM891
|
||||
Cp903 IBM903,csIBM903
|
||||
Cp904 IBM904,csIBM904
|
||||
Cp905 IBM905,csIBM905,EBCDIC-CP-TR
|
||||
# IBM Pakistan (Urdu)
|
||||
Cp918 EBCDIC-CP-AR2,IBM918,csIBM918 0x0019
|
||||
# GBK, Simplified Chinese
|
||||
Cp936 GBK,MS936,WINDOWS-936
|
||||
# IBM Latin-5, Turkey
|
||||
Cp1026 IBM1026,csIBM1026 0x0019
|
||||
# Latin-1 character set for EBCDIC hosts
|
||||
Cp1047 IBM1047,IBM-1047 0x0019
|
||||
# Variant of Cp037 with Euro character
|
||||
Cp1140 IBM01140 0x0019
|
||||
# Variant of Cp273 with Euro character
|
||||
Cp1141 IBM01141 0x0019
|
||||
# Variant of Cp277 with Euro character
|
||||
Cp1142 IBM01142 0x0019
|
||||
# Variant of Cp278 with Euro character
|
||||
Cp1143 IBM01143 0x0019
|
||||
# Variant of Cp280 with Euro character
|
||||
Cp1144 IBM01144 0x0019
|
||||
# Variant of Cp284 with Euro character
|
||||
Cp1145 IBM01145 0x0019
|
||||
# Variant of Cp285 with Euro character
|
||||
Cp1146 IBM01146 0x0019
|
||||
# Variant of Cp297 with Euro character
|
||||
Cp1147 IBM01147 0x0019
|
||||
# Variant of Cp500 with Euro character
|
||||
Cp1148 IBM01148 0x0019
|
||||
# Variant of Cp871 with Euro character
|
||||
Cp1149 IBM01149 0x0019
|
||||
Cp1250 WINDOWS-1250 0x007F
|
||||
Cp1251 WINDOWS-1251 0x007F
|
||||
Cp1252 WINDOWS-1252 0x007F
|
||||
Cp1253 WINDOWS-1253 0x007F
|
||||
Cp1254 WINDOWS-1254 0x007F
|
||||
# Windows Hebrew
|
||||
Cp1255 WINDOWS-1255 0x007F
|
||||
# Windows Arabic
|
||||
Cp1256 WINDOWS-1256 0x007F
|
||||
Cp1257 WINDOWS-1257 0x007F
|
||||
# Windows Vietnamese
|
||||
Cp1258 WINDOWS-1258 0x007F
|
||||
EUC-CN EUC-CN 0x007F
|
||||
EUC_CN EUC-CN 0x007F
|
||||
#
|
||||
#JISX 0201, 0208 and 0212, EUC encoding Japanese
|
||||
EUC-JP EUC-JP 0x007F
|
||||
EUC_JP EUC-JP 0x007F
|
||||
# KS C 5601, EUC encoding, Korean
|
||||
EUC-KR EUC-KR 0x007F
|
||||
EUC_KR EUC-KR 0x007F
|
||||
# CNS11643 (Plane 1-7,15), EUC encoding, Traditional Chinese
|
||||
EUC-TW EUC-TW 0x007F
|
||||
EUC_TW EUC-TW,x-EUC-TW 0x007F
|
||||
EUCJIS EUC-JP 0x007F
|
||||
#
|
||||
# GB2312, EUC encoding, Simplified Chinese
|
||||
GB2312 GB2312 0x007F
|
||||
|
||||
# GB2312 and CNS11643 in ISO 2022 CN form, Simplified and Traditional Chinese (conversion to Unicode only)
|
||||
ISO2022CN ISO-2022-CN
|
||||
# JIS X 0201, 0208, in ISO 2022 form, Japanese
|
||||
ISO2022JP ISO-2022-JP
|
||||
# ISO 2022 KR, Korean
|
||||
ISO2022KR ISO-2022-KR 0x007F
|
||||
#
|
||||
#
|
||||
ISO8859-1 ISO-8859-1 0x00FF
|
||||
ISO8859_1 ISO-8859-1 0x00FF
|
||||
8859-1 ISO-8859-1 0x00FF
|
||||
8859_1 ISO-8859-1 0x00FF
|
||||
#
|
||||
ISO8859-2 ISO-8859-2 0x00A0
|
||||
ISO8859_2 ISO-8859-2 0x00A0
|
||||
8859-2 ISO-8859-2 0x00A0
|
||||
8859_2 ISO-8859-2 0x00A0
|
||||
#
|
||||
# Latin Alphabet No. 3
|
||||
ISO8859-3 ISO-8859-3 0x00A0
|
||||
ISO8859_3 ISO-8859-3 0x00A0
|
||||
8859-3 ISO-8859-3 0x00A0
|
||||
8859_3 ISO-8859-3 0x00A0
|
||||
#
|
||||
ISO8859-4 ISO-8859-4 0x00A0
|
||||
ISO8859_4 ISO-8859-4 0x00A0
|
||||
8859-4 ISO-8859-4 0x00A0
|
||||
8859_4 ISO-8859-4 0x00A0
|
||||
#
|
||||
ISO8859-5 ISO-8859-5 0x00A0
|
||||
ISO8859_5 ISO-8859-5 0x00A0
|
||||
8859-5 ISO-8859-5 0x00A0
|
||||
8859_5 ISO-8859-5 0x00A0
|
||||
#
|
||||
# Latin/Arabic Alphabet
|
||||
ISO8859-6 ISO-8859-6 0x00A0
|
||||
ISO8859_6 ISO-8859-6 0x00A0
|
||||
8859-6 ISO-8859-6 0x00A0
|
||||
8859_6 ISO-8859-6 0x00A0
|
||||
#
|
||||
ISO8859-7 ISO-8859-7 0x00A0
|
||||
ISO8859_7 ISO-8859-7 0x00A0
|
||||
8859-7 ISO-8859-7 0x00A0
|
||||
8859_7 ISO-8859-7 0x00A0
|
||||
#
|
||||
ISO8859-8 ISO-8859-8 0x00A0
|
||||
ISO8859_8 ISO-8859-8 0x00A0
|
||||
8859-8 ISO-8859-8 0x00A0
|
||||
8859_8 ISO-8859-8 0x00A0
|
||||
#
|
||||
ISO8859-9 ISO-8859-9 0x00CF
|
||||
ISO8859_9 ISO-8859-9 0x00CF
|
||||
8859-9 ISO-8859-9 0x00CF
|
||||
8859_9 ISO-8859-9 0x00CF
|
||||
#
|
||||
ISO8859-10 ISO-8859-10 0x007E
|
||||
ISO8859_10 ISO-8859-10 0x007E
|
||||
ISO8859-11 ISO-8859-11 0x007E
|
||||
ISO8859_11 ISO-8859-11 0x007E
|
||||
ISO8859-12 ISO-8859-12 0x007F
|
||||
ISO8859_12 ISO-8859-12 0x007F
|
||||
ISO8859-13 ISO-8859-13 0x00A0
|
||||
ISO8859_13 ISO-8859-13 0x00A0
|
||||
ISO8859-14 ISO-8859-14 0x007E
|
||||
ISO8859_14 ISO-8859-14 0x007E
|
||||
ISO8859-15 ISO-8859-15 0x00A3
|
||||
ISO8859_15 ISO-8859-15 0x00A3
|
||||
JIS ISO-2022-JP 0x007F
|
||||
KOI8_R KOI8-R 0x007F
|
||||
KSC5601 EUC-KR 0x007F
|
||||
KS_C_5601-1987 KS_C_5601-1987,iso-ir-149,KS_C_5601-1989,KSC_5601,csKSC56011987 0x007F
|
||||
MacTEC MacRoman
|
||||
# Windows Japanese
|
||||
MS932 windows-31j
|
||||
# Shift-JIS, Japanese
|
||||
SJIS SHIFT_JIS 0x007F
|
||||
# TIS620, Thai
|
||||
TIS620 TIS-620
|
||||
UTF8 UTF-8 0xFFFF
|
||||
Unicode UNICODE,UTF-16 0xFFFF
|
||||
|
||||
# note that more character set names and their aliases
|
||||
# can be found at http://www.iana.org/assignments/character-sets
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import javax.xml.transform.SourceLocator;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public interface ExtendedContentHandler extends ContentHandler {
|
||||
public static final int NO_BAD_CHARS = 1;
|
||||
|
||||
public static final int HTML_ATTREMPTY = 2;
|
||||
|
||||
public static final int HTML_ATTRURL = 4;
|
||||
|
||||
void addAttribute(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, boolean paramBoolean) throws SAXException;
|
||||
|
||||
void addAttributes(Attributes paramAttributes) throws SAXException;
|
||||
|
||||
void addAttribute(String paramString1, String paramString2);
|
||||
|
||||
void characters(String paramString) throws SAXException;
|
||||
|
||||
void characters(Node paramNode) throws SAXException;
|
||||
|
||||
void endElement(String paramString) throws SAXException;
|
||||
|
||||
void startElement(String paramString1, String paramString2, String paramString3) throws SAXException;
|
||||
|
||||
void startElement(String paramString) throws SAXException;
|
||||
|
||||
void namespaceAfterStartElement(String paramString1, String paramString2) throws SAXException;
|
||||
|
||||
boolean startPrefixMapping(String paramString1, String paramString2, boolean paramBoolean) throws SAXException;
|
||||
|
||||
void entityReference(String paramString) throws SAXException;
|
||||
|
||||
NamespaceMappings getNamespaceMappings();
|
||||
|
||||
String getPrefix(String paramString);
|
||||
|
||||
String getNamespaceURI(String paramString, boolean paramBoolean);
|
||||
|
||||
String getNamespaceURIFromPrefix(String paramString);
|
||||
|
||||
void setSourceLocator(SourceLocator paramSourceLocator);
|
||||
|
||||
void addUniqueAttribute(String paramString1, String paramString2, int paramInt) throws SAXException;
|
||||
|
||||
void addXSLAttribute(String paramString1, String paramString2, String paramString3);
|
||||
|
||||
void addAttribute(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5) throws SAXException;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public interface ExtendedLexicalHandler extends LexicalHandler {
|
||||
void comment(String paramString) throws SAXException;
|
||||
}
|
||||
|
|
@ -0,0 +1,311 @@
|
|||
##
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
##
|
||||
#
|
||||
# $Id: HTMLEntities.properties 468654 2006-10-28 07:09:23Z minchau $
|
||||
#
|
||||
# @version $Revision$ $Date: 2006-10-28 03:09:23 -0400 (Sat, 28 Oct 2006) $
|
||||
# This file must be encoded in UTF-8; see CharInfo.java
|
||||
#
|
||||
# Character entity references for markup-significant
|
||||
#
|
||||
quot=34
|
||||
amp=38
|
||||
lt=60
|
||||
gt=62
|
||||
nbsp=160
|
||||
#
|
||||
# Character entity references for ISO 8859-1 characters
|
||||
#
|
||||
iexcl=161
|
||||
cent=162
|
||||
pound=163
|
||||
curren=164
|
||||
yen=165
|
||||
brvbar=166
|
||||
sect=167
|
||||
uml=168
|
||||
copy=169
|
||||
ordf=170
|
||||
laquo=171
|
||||
not=172
|
||||
shy=173
|
||||
reg=174
|
||||
macr=175
|
||||
deg=176
|
||||
plusmn=177
|
||||
sup2=178
|
||||
sup3=179
|
||||
acute=180
|
||||
micro=181
|
||||
para=182
|
||||
middot=183
|
||||
cedil=184
|
||||
sup1=185
|
||||
ordm=186
|
||||
raquo=187
|
||||
frac14=188
|
||||
frac12=189
|
||||
frac34=190
|
||||
iquest=191
|
||||
Agrave=192
|
||||
Aacute=193
|
||||
Acirc=194
|
||||
Atilde=195
|
||||
Auml=196
|
||||
Aring=197
|
||||
AElig=198
|
||||
Ccedil=199
|
||||
Egrave=200
|
||||
Eacute=201
|
||||
Ecirc=202
|
||||
Euml=203
|
||||
Igrave=204
|
||||
Iacute=205
|
||||
Icirc=206
|
||||
Iuml=207
|
||||
ETH=208
|
||||
Ntilde=209
|
||||
Ograve=210
|
||||
Oacute=211
|
||||
Ocirc=212
|
||||
Otilde=213
|
||||
Ouml=214
|
||||
times=215
|
||||
Oslash=216
|
||||
Ugrave=217
|
||||
Uacute=218
|
||||
Ucirc=219
|
||||
Uuml=220
|
||||
Yacute=221
|
||||
THORN=222
|
||||
szlig=223
|
||||
agrave=224
|
||||
aacute=225
|
||||
acirc=226
|
||||
atilde=227
|
||||
auml=228
|
||||
aring=229
|
||||
aelig=230
|
||||
ccedil=231
|
||||
egrave=232
|
||||
eacute=233
|
||||
ecirc=234
|
||||
euml=235
|
||||
igrave=236
|
||||
iacute=237
|
||||
icirc=238
|
||||
iuml=239
|
||||
eth=240
|
||||
ntilde=241
|
||||
ograve=242
|
||||
oacute=243
|
||||
ocirc=244
|
||||
otilde=245
|
||||
ouml=246
|
||||
divide=247
|
||||
oslash=248
|
||||
ugrave=249
|
||||
uacute=250
|
||||
ucirc=251
|
||||
uuml=252
|
||||
yacute=253
|
||||
thorn=254
|
||||
yuml=255
|
||||
#
|
||||
# Character entity references for symbols, mathematical symbols, and Greek letters
|
||||
#
|
||||
# Latin Extended -- Netscape can't handle
|
||||
# fnof 402
|
||||
#
|
||||
# Greek - Netscape can't handle these
|
||||
# Alpha 913
|
||||
# Beta 914
|
||||
# Gamma 915
|
||||
# Delta 916
|
||||
# Epsilon 917
|
||||
# Zeta 918
|
||||
# Eta 919
|
||||
# Theta 920
|
||||
# Iota 921
|
||||
# Kappa 922
|
||||
# Lambda 923
|
||||
# Mu 924
|
||||
# Nu 925
|
||||
# Xi 926
|
||||
# Omicron 927
|
||||
# Pi 928
|
||||
# Rho 929
|
||||
# Sigma 931
|
||||
# Tau 932
|
||||
# Upsilon 933
|
||||
# Phi 934
|
||||
# Chi 935
|
||||
# Psi 936
|
||||
# Omega 937
|
||||
# alpha 945
|
||||
# beta 946
|
||||
# gamma 947
|
||||
# delta 948
|
||||
# epsilon 949
|
||||
# zeta 950
|
||||
# eta 951
|
||||
# theta 952
|
||||
# iota 953
|
||||
# kappa 954
|
||||
# lambda 955
|
||||
# mu 956
|
||||
# nu 957
|
||||
# xi 958
|
||||
# omicron 959
|
||||
# pi 960
|
||||
# rho 961
|
||||
# sigmaf 962
|
||||
# sigma 963
|
||||
# tau 964
|
||||
# upsilon 965
|
||||
# phi 966
|
||||
# chi 967
|
||||
# psi 968
|
||||
# omega 969
|
||||
# thetasym 977
|
||||
# upsih 978
|
||||
# piv 982
|
||||
#
|
||||
# General Punctuation
|
||||
bull=8226
|
||||
hellip=8230
|
||||
prime=8242
|
||||
Prime=8243
|
||||
oline=8254
|
||||
frasl=8260
|
||||
#
|
||||
# Letterlike Symbols
|
||||
weierp=8472
|
||||
image=8465
|
||||
real=8476
|
||||
trade=8482
|
||||
alefsym=8501
|
||||
#
|
||||
# Arrows
|
||||
larr=8592
|
||||
uarr=8593
|
||||
rarr=8594
|
||||
darr=8595
|
||||
harr=8596
|
||||
crarr=8629
|
||||
lArr=8656
|
||||
uArr=8657
|
||||
rArr=8658
|
||||
dArr=8659
|
||||
hArr=8660
|
||||
#
|
||||
# Mathematical Operators
|
||||
forall=8704
|
||||
part=8706
|
||||
exist=8707
|
||||
empty=8709
|
||||
nabla=8711
|
||||
isin=8712
|
||||
notin=8713
|
||||
ni=8715
|
||||
prod=8719
|
||||
sum=8721
|
||||
minus=8722
|
||||
lowast=8727
|
||||
radic=8730
|
||||
prop=8733
|
||||
infin=8734
|
||||
ang=8736
|
||||
and=8743
|
||||
or=8744
|
||||
cap=8745
|
||||
cup=8746
|
||||
int=8747
|
||||
there4=8756
|
||||
sim=8764
|
||||
cong=8773
|
||||
asymp=8776
|
||||
ne=8800
|
||||
equiv=8801
|
||||
le=8804
|
||||
ge=8805
|
||||
sub=8834
|
||||
sup=8835
|
||||
nsub=8836
|
||||
sube=8838
|
||||
supe=8839
|
||||
oplus=8853
|
||||
otimes=8855
|
||||
perp=8869
|
||||
sdot=8901
|
||||
#
|
||||
# Miscellaneous Technical
|
||||
lceil=8968
|
||||
rceil=8969
|
||||
lfloor=8970
|
||||
rfloor=8971
|
||||
lang=9001
|
||||
rang=9002
|
||||
#
|
||||
# Geometric Shapes
|
||||
loz=9674
|
||||
#
|
||||
# Miscellaneous Symbols
|
||||
spades=9824
|
||||
clubs=9827
|
||||
hearts=9829
|
||||
diams=9830
|
||||
#
|
||||
# Character entity references for internationalization characters
|
||||
#
|
||||
# Latin Extended-A
|
||||
# Netscape can't handle!
|
||||
# OElig 338
|
||||
# oelig 339
|
||||
|
||||
#-- NN 4.7 does not seem to support these, so they might ought to be commented.
|
||||
# Scaron 352
|
||||
# scaron 353
|
||||
# Yuml 376
|
||||
#
|
||||
# Spacing Modifier Letters -- Netscape can't handle
|
||||
# circ 710
|
||||
# tilde 732
|
||||
#
|
||||
# General Punctuation
|
||||
ensp=8194
|
||||
emsp=8195
|
||||
thinsp=8201
|
||||
zwnj=8204
|
||||
zwj=8205
|
||||
lrm=8206
|
||||
rlm=8207
|
||||
ndash=8211
|
||||
mdash=8212
|
||||
lsquo=8216
|
||||
rsquo=8217
|
||||
sbquo=8218
|
||||
ldquo=8220
|
||||
rdquo=8221
|
||||
bdquo=8222
|
||||
dagger=8224
|
||||
Dagger=8225
|
||||
permil=8240
|
||||
lsaquo=8249
|
||||
rsaquo=8250
|
||||
euro=8364
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
public final class Method {
|
||||
public static final String XML = "xml";
|
||||
|
||||
public static final String HTML = "html";
|
||||
|
||||
public static final String XHTML = "xhtml";
|
||||
|
||||
public static final String TEXT = "text";
|
||||
|
||||
public static final String UNKNOWN = "";
|
||||
}
|
||||
|
|
@ -0,0 +1,270 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class NamespaceMappings {
|
||||
private int count = 0;
|
||||
|
||||
private Hashtable m_namespaces = new Hashtable();
|
||||
|
||||
private Stack m_nodeStack = new Stack(this);
|
||||
|
||||
private static final String EMPTYSTRING = "";
|
||||
|
||||
private static final String XML_PREFIX = "xml";
|
||||
|
||||
public NamespaceMappings() {
|
||||
initNamespaces();
|
||||
}
|
||||
|
||||
private void initNamespaces() {
|
||||
MappingRecord nn = new MappingRecord(this, "", "", -1);
|
||||
Stack stack = createPrefixStack("");
|
||||
stack.push(nn);
|
||||
nn = new MappingRecord(this, "xml", "http://www.w3.org/XML/1998/namespace", -1);
|
||||
stack = createPrefixStack("xml");
|
||||
stack.push(nn);
|
||||
}
|
||||
|
||||
public String lookupNamespace(String prefix) {
|
||||
String uri = null;
|
||||
Stack stack = getPrefixStack(prefix);
|
||||
if (stack != null && !stack.isEmpty())
|
||||
uri = ((MappingRecord)stack.peek()).m_uri;
|
||||
if (uri == null)
|
||||
uri = "";
|
||||
return uri;
|
||||
}
|
||||
|
||||
MappingRecord getMappingFromPrefix(String prefix) {
|
||||
Stack stack = (Stack)this.m_namespaces.get(prefix);
|
||||
return (stack != null && !stack.isEmpty()) ? (MappingRecord)stack.peek() : null;
|
||||
}
|
||||
|
||||
public String lookupPrefix(String uri) {
|
||||
String foundPrefix = null;
|
||||
Enumeration prefixes = this.m_namespaces.keys();
|
||||
while (prefixes.hasMoreElements()) {
|
||||
String prefix = (String)prefixes.nextElement();
|
||||
String uri2 = lookupNamespace(prefix);
|
||||
if (uri2 != null && uri2.equals(uri)) {
|
||||
foundPrefix = prefix;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return foundPrefix;
|
||||
}
|
||||
|
||||
MappingRecord getMappingFromURI(String uri) {
|
||||
MappingRecord foundMap = null;
|
||||
Enumeration prefixes = this.m_namespaces.keys();
|
||||
while (prefixes.hasMoreElements()) {
|
||||
String prefix = (String)prefixes.nextElement();
|
||||
MappingRecord map2 = getMappingFromPrefix(prefix);
|
||||
if (map2 != null && map2.m_uri.equals(uri)) {
|
||||
foundMap = map2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return foundMap;
|
||||
}
|
||||
|
||||
boolean popNamespace(String prefix) {
|
||||
if (prefix.startsWith("xml"))
|
||||
return false;
|
||||
Stack stack;
|
||||
if ((stack = getPrefixStack(prefix)) != null) {
|
||||
stack.pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean pushNamespace(String prefix, String uri, int elemDepth) {
|
||||
if (prefix.startsWith("xml"))
|
||||
return false;
|
||||
Stack stack;
|
||||
if ((stack = (Stack)this.m_namespaces.get(prefix)) == null)
|
||||
this.m_namespaces.put(prefix, stack = new Stack(this));
|
||||
if (!stack.empty()) {
|
||||
MappingRecord mr = (MappingRecord)stack.peek();
|
||||
if (uri.equals(mr.m_uri) || elemDepth == mr.m_declarationDepth)
|
||||
return false;
|
||||
}
|
||||
MappingRecord map = new MappingRecord(this, prefix, uri, elemDepth);
|
||||
stack.push(map);
|
||||
this.m_nodeStack.push(map);
|
||||
return true;
|
||||
}
|
||||
|
||||
void popNamespaces(int elemDepth, ContentHandler saxHandler) {
|
||||
while (true) {
|
||||
if (this.m_nodeStack.isEmpty())
|
||||
return;
|
||||
MappingRecord map = (MappingRecord)this.m_nodeStack.peek();
|
||||
int depth = map.m_declarationDepth;
|
||||
if (elemDepth < 1 || map.m_declarationDepth < elemDepth)
|
||||
break;
|
||||
MappingRecord nm1 = (MappingRecord)this.m_nodeStack.pop();
|
||||
String prefix = map.m_prefix;
|
||||
Stack prefixStack = getPrefixStack(prefix);
|
||||
MappingRecord nm2 = (MappingRecord)prefixStack.peek();
|
||||
if (nm1 == nm2) {
|
||||
prefixStack.pop();
|
||||
if (saxHandler != null)
|
||||
try {
|
||||
saxHandler.endPrefixMapping(prefix);
|
||||
} catch (SAXException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String generateNextPrefix() {
|
||||
return "ns" + this.count++;
|
||||
}
|
||||
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
NamespaceMappings clone = new NamespaceMappings();
|
||||
clone.m_nodeStack = (Stack)this.m_nodeStack.clone();
|
||||
clone.count = this.count;
|
||||
clone.m_namespaces = (Hashtable)this.m_namespaces.clone();
|
||||
clone.count = this.count;
|
||||
return clone;
|
||||
}
|
||||
|
||||
final void reset() {
|
||||
this.count = 0;
|
||||
this.m_namespaces.clear();
|
||||
this.m_nodeStack.clear();
|
||||
initNamespaces();
|
||||
}
|
||||
|
||||
class MappingRecord {
|
||||
final String m_prefix;
|
||||
|
||||
final String m_uri;
|
||||
|
||||
final int m_declarationDepth;
|
||||
|
||||
private final NamespaceMappings this$0;
|
||||
|
||||
MappingRecord(NamespaceMappings this$0, String prefix, String uri, int depth) {
|
||||
this.this$0 = this$0;
|
||||
this.m_prefix = prefix;
|
||||
this.m_uri = (uri == null) ? "" : uri;
|
||||
this.m_declarationDepth = depth;
|
||||
}
|
||||
}
|
||||
|
||||
private class Stack {
|
||||
private int top;
|
||||
|
||||
private int max;
|
||||
|
||||
Object[] m_stack;
|
||||
|
||||
private final NamespaceMappings this$0;
|
||||
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
Stack clone = new Stack(this.this$0);
|
||||
clone.max = this.max;
|
||||
clone.top = this.top;
|
||||
clone.m_stack = new Object[clone.max];
|
||||
for (int i = 0; i <= this.top; i++)
|
||||
clone.m_stack[i] = this.m_stack[i];
|
||||
return clone;
|
||||
}
|
||||
|
||||
public Stack(NamespaceMappings this$0) {
|
||||
this.this$0 = this$0;
|
||||
this.top = -1;
|
||||
this.max = 20;
|
||||
this.m_stack = new Object[this.max];
|
||||
}
|
||||
|
||||
public Object push(Object o) {
|
||||
this.top++;
|
||||
if (this.max <= this.top) {
|
||||
int newMax = 2 * this.max + 1;
|
||||
Object[] newArray = new Object[newMax];
|
||||
System.arraycopy(this.m_stack, 0, newArray, 0, this.max);
|
||||
this.max = newMax;
|
||||
this.m_stack = newArray;
|
||||
}
|
||||
this.m_stack[this.top] = o;
|
||||
return o;
|
||||
}
|
||||
|
||||
public Object pop() {
|
||||
Object object;
|
||||
if (0 <= this.top) {
|
||||
object = this.m_stack[this.top];
|
||||
this.top--;
|
||||
} else {
|
||||
object = null;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public Object peek() {
|
||||
Object object;
|
||||
if (0 <= this.top) {
|
||||
object = this.m_stack[this.top];
|
||||
} else {
|
||||
object = null;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public Object peek(int idx) {
|
||||
return this.m_stack[idx];
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return (this.top < 0);
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return (this.top < 0);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for (int i = 0; i <= this.top; i++)
|
||||
this.m_stack[i] = null;
|
||||
this.top = -1;
|
||||
}
|
||||
|
||||
public Object getElement(int index) {
|
||||
return this.m_stack[index];
|
||||
}
|
||||
}
|
||||
|
||||
private Stack getPrefixStack(String prefix) {
|
||||
Stack fs = (Stack)this.m_namespaces.get(prefix);
|
||||
return fs;
|
||||
}
|
||||
|
||||
private Stack createPrefixStack(String prefix) {
|
||||
Stack fs = new Stack(this);
|
||||
this.m_namespaces.put(prefix, fs);
|
||||
return fs;
|
||||
}
|
||||
|
||||
public String[] lookupAllPrefixes(String uri) {
|
||||
ArrayList foundPrefixes = new ArrayList();
|
||||
Enumeration prefixes = this.m_namespaces.keys();
|
||||
while (prefixes.hasMoreElements()) {
|
||||
String prefix = (String)prefixes.nextElement();
|
||||
String uri2 = lookupNamespace(prefix);
|
||||
if (uri2 != null && uri2.equals(uri))
|
||||
foundPrefixes.add(prefix);
|
||||
}
|
||||
String[] prefixArray = new String[foundPrefixes.size()];
|
||||
foundPrefixes.toArray(prefixArray);
|
||||
return prefixArray;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Properties;
|
||||
|
||||
class ObjectFactory {
|
||||
private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties";
|
||||
|
||||
private static final String SERVICES_PATH = "META-INF/services/";
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static Properties fXalanProperties = null;
|
||||
|
||||
private static long fLastModified = -1L;
|
||||
|
||||
static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError {
|
||||
return createObject(factoryId, null, fallbackClassName);
|
||||
}
|
||||
|
||||
static Object createObject(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError {
|
||||
Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName);
|
||||
if (factoryClass == null)
|
||||
throw new ConfigurationError("Provider for " + factoryId + " cannot be found", null);
|
||||
try {
|
||||
Object instance = factoryClass.newInstance();
|
||||
debugPrintln("created new instance of factory " + factoryId);
|
||||
return instance;
|
||||
} catch (Exception x) {
|
||||
throw new ConfigurationError("Provider for factory " + factoryId + " could not be instantiated: " + x, x);
|
||||
}
|
||||
}
|
||||
|
||||
static Class lookUpFactoryClass(String factoryId) throws ConfigurationError {
|
||||
return lookUpFactoryClass(factoryId, null, null);
|
||||
}
|
||||
|
||||
static Class lookUpFactoryClass(String factoryId, String propertiesFilename, String fallbackClassName) throws ConfigurationError {
|
||||
String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName);
|
||||
ClassLoader cl = findClassLoader();
|
||||
if (factoryClassName == null)
|
||||
factoryClassName = fallbackClassName;
|
||||
try {
|
||||
Class providerClass = findProviderClass(factoryClassName, cl, true);
|
||||
debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl);
|
||||
return providerClass;
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new ConfigurationError("Provider " + factoryClassName + " not found", x);
|
||||
} catch (Exception x) {
|
||||
throw new ConfigurationError("Provider " + factoryClassName + " could not be instantiated: " + x, x);
|
||||
}
|
||||
}
|
||||
|
||||
static String lookUpFactoryClassName(String factoryId, String propertiesFilename, String fallbackClassName) {
|
||||
SecuritySupport ss = SecuritySupport.getInstance();
|
||||
try {
|
||||
String systemProp = ss.getSystemProperty(factoryId);
|
||||
if (systemProp != null) {
|
||||
debugPrintln("found system property, value=" + systemProp);
|
||||
return systemProp;
|
||||
}
|
||||
} catch (SecurityException se) {}
|
||||
String factoryClassName = null;
|
||||
if (propertiesFilename == null) {
|
||||
File propertiesFile = null;
|
||||
boolean propertiesFileExists = false;
|
||||
try {
|
||||
String javah = ss.getSystemProperty("java.home");
|
||||
propertiesFilename = javah + File.separator + "lib" + File.separator + "xalan.properties";
|
||||
propertiesFile = new File(propertiesFilename);
|
||||
propertiesFileExists = ss.getFileExists(propertiesFile);
|
||||
} catch (SecurityException e) {
|
||||
fLastModified = -1L;
|
||||
fXalanProperties = null;
|
||||
}
|
||||
synchronized (ObjectFactory.class) {
|
||||
boolean loadProperties = false;
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
if (fLastModified >= 0L) {
|
||||
if (propertiesFileExists && fLastModified < (fLastModified = ss.getLastModified(propertiesFile))) {
|
||||
loadProperties = true;
|
||||
} else if (!propertiesFileExists) {
|
||||
fLastModified = -1L;
|
||||
fXalanProperties = null;
|
||||
}
|
||||
} else if (propertiesFileExists) {
|
||||
loadProperties = true;
|
||||
fLastModified = ss.getLastModified(propertiesFile);
|
||||
}
|
||||
if (loadProperties) {
|
||||
fXalanProperties = new Properties();
|
||||
fis = ss.getFileInputStream(propertiesFile);
|
||||
fXalanProperties.load(fis);
|
||||
}
|
||||
} catch (Exception x) {
|
||||
fXalanProperties = null;
|
||||
fLastModified = -1L;
|
||||
} finally {
|
||||
if (fis != null)
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException exc) {}
|
||||
}
|
||||
}
|
||||
if (fXalanProperties != null)
|
||||
factoryClassName = fXalanProperties.getProperty(factoryId);
|
||||
} else {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
fis = ss.getFileInputStream(new File(propertiesFilename));
|
||||
Properties props = new Properties();
|
||||
props.load(fis);
|
||||
factoryClassName = props.getProperty(factoryId);
|
||||
} catch (Exception x) {
|
||||
|
||||
} finally {
|
||||
if (fis != null)
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException exc) {}
|
||||
}
|
||||
}
|
||||
if (factoryClassName != null) {
|
||||
debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName);
|
||||
return factoryClassName;
|
||||
}
|
||||
return findJarServiceProviderName(factoryId);
|
||||
}
|
||||
|
||||
private static void debugPrintln(String msg) {}
|
||||
|
||||
static ClassLoader findClassLoader() throws ConfigurationError {
|
||||
SecuritySupport ss = SecuritySupport.getInstance();
|
||||
ClassLoader context = ss.getContextClassLoader();
|
||||
ClassLoader system = ss.getSystemClassLoader();
|
||||
ClassLoader chain = system;
|
||||
while (true) {
|
||||
if (context == chain) {
|
||||
ClassLoader current = ObjectFactory.class.getClassLoader();
|
||||
chain = system;
|
||||
while (true) {
|
||||
if (current == chain)
|
||||
return system;
|
||||
if (chain == null)
|
||||
break;
|
||||
chain = ss.getParentClassLoader(chain);
|
||||
}
|
||||
return current;
|
||||
}
|
||||
if (chain == null)
|
||||
break;
|
||||
chain = ss.getParentClassLoader(chain);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError {
|
||||
try {
|
||||
Class providerClass = findProviderClass(className, cl, doFallback);
|
||||
Object instance = providerClass.newInstance();
|
||||
debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl);
|
||||
return instance;
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new ConfigurationError("Provider " + className + " not found", x);
|
||||
} catch (Exception x) {
|
||||
throw new ConfigurationError("Provider " + className + " could not be instantiated: " + x, x);
|
||||
}
|
||||
}
|
||||
|
||||
static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError {
|
||||
Class clazz;
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
try {
|
||||
if (security != null) {
|
||||
int lastDot = className.lastIndexOf(".");
|
||||
String packageName = className;
|
||||
if (lastDot != -1)
|
||||
packageName = className.substring(0, lastDot);
|
||||
security.checkPackageAccess(packageName);
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
throw e;
|
||||
}
|
||||
if (cl == null) {
|
||||
clazz = Class.forName(className);
|
||||
} else {
|
||||
try {
|
||||
clazz = cl.loadClass(className);
|
||||
} catch (ClassNotFoundException x) {
|
||||
if (doFallback) {
|
||||
ClassLoader current = ObjectFactory.class.getClassLoader();
|
||||
if (current == null) {
|
||||
clazz = Class.forName(className);
|
||||
} else if (cl != current) {
|
||||
cl = current;
|
||||
clazz = cl.loadClass(className);
|
||||
} else {
|
||||
throw x;
|
||||
}
|
||||
} else {
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
private static String findJarServiceProviderName(String factoryId) {
|
||||
BufferedReader bufferedReader;
|
||||
SecuritySupport ss = SecuritySupport.getInstance();
|
||||
String serviceId = "META-INF/services/" + factoryId;
|
||||
InputStream is = null;
|
||||
ClassLoader cl = findClassLoader();
|
||||
is = ss.getResourceAsStream(cl, serviceId);
|
||||
if (is == null) {
|
||||
ClassLoader current = ObjectFactory.class.getClassLoader();
|
||||
if (cl != current) {
|
||||
cl = current;
|
||||
is = ss.getResourceAsStream(cl, serviceId);
|
||||
}
|
||||
}
|
||||
if (is == null)
|
||||
return null;
|
||||
debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl);
|
||||
try {
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(is));
|
||||
}
|
||||
String factoryClassName = null;
|
||||
try {
|
||||
factoryClassName = bufferedReader.readLine();
|
||||
} catch (IOException x) {
|
||||
return null;
|
||||
} finally {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
} catch (IOException exc) {}
|
||||
}
|
||||
if (factoryClassName != null && !"".equals(factoryClassName)) {
|
||||
debugPrintln("found in resource, value=" + factoryClassName);
|
||||
return factoryClassName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static class ConfigurationError extends Error {
|
||||
static final long serialVersionUID = 8859254254255146542L;
|
||||
|
||||
private Exception exception;
|
||||
|
||||
ConfigurationError(String msg, Exception x) {
|
||||
super(msg);
|
||||
this.exception = x;
|
||||
}
|
||||
|
||||
Exception getException() {
|
||||
return this.exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.apache.xml.serializer.utils.WrappedRuntimeException;
|
||||
|
||||
public final class OutputPropertiesFactory {
|
||||
private static final String S_BUILTIN_EXTENSIONS_URL = "http://xml.apache.org/xalan";
|
||||
|
||||
private static final String S_BUILTIN_OLD_EXTENSIONS_URL = "http://xml.apache.org/xslt";
|
||||
|
||||
public static final String S_BUILTIN_EXTENSIONS_UNIVERSAL = "{http://xml.apache.org/xalan}";
|
||||
|
||||
public static final String S_KEY_INDENT_AMOUNT = "{http://xml.apache.org/xalan}indent-amount";
|
||||
|
||||
public static final String S_KEY_LINE_SEPARATOR = "{http://xml.apache.org/xalan}line-separator";
|
||||
|
||||
public static final String S_KEY_CONTENT_HANDLER = "{http://xml.apache.org/xalan}content-handler";
|
||||
|
||||
public static final String S_KEY_ENTITIES = "{http://xml.apache.org/xalan}entities";
|
||||
|
||||
public static final String S_USE_URL_ESCAPING = "{http://xml.apache.org/xalan}use-url-escaping";
|
||||
|
||||
public static final String S_OMIT_META_TAG = "{http://xml.apache.org/xalan}omit-meta-tag";
|
||||
|
||||
public static final String S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL = "{http://xml.apache.org/xslt}";
|
||||
|
||||
public static final int S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN = "{http://xml.apache.org/xslt}".length();
|
||||
|
||||
private static final String S_XSLT_PREFIX = "xslt.output.";
|
||||
|
||||
private static final int S_XSLT_PREFIX_LEN = "xslt.output.".length();
|
||||
|
||||
private static final String S_XALAN_PREFIX = "org.apache.xslt.";
|
||||
|
||||
private static final int S_XALAN_PREFIX_LEN = "org.apache.xslt.".length();
|
||||
|
||||
private static Integer m_synch_object = new Integer(1);
|
||||
|
||||
private static final String PROP_DIR = SerializerBase.PKG_PATH + '/';
|
||||
|
||||
private static final String PROP_FILE_XML = "output_xml.properties";
|
||||
|
||||
private static final String PROP_FILE_TEXT = "output_text.properties";
|
||||
|
||||
private static final String PROP_FILE_HTML = "output_html.properties";
|
||||
|
||||
private static final String PROP_FILE_UNKNOWN = "output_unknown.properties";
|
||||
|
||||
private static Properties m_xml_properties = null;
|
||||
|
||||
private static Properties m_html_properties = null;
|
||||
|
||||
private static Properties m_text_properties = null;
|
||||
|
||||
private static Properties m_unknown_properties = null;
|
||||
|
||||
private static final Class ACCESS_CONTROLLER_CLASS = findAccessControllerClass();
|
||||
|
||||
private static Class findAccessControllerClass() {
|
||||
try {
|
||||
return Class.forName("java.security.AccessController");
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static final Properties getDefaultMethodProperties(String method) {
|
||||
String fileName = null;
|
||||
Properties defaultProperties = null;
|
||||
try {
|
||||
synchronized (m_synch_object) {
|
||||
if (null == m_xml_properties) {
|
||||
fileName = "output_xml.properties";
|
||||
m_xml_properties = loadPropertiesFile(fileName, null);
|
||||
}
|
||||
}
|
||||
if (method.equals("xml")) {
|
||||
defaultProperties = m_xml_properties;
|
||||
} else if (method.equals("html")) {
|
||||
if (null == m_html_properties) {
|
||||
fileName = "output_html.properties";
|
||||
m_html_properties = loadPropertiesFile(fileName, m_xml_properties);
|
||||
}
|
||||
defaultProperties = m_html_properties;
|
||||
} else if (method.equals("text")) {
|
||||
if (null == m_text_properties) {
|
||||
fileName = "output_text.properties";
|
||||
m_text_properties = loadPropertiesFile(fileName, m_xml_properties);
|
||||
if (null == m_text_properties.getProperty("encoding")) {
|
||||
String mimeEncoding = Encodings.getMimeEncoding(null);
|
||||
m_text_properties.put("encoding", mimeEncoding);
|
||||
}
|
||||
}
|
||||
defaultProperties = m_text_properties;
|
||||
} else if (method.equals("")) {
|
||||
if (null == m_unknown_properties) {
|
||||
fileName = "output_unknown.properties";
|
||||
m_unknown_properties = loadPropertiesFile(fileName, m_xml_properties);
|
||||
}
|
||||
defaultProperties = m_unknown_properties;
|
||||
} else {
|
||||
defaultProperties = m_xml_properties;
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
throw new WrappedRuntimeException(Utils.messages.createMessage("ER_COULD_NOT_LOAD_METHOD_PROPERTY", new Object[] { fileName, method }), ioe);
|
||||
}
|
||||
return new Properties(defaultProperties);
|
||||
}
|
||||
|
||||
private static Properties loadPropertiesFile(String resourceName, Properties defaults) throws IOException {
|
||||
Properties props = new Properties(defaults);
|
||||
InputStream is = null;
|
||||
BufferedInputStream bis = null;
|
||||
try {
|
||||
if (ACCESS_CONTROLLER_CLASS != null) {
|
||||
is = (InputStream)AccessController.doPrivileged(new PrivilegedAction(resourceName) {
|
||||
private final String val$resourceName;
|
||||
|
||||
{
|
||||
this.val$resourceName = val$resourceName;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
return OutputPropertiesFactory.class.getResourceAsStream(this.val$resourceName);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
is = OutputPropertiesFactory.class.getResourceAsStream(resourceName);
|
||||
}
|
||||
bis = new BufferedInputStream(is);
|
||||
props.load(bis);
|
||||
} catch (IOException ioe) {
|
||||
if (defaults == null)
|
||||
throw ioe;
|
||||
throw new WrappedRuntimeException(Utils.messages.createMessage("ER_COULD_NOT_LOAD_RESOURCE", new Object[] { resourceName }), ioe);
|
||||
} catch (SecurityException se) {
|
||||
if (defaults == null)
|
||||
throw se;
|
||||
throw new WrappedRuntimeException(Utils.messages.createMessage("ER_COULD_NOT_LOAD_RESOURCE", new Object[] { resourceName }), se);
|
||||
} finally {
|
||||
if (bis != null)
|
||||
bis.close();
|
||||
if (is != null)
|
||||
is.close();
|
||||
}
|
||||
Enumeration keys = ((Properties)props.clone()).keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = (String)keys.nextElement();
|
||||
String value = null;
|
||||
try {
|
||||
value = System.getProperty(key);
|
||||
} catch (SecurityException se) {}
|
||||
if (value == null)
|
||||
value = (String)props.get(key);
|
||||
String newKey = fixupPropertyString(key, true);
|
||||
String newValue = null;
|
||||
try {
|
||||
newValue = System.getProperty(newKey);
|
||||
} catch (SecurityException se) {}
|
||||
if (newValue == null) {
|
||||
newValue = fixupPropertyString(value, false);
|
||||
} else {
|
||||
newValue = fixupPropertyString(newValue, false);
|
||||
}
|
||||
if (key != newKey || value != newValue) {
|
||||
props.remove(key);
|
||||
props.put(newKey, newValue);
|
||||
}
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
private static String fixupPropertyString(String s, boolean doClipping) {
|
||||
if (doClipping && s.startsWith("xslt.output."))
|
||||
s = s.substring(S_XSLT_PREFIX_LEN);
|
||||
if (s.startsWith("org.apache.xslt."))
|
||||
s = "{http://xml.apache.org/xalan}" + s.substring(S_XALAN_PREFIX_LEN);
|
||||
int index;
|
||||
if ((index = s.indexOf("\\u003a")) > 0) {
|
||||
String temp = s.substring(index + 6);
|
||||
s = s.substring(0, index) + ":" + temp;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public final class OutputPropertyUtils {
|
||||
public static boolean getBooleanProperty(String key, Properties props) {
|
||||
String s = props.getProperty(key);
|
||||
if (null == s || !s.equals("yes"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getIntProperty(String key, Properties props) {
|
||||
String s = props.getProperty(key);
|
||||
if (null == s)
|
||||
return 0;
|
||||
return Integer.parseInt(s);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
|
||||
class SecuritySupport {
|
||||
private static final Object securitySupport;
|
||||
|
||||
static {
|
||||
SecuritySupport ss = null;
|
||||
try {
|
||||
Class c = Class.forName("java.security.AccessController");
|
||||
ss = new SecuritySupport12();
|
||||
} catch (Exception ex) {
|
||||
|
||||
} finally {
|
||||
if (ss == null)
|
||||
ss = new SecuritySupport();
|
||||
securitySupport = ss;
|
||||
}
|
||||
}
|
||||
|
||||
static SecuritySupport getInstance() {
|
||||
return (SecuritySupport)securitySupport;
|
||||
}
|
||||
|
||||
ClassLoader getContextClassLoader() {
|
||||
return null;
|
||||
}
|
||||
|
||||
ClassLoader getSystemClassLoader() {
|
||||
return null;
|
||||
}
|
||||
|
||||
ClassLoader getParentClassLoader(ClassLoader cl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String getSystemProperty(String propName) {
|
||||
return System.getProperty(propName);
|
||||
}
|
||||
|
||||
FileInputStream getFileInputStream(File file) throws FileNotFoundException {
|
||||
return new FileInputStream(file);
|
||||
}
|
||||
|
||||
InputStream getResourceAsStream(ClassLoader cl, String name) {
|
||||
InputStream inputStream;
|
||||
if (cl == null) {
|
||||
inputStream = ClassLoader.getSystemResourceAsStream(name);
|
||||
} else {
|
||||
inputStream = cl.getResourceAsStream(name);
|
||||
}
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
boolean getFileExists(File f) {
|
||||
return f.exists();
|
||||
}
|
||||
|
||||
long getLastModified(File f) {
|
||||
return f.lastModified();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
||||
class SecuritySupport12 extends SecuritySupport {
|
||||
ClassLoader getContextClassLoader() {
|
||||
return (ClassLoader)AccessController.doPrivileged(new PrivilegedAction(this) {
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
ClassLoader cl = null;
|
||||
try {
|
||||
cl = Thread.currentThread().getContextClassLoader();
|
||||
} catch (SecurityException ex) {}
|
||||
return cl;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ClassLoader getSystemClassLoader() {
|
||||
return (ClassLoader)AccessController.doPrivileged(new PrivilegedAction(this) {
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
ClassLoader cl = null;
|
||||
try {
|
||||
cl = ClassLoader.getSystemClassLoader();
|
||||
} catch (SecurityException ex) {}
|
||||
return cl;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ClassLoader getParentClassLoader(ClassLoader cl) {
|
||||
return (ClassLoader)AccessController.doPrivileged(new PrivilegedAction(this, cl) {
|
||||
private final ClassLoader val$cl;
|
||||
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
this.val$cl = val$cl;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
ClassLoader parent = null;
|
||||
try {
|
||||
parent = this.val$cl.getParent();
|
||||
} catch (SecurityException ex) {}
|
||||
return (parent == this.val$cl) ? null : parent;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String getSystemProperty(String propName) {
|
||||
return (String)AccessController.doPrivileged(new PrivilegedAction(this, propName) {
|
||||
private final String val$propName;
|
||||
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
this.val$propName = val$propName;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
return System.getProperty(this.val$propName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
FileInputStream getFileInputStream(File file) throws FileNotFoundException {
|
||||
try {
|
||||
return (FileInputStream)AccessController.doPrivileged(new PrivilegedExceptionAction(this, file) {
|
||||
private final File val$file;
|
||||
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
this.val$file = val$file;
|
||||
}
|
||||
|
||||
public Object run() throws FileNotFoundException {
|
||||
return new FileInputStream(this.val$file);
|
||||
}
|
||||
});
|
||||
} catch (PrivilegedActionException e) {
|
||||
throw (FileNotFoundException)e.getException();
|
||||
}
|
||||
}
|
||||
|
||||
InputStream getResourceAsStream(ClassLoader cl, String name) {
|
||||
return (InputStream)AccessController.doPrivileged(new PrivilegedAction(this, cl, name) {
|
||||
private final ClassLoader val$cl;
|
||||
|
||||
private final String val$name;
|
||||
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
this.val$cl = val$cl;
|
||||
this.val$name = val$name;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
InputStream inputStream;
|
||||
if (this.val$cl == null) {
|
||||
inputStream = ClassLoader.getSystemResourceAsStream(this.val$name);
|
||||
} else {
|
||||
inputStream = this.val$cl.getResourceAsStream(this.val$name);
|
||||
}
|
||||
return inputStream;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean getFileExists(File f) {
|
||||
return ((Boolean)AccessController.doPrivileged(new PrivilegedAction(this, f) {
|
||||
private final File val$f;
|
||||
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
this.val$f = val$f;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
return new Boolean(this.val$f.exists());
|
||||
}
|
||||
})).booleanValue();
|
||||
}
|
||||
|
||||
long getLastModified(File f) {
|
||||
return ((Long)AccessController.doPrivileged(new PrivilegedAction(this, f) {
|
||||
private final File val$f;
|
||||
|
||||
private final SecuritySupport12 this$0;
|
||||
|
||||
{
|
||||
this.this$0 = this$0;
|
||||
this.val$f = val$f;
|
||||
}
|
||||
|
||||
public Object run() {
|
||||
return new Long(this.val$f.lastModified());
|
||||
}
|
||||
})).longValue();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.xml.transform.Transformer;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.DTDHandler;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.DeclHandler;
|
||||
|
||||
public interface SerializationHandler extends ExtendedContentHandler, ExtendedLexicalHandler, XSLOutputAttributes, DeclHandler, DTDHandler, ErrorHandler, DOMSerializer, Serializer {
|
||||
void setContentHandler(ContentHandler paramContentHandler);
|
||||
|
||||
void close();
|
||||
|
||||
void serialize(Node paramNode) throws IOException;
|
||||
|
||||
boolean setEscaping(boolean paramBoolean) throws SAXException;
|
||||
|
||||
void setIndentAmount(int paramInt);
|
||||
|
||||
void setTransformer(Transformer paramTransformer);
|
||||
|
||||
Transformer getTransformer();
|
||||
|
||||
void setNamespaceMappings(NamespaceMappings paramNamespaceMappings);
|
||||
|
||||
void flushPending() throws SAXException;
|
||||
|
||||
void setDTDEntityExpansion(boolean paramBoolean);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.Properties;
|
||||
import org.xml.sax.ContentHandler;
|
||||
|
||||
public interface Serializer {
|
||||
void setOutputStream(OutputStream paramOutputStream);
|
||||
|
||||
OutputStream getOutputStream();
|
||||
|
||||
void setWriter(Writer paramWriter);
|
||||
|
||||
Writer getWriter();
|
||||
|
||||
void setOutputFormat(Properties paramProperties);
|
||||
|
||||
Properties getOutputFormat();
|
||||
|
||||
ContentHandler asContentHandler() throws IOException;
|
||||
|
||||
DOMSerializer asDOMSerializer() throws IOException;
|
||||
|
||||
boolean reset();
|
||||
|
||||
Object asDOM3Serializer() throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,773 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
import javax.xml.transform.SourceLocator;
|
||||
import javax.xml.transform.Transformer;
|
||||
import org.apache.xml.serializer.dom3.DOM3SerializerImpl;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
public abstract class SerializerBase implements SerializationHandler, SerializerConstants {
|
||||
public static final String PKG_NAME;
|
||||
|
||||
public static final String PKG_PATH;
|
||||
|
||||
static {
|
||||
String fullyQualifiedName = SerializerBase.class.getName();
|
||||
int lastDot = fullyQualifiedName.lastIndexOf('.');
|
||||
if (lastDot < 0) {
|
||||
PKG_NAME = "";
|
||||
} else {
|
||||
PKG_NAME = fullyQualifiedName.substring(0, lastDot);
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < PKG_NAME.length(); i++) {
|
||||
char ch = PKG_NAME.charAt(i);
|
||||
if (ch == '.') {
|
||||
sb.append('/');
|
||||
} else {
|
||||
sb.append(ch);
|
||||
}
|
||||
}
|
||||
PKG_PATH = sb.toString();
|
||||
}
|
||||
|
||||
protected void fireEndElem(String name) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(4, name, (Attributes)null);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fireCharEvent(char[] chars, int start, int length) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(5, chars, start, length);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean m_needToCallStartDocument = true;
|
||||
|
||||
protected boolean m_cdataTagOpen = false;
|
||||
|
||||
protected AttributesImplSerializer m_attributes = new AttributesImplSerializer();
|
||||
|
||||
protected boolean m_inEntityRef = false;
|
||||
|
||||
protected boolean m_inExternalDTD = false;
|
||||
|
||||
protected String m_doctypeSystem;
|
||||
|
||||
protected String m_doctypePublic;
|
||||
|
||||
boolean m_needToOutputDocTypeDecl = true;
|
||||
|
||||
protected boolean m_shouldNotWriteXMLHeader = false;
|
||||
|
||||
private String m_standalone;
|
||||
|
||||
protected boolean m_standaloneWasSpecified = false;
|
||||
|
||||
protected boolean m_doIndent = false;
|
||||
|
||||
protected int m_indentAmount = 0;
|
||||
|
||||
protected String m_version = null;
|
||||
|
||||
protected String m_mediatype;
|
||||
|
||||
private Transformer m_transformer;
|
||||
|
||||
protected NamespaceMappings m_prefixMap;
|
||||
|
||||
protected SerializerTrace m_tracer;
|
||||
|
||||
protected SourceLocator m_sourceLocator;
|
||||
|
||||
protected Writer m_writer = null;
|
||||
|
||||
protected ElemContext m_elemContext = new ElemContext();
|
||||
|
||||
protected char[] m_charsBuff = new char[60];
|
||||
|
||||
protected char[] m_attrBuff = new char[30];
|
||||
|
||||
public void comment(String data) throws SAXException {
|
||||
this.m_docIsEmpty = false;
|
||||
int length = data.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
data.getChars(0, length, this.m_charsBuff, 0);
|
||||
comment(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
protected String patchName(String qname) {
|
||||
int lastColon = qname.lastIndexOf(':');
|
||||
if (lastColon > 0) {
|
||||
int firstColon = qname.indexOf(':');
|
||||
String prefix = qname.substring(0, firstColon);
|
||||
String localName = qname.substring(lastColon + 1);
|
||||
String uri = this.m_prefixMap.lookupNamespace(prefix);
|
||||
if (uri != null && uri.length() == 0)
|
||||
return localName;
|
||||
if (firstColon != lastColon)
|
||||
return prefix + ':' + localName;
|
||||
}
|
||||
return qname;
|
||||
}
|
||||
|
||||
protected static String getLocalName(String qname) {
|
||||
int col = qname.lastIndexOf(':');
|
||||
return (col > 0) ? qname.substring(col + 1) : qname;
|
||||
}
|
||||
|
||||
public void setDocumentLocator(Locator locator) {}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException {
|
||||
if (this.m_elemContext.m_startTagOpen)
|
||||
addAttributeAlways(uri, localName, rawName, type, value, XSLAttribute);
|
||||
}
|
||||
|
||||
public boolean addAttributeAlways(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) {
|
||||
boolean bool;
|
||||
int i;
|
||||
if (localName == null || uri == null || uri.length() == 0) {
|
||||
i = this.m_attributes.getIndex(rawName);
|
||||
} else {
|
||||
i = this.m_attributes.getIndex(uri, localName);
|
||||
}
|
||||
if (i >= 0) {
|
||||
this.m_attributes.setValue(i, value);
|
||||
bool = false;
|
||||
} else {
|
||||
this.m_attributes.addAttribute(uri, localName, rawName, type, value);
|
||||
bool = true;
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
public void addAttribute(String name, String value) {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
String patchedName = patchName(name);
|
||||
String localName = getLocalName(patchedName);
|
||||
String uri = getNamespaceURI(patchedName, false);
|
||||
addAttributeAlways(uri, localName, patchedName, "CDATA", value, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void addXSLAttribute(String name, String value, String uri) {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
String patchedName = patchName(name);
|
||||
String localName = getLocalName(patchedName);
|
||||
addAttributeAlways(uri, localName, patchedName, "CDATA", value, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void addAttributes(Attributes atts) throws SAXException {
|
||||
int nAtts = atts.getLength();
|
||||
for (int i = 0; i < nAtts; i++) {
|
||||
String uri = atts.getURI(i);
|
||||
if (null == uri)
|
||||
uri = "";
|
||||
addAttributeAlways(uri, atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i), false);
|
||||
}
|
||||
}
|
||||
|
||||
public ContentHandler asContentHandler() throws IOException {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void endEntity(String name) throws SAXException {
|
||||
if (name.equals("[dtd]"))
|
||||
this.m_inExternalDTD = false;
|
||||
this.m_inEntityRef = false;
|
||||
if (this.m_tracer != null)
|
||||
fireEndEntity(name);
|
||||
}
|
||||
|
||||
public void close() {}
|
||||
|
||||
protected void initCDATA() {}
|
||||
|
||||
public String getEncoding() {
|
||||
return getOutputProperty("encoding");
|
||||
}
|
||||
|
||||
public void setEncoding(String encoding) {
|
||||
setOutputProperty("encoding", encoding);
|
||||
}
|
||||
|
||||
public void setOmitXMLDeclaration(boolean b) {
|
||||
String val = b ? "yes" : "no";
|
||||
setOutputProperty("omit-xml-declaration", val);
|
||||
}
|
||||
|
||||
public boolean getOmitXMLDeclaration() {
|
||||
return this.m_shouldNotWriteXMLHeader;
|
||||
}
|
||||
|
||||
public String getDoctypePublic() {
|
||||
return this.m_doctypePublic;
|
||||
}
|
||||
|
||||
public void setDoctypePublic(String doctypePublic) {
|
||||
setOutputProperty("doctype-public", doctypePublic);
|
||||
}
|
||||
|
||||
public String getDoctypeSystem() {
|
||||
return this.m_doctypeSystem;
|
||||
}
|
||||
|
||||
public void setDoctypeSystem(String doctypeSystem) {
|
||||
setOutputProperty("doctype-system", doctypeSystem);
|
||||
}
|
||||
|
||||
public void setDoctype(String doctypeSystem, String doctypePublic) {
|
||||
setOutputProperty("doctype-system", doctypeSystem);
|
||||
setOutputProperty("doctype-public", doctypePublic);
|
||||
}
|
||||
|
||||
public void setStandalone(String standalone) {
|
||||
setOutputProperty("standalone", standalone);
|
||||
}
|
||||
|
||||
protected void setStandaloneInternal(String standalone) {
|
||||
if ("yes".equals(standalone)) {
|
||||
this.m_standalone = "yes";
|
||||
} else {
|
||||
this.m_standalone = "no";
|
||||
}
|
||||
}
|
||||
|
||||
public String getStandalone() {
|
||||
return this.m_standalone;
|
||||
}
|
||||
|
||||
public boolean getIndent() {
|
||||
return this.m_doIndent;
|
||||
}
|
||||
|
||||
public String getMediaType() {
|
||||
return this.m_mediatype;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.m_version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
setOutputProperty("version", version);
|
||||
}
|
||||
|
||||
public void setMediaType(String mediaType) {
|
||||
setOutputProperty("media-type", mediaType);
|
||||
}
|
||||
|
||||
public int getIndentAmount() {
|
||||
return this.m_indentAmount;
|
||||
}
|
||||
|
||||
public void setIndentAmount(int m_indentAmount) {
|
||||
this.m_indentAmount = m_indentAmount;
|
||||
}
|
||||
|
||||
public void setIndent(boolean doIndent) {
|
||||
String val = doIndent ? "yes" : "no";
|
||||
setOutputProperty("indent", val);
|
||||
}
|
||||
|
||||
public void namespaceAfterStartElement(String uri, String prefix) throws SAXException {}
|
||||
|
||||
public DOMSerializer asDOMSerializer() throws IOException {
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final boolean subPartMatch(String p, String t) {
|
||||
return (p == t || (null != p && p.equals(t)));
|
||||
}
|
||||
|
||||
protected static final String getPrefixPart(String qname) {
|
||||
int col = qname.indexOf(':');
|
||||
return (col > 0) ? qname.substring(0, col) : null;
|
||||
}
|
||||
|
||||
public NamespaceMappings getNamespaceMappings() {
|
||||
return this.m_prefixMap;
|
||||
}
|
||||
|
||||
public String getPrefix(String namespaceURI) {
|
||||
String prefix = this.m_prefixMap.lookupPrefix(namespaceURI);
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public String getNamespaceURI(String qname, boolean isElement) {
|
||||
String uri = "";
|
||||
int col = qname.lastIndexOf(':');
|
||||
String prefix = (col > 0) ? qname.substring(0, col) : "";
|
||||
if (!"".equals(prefix) || isElement)
|
||||
if (this.m_prefixMap != null) {
|
||||
uri = this.m_prefixMap.lookupNamespace(prefix);
|
||||
if (uri == null && !prefix.equals("xmlns"))
|
||||
throw new RuntimeException(Utils.messages.createMessage("ER_NAMESPACE_PREFIX", new Object[] { qname.substring(0, col) }));
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
||||
public String getNamespaceURIFromPrefix(String prefix) {
|
||||
String uri = null;
|
||||
if (this.m_prefixMap != null)
|
||||
uri = this.m_prefixMap.lookupNamespace(prefix);
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void entityReference(String name) throws SAXException {
|
||||
flushPending();
|
||||
startEntity(name);
|
||||
endEntity(name);
|
||||
if (this.m_tracer != null)
|
||||
fireEntityReference(name);
|
||||
}
|
||||
|
||||
public void setTransformer(Transformer t) {
|
||||
this.m_transformer = t;
|
||||
if (this.m_transformer instanceof SerializerTrace && ((SerializerTrace)this.m_transformer).hasTraceListeners()) {
|
||||
this.m_tracer = (SerializerTrace)this.m_transformer;
|
||||
} else {
|
||||
this.m_tracer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Transformer getTransformer() {
|
||||
return this.m_transformer;
|
||||
}
|
||||
|
||||
public void characters(Node node) throws SAXException {
|
||||
flushPending();
|
||||
String data = node.getNodeValue();
|
||||
if (data != null) {
|
||||
int length = data.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
data.getChars(0, length, this.m_charsBuff, 0);
|
||||
characters(this.m_charsBuff, 0, length);
|
||||
}
|
||||
}
|
||||
|
||||
public void error(SAXParseException exc) throws SAXException {}
|
||||
|
||||
public void fatalError(SAXParseException exc) throws SAXException {
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
|
||||
public void warning(SAXParseException exc) throws SAXException {}
|
||||
|
||||
protected void fireStartEntity(String name) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(9, name);
|
||||
}
|
||||
}
|
||||
|
||||
private void flushMyWriter() {
|
||||
if (this.m_writer != null)
|
||||
try {
|
||||
this.m_writer.flush();
|
||||
} catch (IOException ioe) {}
|
||||
}
|
||||
|
||||
protected void fireCDATAEvent(char[] chars, int start, int length) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(10, chars, start, length);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fireCommentEvent(char[] chars, int start, int length) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(8, new String(chars, start, length));
|
||||
}
|
||||
}
|
||||
|
||||
public void fireEndEntity(String name) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
flushMyWriter();
|
||||
}
|
||||
|
||||
protected void fireStartDoc() throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fireEndDoc() throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(2);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fireStartElem(String elemName) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(3, elemName, this.m_attributes);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fireEscapingEvent(String name, String data) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(7, name, data);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fireEntityReference(String name) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
flushMyWriter();
|
||||
this.m_tracer.fireGenerateEvent(9, name, (Attributes)null);
|
||||
}
|
||||
}
|
||||
|
||||
public void startDocument() throws SAXException {
|
||||
startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
|
||||
protected void startDocumentInternal() throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireStartDoc();
|
||||
}
|
||||
|
||||
public void setSourceLocator(SourceLocator locator) {
|
||||
this.m_sourceLocator = locator;
|
||||
}
|
||||
|
||||
public void setNamespaceMappings(NamespaceMappings mappings) {
|
||||
this.m_prefixMap = mappings;
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
resetSerializerBase();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void resetSerializerBase() {
|
||||
this.m_attributes.clear();
|
||||
this.m_CdataElems = null;
|
||||
this.m_cdataTagOpen = false;
|
||||
this.m_docIsEmpty = true;
|
||||
this.m_doctypePublic = null;
|
||||
this.m_doctypeSystem = null;
|
||||
this.m_doIndent = false;
|
||||
this.m_elemContext = new ElemContext();
|
||||
this.m_indentAmount = 0;
|
||||
this.m_inEntityRef = false;
|
||||
this.m_inExternalDTD = false;
|
||||
this.m_mediatype = null;
|
||||
this.m_needToCallStartDocument = true;
|
||||
this.m_needToOutputDocTypeDecl = false;
|
||||
if (this.m_OutputProps != null)
|
||||
this.m_OutputProps.clear();
|
||||
if (this.m_OutputPropsDefault != null)
|
||||
this.m_OutputPropsDefault.clear();
|
||||
if (this.m_prefixMap != null)
|
||||
this.m_prefixMap.reset();
|
||||
this.m_shouldNotWriteXMLHeader = false;
|
||||
this.m_sourceLocator = null;
|
||||
this.m_standalone = null;
|
||||
this.m_standaloneWasSpecified = false;
|
||||
this.m_StringOfCDATASections = null;
|
||||
this.m_tracer = null;
|
||||
this.m_transformer = null;
|
||||
this.m_version = null;
|
||||
}
|
||||
|
||||
final boolean inTemporaryOutputState() {
|
||||
return (getEncoding() == null);
|
||||
}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value) throws SAXException {
|
||||
if (this.m_elemContext.m_startTagOpen)
|
||||
addAttributeAlways(uri, localName, rawName, type, value, false);
|
||||
}
|
||||
|
||||
public void notationDecl(String arg0, String arg1, String arg2) throws SAXException {}
|
||||
|
||||
public void unparsedEntityDecl(String arg0, String arg1, String arg2, String arg3) throws SAXException {}
|
||||
|
||||
public void setDTDEntityExpansion(boolean expand) {}
|
||||
|
||||
protected String m_StringOfCDATASections = null;
|
||||
|
||||
boolean m_docIsEmpty = true;
|
||||
|
||||
void initCdataElems(String s) {
|
||||
if (s != null) {
|
||||
int max = s.length();
|
||||
boolean inCurly = false;
|
||||
boolean foundURI = false;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
String uri = null;
|
||||
String localName = null;
|
||||
for (int i = 0; i < max; i++) {
|
||||
char c = s.charAt(i);
|
||||
if (Character.isWhitespace(c)) {
|
||||
if (!inCurly) {
|
||||
if (buf.length() > 0) {
|
||||
localName = buf.toString();
|
||||
if (!foundURI)
|
||||
uri = "";
|
||||
addCDATAElement(uri, localName);
|
||||
buf.setLength(0);
|
||||
foundURI = false;
|
||||
}
|
||||
} else {
|
||||
buf.append(c);
|
||||
}
|
||||
} else if ('{' == c) {
|
||||
inCurly = true;
|
||||
} else if ('}' == c) {
|
||||
foundURI = true;
|
||||
uri = buf.toString();
|
||||
buf.setLength(0);
|
||||
inCurly = false;
|
||||
} else {
|
||||
buf.append(c);
|
||||
}
|
||||
}
|
||||
if (buf.length() > 0) {
|
||||
localName = buf.toString();
|
||||
if (!foundURI)
|
||||
uri = "";
|
||||
addCDATAElement(uri, localName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Hashtable m_CdataElems = null;
|
||||
|
||||
private HashMap m_OutputProps;
|
||||
|
||||
private HashMap m_OutputPropsDefault;
|
||||
|
||||
private void addCDATAElement(String uri, String localName) {
|
||||
if (this.m_CdataElems == null)
|
||||
this.m_CdataElems = new Hashtable();
|
||||
Hashtable h = (Hashtable)this.m_CdataElems.get(localName);
|
||||
if (h == null) {
|
||||
h = new Hashtable();
|
||||
this.m_CdataElems.put(localName, h);
|
||||
}
|
||||
h.put(uri, uri);
|
||||
}
|
||||
|
||||
public boolean documentIsEmpty() {
|
||||
return (this.m_docIsEmpty && this.m_elemContext.m_currentElemDepth == 0);
|
||||
}
|
||||
|
||||
protected boolean isCdataSection() {
|
||||
boolean b = false;
|
||||
if (null != this.m_StringOfCDATASections) {
|
||||
if (this.m_elemContext.m_elementLocalName == null) {
|
||||
String localName = getLocalName(this.m_elemContext.m_elementName);
|
||||
this.m_elemContext.m_elementLocalName = localName;
|
||||
}
|
||||
if (this.m_elemContext.m_elementURI == null) {
|
||||
this.m_elemContext.m_elementURI = getElementURI();
|
||||
} else if (this.m_elemContext.m_elementURI.length() == 0) {
|
||||
if (this.m_elemContext.m_elementName == null) {
|
||||
this.m_elemContext.m_elementName = this.m_elemContext.m_elementLocalName;
|
||||
} else if (this.m_elemContext.m_elementLocalName.length() < this.m_elemContext.m_elementName.length()) {
|
||||
this.m_elemContext.m_elementURI = getElementURI();
|
||||
}
|
||||
}
|
||||
Hashtable h = (Hashtable)this.m_CdataElems.get(this.m_elemContext.m_elementLocalName);
|
||||
if (h != null) {
|
||||
Object obj = h.get(this.m_elemContext.m_elementURI);
|
||||
if (obj != null)
|
||||
b = true;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private String getElementURI() {
|
||||
String uri = null;
|
||||
String prefix = getPrefixPart(this.m_elemContext.m_elementName);
|
||||
if (prefix == null) {
|
||||
uri = this.m_prefixMap.lookupNamespace("");
|
||||
} else {
|
||||
uri = this.m_prefixMap.lookupNamespace(prefix);
|
||||
}
|
||||
if (uri == null)
|
||||
uri = "";
|
||||
return uri;
|
||||
}
|
||||
|
||||
public String getOutputProperty(String name) {
|
||||
String val = getOutputPropertyNonDefault(name);
|
||||
if (val == null)
|
||||
val = getOutputPropertyDefault(name);
|
||||
return val;
|
||||
}
|
||||
|
||||
public String getOutputPropertyNonDefault(String name) {
|
||||
return getProp(name, false);
|
||||
}
|
||||
|
||||
public Object asDOM3Serializer() throws IOException {
|
||||
return new DOM3SerializerImpl(this);
|
||||
}
|
||||
|
||||
public String getOutputPropertyDefault(String name) {
|
||||
return getProp(name, true);
|
||||
}
|
||||
|
||||
public void setOutputProperty(String name, String val) {
|
||||
setProp(name, val, false);
|
||||
}
|
||||
|
||||
public void setOutputPropertyDefault(String name, String val) {
|
||||
setProp(name, val, true);
|
||||
}
|
||||
|
||||
Set getOutputPropDefaultKeys() {
|
||||
return this.m_OutputPropsDefault.keySet();
|
||||
}
|
||||
|
||||
Set getOutputPropKeys() {
|
||||
return this.m_OutputProps.keySet();
|
||||
}
|
||||
|
||||
private String getProp(String name, boolean defaultVal) {
|
||||
String str;
|
||||
if (this.m_OutputProps == null) {
|
||||
this.m_OutputProps = new HashMap();
|
||||
this.m_OutputPropsDefault = new HashMap();
|
||||
}
|
||||
if (defaultVal) {
|
||||
str = (String)this.m_OutputPropsDefault.get(name);
|
||||
} else {
|
||||
str = (String)this.m_OutputProps.get(name);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void setProp(String name, String val, boolean defaultVal) {
|
||||
if (this.m_OutputProps == null) {
|
||||
this.m_OutputProps = new HashMap();
|
||||
this.m_OutputPropsDefault = new HashMap();
|
||||
}
|
||||
if (defaultVal) {
|
||||
this.m_OutputPropsDefault.put(name, val);
|
||||
} else if ("cdata-section-elements".equals(name) && val != null) {
|
||||
String str1;
|
||||
initCdataElems(val);
|
||||
String oldVal = (String)this.m_OutputProps.get(name);
|
||||
if (oldVal == null) {
|
||||
str1 = oldVal + ' ' + val;
|
||||
} else {
|
||||
str1 = val;
|
||||
}
|
||||
this.m_OutputProps.put(name, str1);
|
||||
} else {
|
||||
this.m_OutputProps.put(name, val);
|
||||
}
|
||||
}
|
||||
|
||||
static char getFirstCharLocName(String name) {
|
||||
char c;
|
||||
int i = name.indexOf('}');
|
||||
if (i < 0) {
|
||||
c = name.charAt(0);
|
||||
} else {
|
||||
c = name.charAt(i + 1);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
public abstract void flushPending() throws SAXException;
|
||||
|
||||
public abstract boolean setEscaping(boolean paramBoolean) throws SAXException;
|
||||
|
||||
public abstract void serialize(Node paramNode) throws IOException;
|
||||
|
||||
public abstract void setContentHandler(ContentHandler paramContentHandler);
|
||||
|
||||
public abstract void addUniqueAttribute(String paramString1, String paramString2, int paramInt) throws SAXException;
|
||||
|
||||
public abstract boolean startPrefixMapping(String paramString1, String paramString2, boolean paramBoolean) throws SAXException;
|
||||
|
||||
public abstract void startElement(String paramString) throws SAXException;
|
||||
|
||||
public abstract void startElement(String paramString1, String paramString2, String paramString3) throws SAXException;
|
||||
|
||||
public abstract void endElement(String paramString) throws SAXException;
|
||||
|
||||
public abstract void characters(String paramString) throws SAXException;
|
||||
|
||||
public abstract void skippedEntity(String paramString) throws SAXException;
|
||||
|
||||
public abstract void processingInstruction(String paramString1, String paramString2) throws SAXException;
|
||||
|
||||
public abstract void ignorableWhitespace(char[] paramArrayOfchar, int paramInt1, int paramInt2) throws SAXException;
|
||||
|
||||
public abstract void characters(char[] paramArrayOfchar, int paramInt1, int paramInt2) throws SAXException;
|
||||
|
||||
public abstract void endElement(String paramString1, String paramString2, String paramString3) throws SAXException;
|
||||
|
||||
public abstract void startElement(String paramString1, String paramString2, String paramString3, Attributes paramAttributes) throws SAXException;
|
||||
|
||||
public abstract void endPrefixMapping(String paramString) throws SAXException;
|
||||
|
||||
public abstract void startPrefixMapping(String paramString1, String paramString2) throws SAXException;
|
||||
|
||||
public abstract void endDocument() throws SAXException;
|
||||
|
||||
public abstract void comment(char[] paramArrayOfchar, int paramInt1, int paramInt2) throws SAXException;
|
||||
|
||||
public abstract void endCDATA() throws SAXException;
|
||||
|
||||
public abstract void startCDATA() throws SAXException;
|
||||
|
||||
public abstract void startEntity(String paramString) throws SAXException;
|
||||
|
||||
public abstract void endDTD() throws SAXException;
|
||||
|
||||
public abstract void startDTD(String paramString1, String paramString2, String paramString3) throws SAXException;
|
||||
|
||||
public abstract void setCdataSectionElements(Vector paramVector);
|
||||
|
||||
public abstract void externalEntityDecl(String paramString1, String paramString2, String paramString3) throws SAXException;
|
||||
|
||||
public abstract void internalEntityDecl(String paramString1, String paramString2) throws SAXException;
|
||||
|
||||
public abstract void attributeDecl(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5) throws SAXException;
|
||||
|
||||
public abstract void elementDecl(String paramString1, String paramString2) throws SAXException;
|
||||
|
||||
public abstract Properties getOutputFormat();
|
||||
|
||||
public abstract void setOutputFormat(Properties paramProperties);
|
||||
|
||||
public abstract Writer getWriter();
|
||||
|
||||
public abstract void setWriter(Writer paramWriter);
|
||||
|
||||
public abstract OutputStream getOutputStream();
|
||||
|
||||
public abstract void setOutputStream(OutputStream paramOutputStream);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
interface SerializerConstants {
|
||||
public static final String CDATA_CONTINUE = "]]]]><![CDATA[>";
|
||||
|
||||
public static final String CDATA_DELIMITER_CLOSE = "]]>";
|
||||
|
||||
public static final String CDATA_DELIMITER_OPEN = "<![CDATA[";
|
||||
|
||||
public static final String EMPTYSTRING = "";
|
||||
|
||||
public static final String ENTITY_AMP = "&";
|
||||
|
||||
public static final String ENTITY_CRLF = "
";
|
||||
|
||||
public static final String ENTITY_GT = ">";
|
||||
|
||||
public static final String ENTITY_LT = "<";
|
||||
|
||||
public static final String ENTITY_QUOT = """;
|
||||
|
||||
public static final String XML_PREFIX = "xml";
|
||||
|
||||
public static final String XMLNS_PREFIX = "xmlns";
|
||||
|
||||
public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
|
||||
|
||||
public static final String DEFAULT_SAX_SERIALIZER = SerializerBase.PKG_NAME + ".ToXMLSAXHandler";
|
||||
|
||||
public static final String XMLVERSION11 = "1.1";
|
||||
|
||||
public static final String XMLVERSION10 = "1.0";
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.apache.xml.serializer.utils.WrappedRuntimeException;
|
||||
import org.xml.sax.ContentHandler;
|
||||
|
||||
public final class SerializerFactory {
|
||||
private static Hashtable m_formats = new Hashtable();
|
||||
|
||||
public static Serializer getSerializer(Properties format) {
|
||||
Serializer serializer;
|
||||
try {
|
||||
String method = format.getProperty("method");
|
||||
if (method == null) {
|
||||
String msg = Utils.messages.createMessage("ER_FACTORY_PROPERTY_MISSING", new Object[] { "method" });
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
String className = format.getProperty("{http://xml.apache.org/xalan}content-handler");
|
||||
if (null == className) {
|
||||
Properties methodDefaults = OutputPropertiesFactory.getDefaultMethodProperties(method);
|
||||
className = methodDefaults.getProperty("{http://xml.apache.org/xalan}content-handler");
|
||||
if (null == className) {
|
||||
String msg = Utils.messages.createMessage("ER_FACTORY_PROPERTY_MISSING", new Object[] { "{http://xml.apache.org/xalan}content-handler" });
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
}
|
||||
ClassLoader loader = ObjectFactory.findClassLoader();
|
||||
Class cls = ObjectFactory.findProviderClass(className, loader, true);
|
||||
Object obj = cls.newInstance();
|
||||
if (obj instanceof SerializationHandler) {
|
||||
serializer = (Serializer)cls.newInstance();
|
||||
serializer.setOutputFormat(format);
|
||||
} else if (obj instanceof ContentHandler) {
|
||||
className = SerializerConstants.DEFAULT_SAX_SERIALIZER;
|
||||
cls = ObjectFactory.findProviderClass(className, loader, true);
|
||||
SerializationHandler sh = (SerializationHandler)cls.newInstance();
|
||||
sh.setContentHandler((ContentHandler)obj);
|
||||
sh.setOutputFormat(format);
|
||||
serializer = sh;
|
||||
} else {
|
||||
throw new Exception(Utils.messages.createMessage("ER_SERIALIZER_NOT_CONTENTHANDLER", new Object[] { className }));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new WrappedRuntimeException(e);
|
||||
}
|
||||
return serializer;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
public interface SerializerTrace {
|
||||
public static final int EVENTTYPE_STARTDOCUMENT = 1;
|
||||
|
||||
public static final int EVENTTYPE_ENDDOCUMENT = 2;
|
||||
|
||||
public static final int EVENTTYPE_STARTELEMENT = 3;
|
||||
|
||||
public static final int EVENTTYPE_ENDELEMENT = 4;
|
||||
|
||||
public static final int EVENTTYPE_CHARACTERS = 5;
|
||||
|
||||
public static final int EVENTTYPE_IGNORABLEWHITESPACE = 6;
|
||||
|
||||
public static final int EVENTTYPE_PI = 7;
|
||||
|
||||
public static final int EVENTTYPE_COMMENT = 8;
|
||||
|
||||
public static final int EVENTTYPE_ENTITYREF = 9;
|
||||
|
||||
public static final int EVENTTYPE_CDATA = 10;
|
||||
|
||||
public static final int EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS = 11;
|
||||
|
||||
public static final int EVENTTYPE_OUTPUT_CHARACTERS = 12;
|
||||
|
||||
boolean hasTraceListeners();
|
||||
|
||||
void fireGenerateEvent(int paramInt);
|
||||
|
||||
void fireGenerateEvent(int paramInt, String paramString, Attributes paramAttributes);
|
||||
|
||||
void fireGenerateEvent(int paramInt1, char[] paramArrayOfchar, int paramInt2, int paramInt3);
|
||||
|
||||
void fireGenerateEvent(int paramInt, String paramString1, String paramString2);
|
||||
|
||||
void fireGenerateEvent(int paramInt, String paramString);
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
|
||||
final class SerializerTraceWriter extends Writer implements WriterChain {
|
||||
private final Writer m_writer;
|
||||
|
||||
private final SerializerTrace m_tracer;
|
||||
|
||||
private int buf_length;
|
||||
|
||||
private byte[] buf;
|
||||
|
||||
private int count;
|
||||
|
||||
private void setBufferSize(int size) {
|
||||
this.buf = new byte[size + 3];
|
||||
this.buf_length = size;
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public SerializerTraceWriter(Writer out, SerializerTrace tracer) {
|
||||
this.m_writer = out;
|
||||
this.m_tracer = tracer;
|
||||
setBufferSize(1024);
|
||||
}
|
||||
|
||||
private void flushBuffer() throws IOException {
|
||||
if (this.count > 0) {
|
||||
char[] chars = new char[this.count];
|
||||
for (int i = 0; i < this.count; i++)
|
||||
chars[i] = (char)this.buf[i];
|
||||
if (this.m_tracer != null)
|
||||
this.m_tracer.fireGenerateEvent(12, chars, 0, chars.length);
|
||||
this.count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
if (this.m_writer != null)
|
||||
this.m_writer.flush();
|
||||
flushBuffer();
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
if (this.m_writer != null)
|
||||
this.m_writer.close();
|
||||
flushBuffer();
|
||||
}
|
||||
|
||||
public void write(int c) throws IOException {
|
||||
if (this.m_writer != null)
|
||||
this.m_writer.write(c);
|
||||
if (this.count >= this.buf_length)
|
||||
flushBuffer();
|
||||
if (c < 128) {
|
||||
this.buf[this.count++] = (byte)c;
|
||||
} else if (c < 2048) {
|
||||
this.buf[this.count++] = (byte)(192 + (c >> 6));
|
||||
this.buf[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
} else {
|
||||
this.buf[this.count++] = (byte)(224 + (c >> 12));
|
||||
this.buf[this.count++] = (byte)(128 + (c >> 6 & 0x3F));
|
||||
this.buf[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
}
|
||||
}
|
||||
|
||||
public void write(char[] chars, int start, int length) throws IOException {
|
||||
if (this.m_writer != null)
|
||||
this.m_writer.write(chars, start, length);
|
||||
int lengthx3 = (length << 1) + length;
|
||||
if (lengthx3 >= this.buf_length) {
|
||||
flushBuffer();
|
||||
setBufferSize(2 * lengthx3);
|
||||
}
|
||||
if (lengthx3 > this.buf_length - this.count)
|
||||
flushBuffer();
|
||||
int n = length + start;
|
||||
for (int i = start; i < n; i++) {
|
||||
char c = chars[i];
|
||||
if (c < '\u0080') {
|
||||
this.buf[this.count++] = (byte)c;
|
||||
} else if (c < 'ࠀ') {
|
||||
this.buf[this.count++] = (byte)(192 + (c >> 6));
|
||||
this.buf[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
} else {
|
||||
this.buf[this.count++] = (byte)(224 + (c >> 12));
|
||||
this.buf[this.count++] = (byte)(128 + (c >> 6 & 0x3F));
|
||||
this.buf[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void write(String s) throws IOException {
|
||||
if (this.m_writer != null)
|
||||
this.m_writer.write(s);
|
||||
int length = s.length();
|
||||
int lengthx3 = (length << 1) + length;
|
||||
if (lengthx3 >= this.buf_length) {
|
||||
flushBuffer();
|
||||
setBufferSize(2 * lengthx3);
|
||||
}
|
||||
if (lengthx3 > this.buf_length - this.count)
|
||||
flushBuffer();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c < '\u0080') {
|
||||
this.buf[this.count++] = (byte)c;
|
||||
} else if (c < 'ࠀ') {
|
||||
this.buf[this.count++] = (byte)(192 + (c >> 6));
|
||||
this.buf[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
} else {
|
||||
this.buf[this.count++] = (byte)(224 + (c >> 12));
|
||||
this.buf[this.count++] = (byte)(128 + (c >> 6 & 0x3F));
|
||||
this.buf[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
return this.m_writer;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
OutputStream retval = null;
|
||||
if (this.m_writer instanceof WriterChain)
|
||||
retval = ((WriterChain)this.m_writer).getOutputStream();
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.Properties;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public final class ToHTMLSAXHandler extends ToSAXHandler {
|
||||
private boolean m_dtdHandled = false;
|
||||
|
||||
protected boolean m_escapeSetting = true;
|
||||
|
||||
public Properties getOutputFormat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void indent(int n) throws SAXException {}
|
||||
|
||||
public void serialize(Node node) throws IOException {}
|
||||
|
||||
public boolean setEscaping(boolean escape) throws SAXException {
|
||||
boolean oldEscapeSetting = this.m_escapeSetting;
|
||||
this.m_escapeSetting = escape;
|
||||
if (escape) {
|
||||
processingInstruction("javax.xml.transform.enable-output-escaping", "");
|
||||
} else {
|
||||
processingInstruction("javax.xml.transform.disable-output-escaping", "");
|
||||
}
|
||||
return oldEscapeSetting;
|
||||
}
|
||||
|
||||
public void setIndent(boolean indent) {}
|
||||
|
||||
public void setOutputFormat(Properties format) {}
|
||||
|
||||
public void setOutputStream(OutputStream output) {}
|
||||
|
||||
public void setWriter(Writer writer) {}
|
||||
|
||||
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException {}
|
||||
|
||||
public void elementDecl(String name, String model) throws SAXException {}
|
||||
|
||||
public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException {}
|
||||
|
||||
public void internalEntityDecl(String name, String value) throws SAXException {}
|
||||
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.endElement(uri, localName, qName);
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(qName);
|
||||
}
|
||||
|
||||
public void endPrefixMapping(String prefix) throws SAXException {}
|
||||
|
||||
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {}
|
||||
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.processingInstruction(target, data);
|
||||
if (this.m_tracer != null)
|
||||
fireEscapingEvent(target, data);
|
||||
}
|
||||
|
||||
public void setDocumentLocator(Locator arg0) {}
|
||||
|
||||
public void skippedEntity(String arg0) throws SAXException {}
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
|
||||
flushPending();
|
||||
super.startElement(namespaceURI, localName, qName, atts);
|
||||
this.m_saxHandler.startElement(namespaceURI, localName, qName, atts);
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
|
||||
public void comment(char[] ch, int start, int length) throws SAXException {
|
||||
flushPending();
|
||||
if (this.m_lexHandler != null)
|
||||
this.m_lexHandler.comment(ch, start, length);
|
||||
if (this.m_tracer != null)
|
||||
fireCommentEvent(ch, start, length);
|
||||
}
|
||||
|
||||
public void endCDATA() throws SAXException {}
|
||||
|
||||
public void endDTD() throws SAXException {}
|
||||
|
||||
public void startCDATA() throws SAXException {}
|
||||
|
||||
public void startEntity(String arg0) throws SAXException {}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.endDocument();
|
||||
if (this.m_tracer != null)
|
||||
fireEndDoc();
|
||||
}
|
||||
|
||||
protected void closeStartTag() throws SAXException {
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
this.m_saxHandler.startElement("", this.m_elemContext.m_elementName, this.m_elemContext.m_elementName, this.m_attributes);
|
||||
this.m_attributes.clear();
|
||||
}
|
||||
|
||||
public void close() {}
|
||||
|
||||
public void characters(String chars) throws SAXException {
|
||||
int length = chars.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
chars.getChars(0, length, this.m_charsBuff, 0);
|
||||
characters(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
public ToHTMLSAXHandler(ContentHandler handler, String encoding) {
|
||||
super(handler, encoding);
|
||||
}
|
||||
|
||||
public ToHTMLSAXHandler(ContentHandler handler, LexicalHandler lex, String encoding) {
|
||||
super(handler, lex, encoding);
|
||||
}
|
||||
|
||||
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException {
|
||||
super.startElement(elementNamespaceURI, elementLocalName, elementName);
|
||||
flushPending();
|
||||
if (!this.m_dtdHandled) {
|
||||
String doctypeSystem = getDoctypeSystem();
|
||||
String doctypePublic = getDoctypePublic();
|
||||
if ((doctypeSystem != null || doctypePublic != null) &&
|
||||
this.m_lexHandler != null)
|
||||
this.m_lexHandler.startDTD(elementName, doctypePublic, doctypeSystem);
|
||||
this.m_dtdHandled = true;
|
||||
}
|
||||
this.m_elemContext = this.m_elemContext.push(elementNamespaceURI, elementLocalName, elementName);
|
||||
}
|
||||
|
||||
public void startElement(String elementName) throws SAXException {
|
||||
startElement(null, null, elementName);
|
||||
}
|
||||
|
||||
public void endElement(String elementName) throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.endElement("", elementName, elementName);
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(elementName);
|
||||
}
|
||||
|
||||
public void characters(char[] ch, int off, int len) throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.characters(ch, off, len);
|
||||
if (this.m_tracer != null)
|
||||
fireCharEvent(ch, off, len);
|
||||
}
|
||||
|
||||
public void flushPending() throws SAXException {
|
||||
if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException {
|
||||
if (shouldFlush)
|
||||
flushPending();
|
||||
this.m_saxHandler.startPrefixMapping(prefix, uri);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void startPrefixMapping(String prefix, String uri) throws SAXException {
|
||||
startPrefixMapping(prefix, uri, true);
|
||||
}
|
||||
|
||||
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException {
|
||||
if (this.m_elemContext.m_elementURI == null) {
|
||||
String prefix1 = SerializerBase.getPrefixPart(this.m_elemContext.m_elementName);
|
||||
if (prefix1 == null && "".equals(prefix))
|
||||
this.m_elemContext.m_elementURI = uri;
|
||||
}
|
||||
startPrefixMapping(prefix, uri, false);
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
boolean wasReset = false;
|
||||
if (super.reset()) {
|
||||
resetToHTMLSAXHandler();
|
||||
wasReset = true;
|
||||
}
|
||||
return wasReset;
|
||||
}
|
||||
|
||||
private void resetToHTMLSAXHandler() {
|
||||
this.m_dtdHandled = false;
|
||||
this.m_escapeSetting = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,980 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Properties;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class ToHTMLStream extends ToStream {
|
||||
protected boolean m_inDTD = false;
|
||||
|
||||
private boolean m_inBlockElem = false;
|
||||
|
||||
private final CharInfo m_htmlcharInfo = CharInfo.getCharInfo(CharInfo.HTML_ENTITIES_RESOURCE, "html");
|
||||
|
||||
static final Trie m_elementFlags = new Trie();
|
||||
|
||||
static {
|
||||
initTagReference(m_elementFlags);
|
||||
}
|
||||
|
||||
static void initTagReference(Trie m_elementFlags) {
|
||||
m_elementFlags.put("BASEFONT", new ElemDesc(2));
|
||||
m_elementFlags.put("FRAME", new ElemDesc(10));
|
||||
m_elementFlags.put("FRAMESET", new ElemDesc(8));
|
||||
m_elementFlags.put("NOFRAMES", new ElemDesc(8));
|
||||
m_elementFlags.put("ISINDEX", new ElemDesc(10));
|
||||
m_elementFlags.put("APPLET", new ElemDesc(2097152));
|
||||
m_elementFlags.put("CENTER", new ElemDesc(8));
|
||||
m_elementFlags.put("DIR", new ElemDesc(8));
|
||||
m_elementFlags.put("MENU", new ElemDesc(8));
|
||||
m_elementFlags.put("TT", new ElemDesc(4096));
|
||||
m_elementFlags.put("I", new ElemDesc(4096));
|
||||
m_elementFlags.put("B", new ElemDesc(4096));
|
||||
m_elementFlags.put("BIG", new ElemDesc(4096));
|
||||
m_elementFlags.put("SMALL", new ElemDesc(4096));
|
||||
m_elementFlags.put("EM", new ElemDesc(8192));
|
||||
m_elementFlags.put("STRONG", new ElemDesc(8192));
|
||||
m_elementFlags.put("DFN", new ElemDesc(8192));
|
||||
m_elementFlags.put("CODE", new ElemDesc(8192));
|
||||
m_elementFlags.put("SAMP", new ElemDesc(8192));
|
||||
m_elementFlags.put("KBD", new ElemDesc(8192));
|
||||
m_elementFlags.put("VAR", new ElemDesc(8192));
|
||||
m_elementFlags.put("CITE", new ElemDesc(8192));
|
||||
m_elementFlags.put("ABBR", new ElemDesc(8192));
|
||||
m_elementFlags.put("ACRONYM", new ElemDesc(8192));
|
||||
m_elementFlags.put("SUP", new ElemDesc(98304));
|
||||
m_elementFlags.put("SUB", new ElemDesc(98304));
|
||||
m_elementFlags.put("SPAN", new ElemDesc(98304));
|
||||
m_elementFlags.put("BDO", new ElemDesc(98304));
|
||||
m_elementFlags.put("BR", new ElemDesc(98314));
|
||||
m_elementFlags.put("BODY", new ElemDesc(8));
|
||||
m_elementFlags.put("ADDRESS", new ElemDesc(56));
|
||||
m_elementFlags.put("DIV", new ElemDesc(56));
|
||||
m_elementFlags.put("A", new ElemDesc(32768));
|
||||
m_elementFlags.put("MAP", new ElemDesc(98312));
|
||||
m_elementFlags.put("AREA", new ElemDesc(10));
|
||||
m_elementFlags.put("LINK", new ElemDesc(131082));
|
||||
m_elementFlags.put("IMG", new ElemDesc(2195458));
|
||||
m_elementFlags.put("OBJECT", new ElemDesc(2326528));
|
||||
m_elementFlags.put("PARAM", new ElemDesc(2));
|
||||
m_elementFlags.put("HR", new ElemDesc(58));
|
||||
m_elementFlags.put("P", new ElemDesc(56));
|
||||
m_elementFlags.put("H1", new ElemDesc(262152));
|
||||
m_elementFlags.put("H2", new ElemDesc(262152));
|
||||
m_elementFlags.put("H3", new ElemDesc(262152));
|
||||
m_elementFlags.put("H4", new ElemDesc(262152));
|
||||
m_elementFlags.put("H5", new ElemDesc(262152));
|
||||
m_elementFlags.put("H6", new ElemDesc(262152));
|
||||
m_elementFlags.put("PRE", new ElemDesc(1048584));
|
||||
m_elementFlags.put("Q", new ElemDesc(98304));
|
||||
m_elementFlags.put("BLOCKQUOTE", new ElemDesc(56));
|
||||
m_elementFlags.put("INS", new ElemDesc(0));
|
||||
m_elementFlags.put("DEL", new ElemDesc(0));
|
||||
m_elementFlags.put("DL", new ElemDesc(56));
|
||||
m_elementFlags.put("DT", new ElemDesc(8));
|
||||
m_elementFlags.put("DD", new ElemDesc(8));
|
||||
m_elementFlags.put("OL", new ElemDesc(524296));
|
||||
m_elementFlags.put("UL", new ElemDesc(524296));
|
||||
m_elementFlags.put("LI", new ElemDesc(8));
|
||||
m_elementFlags.put("FORM", new ElemDesc(8));
|
||||
m_elementFlags.put("LABEL", new ElemDesc(16384));
|
||||
m_elementFlags.put("INPUT", new ElemDesc(18434));
|
||||
m_elementFlags.put("SELECT", new ElemDesc(18432));
|
||||
m_elementFlags.put("OPTGROUP", new ElemDesc(0));
|
||||
m_elementFlags.put("OPTION", new ElemDesc(0));
|
||||
m_elementFlags.put("TEXTAREA", new ElemDesc(18432));
|
||||
m_elementFlags.put("FIELDSET", new ElemDesc(24));
|
||||
m_elementFlags.put("LEGEND", new ElemDesc(0));
|
||||
m_elementFlags.put("BUTTON", new ElemDesc(18432));
|
||||
m_elementFlags.put("TABLE", new ElemDesc(56));
|
||||
m_elementFlags.put("CAPTION", new ElemDesc(8));
|
||||
m_elementFlags.put("THEAD", new ElemDesc(8));
|
||||
m_elementFlags.put("TFOOT", new ElemDesc(8));
|
||||
m_elementFlags.put("TBODY", new ElemDesc(8));
|
||||
m_elementFlags.put("COLGROUP", new ElemDesc(8));
|
||||
m_elementFlags.put("COL", new ElemDesc(10));
|
||||
m_elementFlags.put("TR", new ElemDesc(8));
|
||||
m_elementFlags.put("TH", new ElemDesc(0));
|
||||
m_elementFlags.put("TD", new ElemDesc(0));
|
||||
m_elementFlags.put("HEAD", new ElemDesc(4194312));
|
||||
m_elementFlags.put("TITLE", new ElemDesc(8));
|
||||
m_elementFlags.put("BASE", new ElemDesc(10));
|
||||
m_elementFlags.put("META", new ElemDesc(131082));
|
||||
m_elementFlags.put("STYLE", new ElemDesc(131336));
|
||||
m_elementFlags.put("SCRIPT", new ElemDesc(229632));
|
||||
m_elementFlags.put("NOSCRIPT", new ElemDesc(56));
|
||||
m_elementFlags.put("HTML", new ElemDesc(8388616));
|
||||
m_elementFlags.put("FONT", new ElemDesc(4096));
|
||||
m_elementFlags.put("S", new ElemDesc(4096));
|
||||
m_elementFlags.put("STRIKE", new ElemDesc(4096));
|
||||
m_elementFlags.put("U", new ElemDesc(4096));
|
||||
m_elementFlags.put("NOBR", new ElemDesc(4096));
|
||||
m_elementFlags.put("IFRAME", new ElemDesc(56));
|
||||
m_elementFlags.put("LAYER", new ElemDesc(56));
|
||||
m_elementFlags.put("ILAYER", new ElemDesc(56));
|
||||
ElemDesc elemDesc = (ElemDesc)m_elementFlags.get("a");
|
||||
elemDesc.setAttr("HREF", 2);
|
||||
elemDesc.setAttr("NAME", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("area");
|
||||
elemDesc.setAttr("HREF", 2);
|
||||
elemDesc.setAttr("NOHREF", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("base");
|
||||
elemDesc.setAttr("HREF", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("button");
|
||||
elemDesc.setAttr("DISABLED", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("blockquote");
|
||||
elemDesc.setAttr("CITE", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("del");
|
||||
elemDesc.setAttr("CITE", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("dir");
|
||||
elemDesc.setAttr("COMPACT", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("div");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc.setAttr("NOWRAP", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("dl");
|
||||
elemDesc.setAttr("COMPACT", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("form");
|
||||
elemDesc.setAttr("ACTION", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("frame");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc.setAttr("LONGDESC", 2);
|
||||
elemDesc.setAttr("NORESIZE", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("head");
|
||||
elemDesc.setAttr("PROFILE", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("hr");
|
||||
elemDesc.setAttr("NOSHADE", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("iframe");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc.setAttr("LONGDESC", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("ilayer");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("img");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc.setAttr("LONGDESC", 2);
|
||||
elemDesc.setAttr("USEMAP", 2);
|
||||
elemDesc.setAttr("ISMAP", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("input");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc.setAttr("USEMAP", 2);
|
||||
elemDesc.setAttr("CHECKED", 4);
|
||||
elemDesc.setAttr("DISABLED", 4);
|
||||
elemDesc.setAttr("ISMAP", 4);
|
||||
elemDesc.setAttr("READONLY", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("ins");
|
||||
elemDesc.setAttr("CITE", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("layer");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("link");
|
||||
elemDesc.setAttr("HREF", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("menu");
|
||||
elemDesc.setAttr("COMPACT", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("object");
|
||||
elemDesc.setAttr("CLASSID", 2);
|
||||
elemDesc.setAttr("CODEBASE", 2);
|
||||
elemDesc.setAttr("DATA", 2);
|
||||
elemDesc.setAttr("ARCHIVE", 2);
|
||||
elemDesc.setAttr("USEMAP", 2);
|
||||
elemDesc.setAttr("DECLARE", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("ol");
|
||||
elemDesc.setAttr("COMPACT", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("optgroup");
|
||||
elemDesc.setAttr("DISABLED", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("option");
|
||||
elemDesc.setAttr("SELECTED", 4);
|
||||
elemDesc.setAttr("DISABLED", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("q");
|
||||
elemDesc.setAttr("CITE", 2);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("script");
|
||||
elemDesc.setAttr("SRC", 2);
|
||||
elemDesc.setAttr("FOR", 2);
|
||||
elemDesc.setAttr("DEFER", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("select");
|
||||
elemDesc.setAttr("DISABLED", 4);
|
||||
elemDesc.setAttr("MULTIPLE", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("table");
|
||||
elemDesc.setAttr("NOWRAP", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("td");
|
||||
elemDesc.setAttr("NOWRAP", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("textarea");
|
||||
elemDesc.setAttr("DISABLED", 4);
|
||||
elemDesc.setAttr("READONLY", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("th");
|
||||
elemDesc.setAttr("NOWRAP", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("tr");
|
||||
elemDesc.setAttr("NOWRAP", 4);
|
||||
elemDesc = (ElemDesc)m_elementFlags.get("ul");
|
||||
elemDesc.setAttr("COMPACT", 4);
|
||||
}
|
||||
|
||||
private static final ElemDesc m_dummy = new ElemDesc(8);
|
||||
|
||||
private boolean m_specialEscapeURLs = true;
|
||||
|
||||
private boolean m_omitMetaTag = false;
|
||||
|
||||
public void setSpecialEscapeURLs(boolean bool) {
|
||||
this.m_specialEscapeURLs = bool;
|
||||
}
|
||||
|
||||
public void setOmitMetaTag(boolean bool) {
|
||||
this.m_omitMetaTag = bool;
|
||||
}
|
||||
|
||||
public void setOutputFormat(Properties format) {
|
||||
String value = format.getProperty("{http://xml.apache.org/xalan}use-url-escaping");
|
||||
if (value != null)
|
||||
this.m_specialEscapeURLs = OutputPropertyUtils.getBooleanProperty("{http://xml.apache.org/xalan}use-url-escaping", format);
|
||||
value = format.getProperty("{http://xml.apache.org/xalan}omit-meta-tag");
|
||||
if (value != null)
|
||||
this.m_omitMetaTag = OutputPropertyUtils.getBooleanProperty("{http://xml.apache.org/xalan}omit-meta-tag", format);
|
||||
super.setOutputFormat(format);
|
||||
}
|
||||
|
||||
private final boolean getSpecialEscapeURLs() {
|
||||
return this.m_specialEscapeURLs;
|
||||
}
|
||||
|
||||
private final boolean getOmitMetaTag() {
|
||||
return this.m_omitMetaTag;
|
||||
}
|
||||
|
||||
public static final ElemDesc getElemDesc(String name) {
|
||||
Object obj = m_elementFlags.get(name);
|
||||
if (null != obj)
|
||||
return (ElemDesc)obj;
|
||||
return m_dummy;
|
||||
}
|
||||
|
||||
private Trie m_htmlInfo = new Trie(m_elementFlags);
|
||||
|
||||
private ElemDesc getElemDesc2(String name) {
|
||||
Object obj = this.m_htmlInfo.get2(name);
|
||||
if (null != obj)
|
||||
return (ElemDesc)obj;
|
||||
return m_dummy;
|
||||
}
|
||||
|
||||
public ToHTMLStream() {
|
||||
this.m_doIndent = true;
|
||||
this.m_charInfo = this.m_htmlcharInfo;
|
||||
this.m_prefixMap = new NamespaceMappings();
|
||||
}
|
||||
|
||||
protected void startDocumentInternal() throws SAXException {
|
||||
super.startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
this.m_needToOutputDocTypeDecl = true;
|
||||
this.m_startNewLine = false;
|
||||
setOmitXMLDeclaration(true);
|
||||
}
|
||||
|
||||
private void outputDocTypeDecl(String name) throws SAXException {
|
||||
if (true == this.m_needToOutputDocTypeDecl) {
|
||||
String doctypeSystem = getDoctypeSystem();
|
||||
String doctypePublic = getDoctypePublic();
|
||||
if (null != doctypeSystem || null != doctypePublic) {
|
||||
Writer writer = this.m_writer;
|
||||
try {
|
||||
writer.write("<!DOCTYPE ");
|
||||
writer.write(name);
|
||||
if (null != doctypePublic) {
|
||||
writer.write(" PUBLIC \"");
|
||||
writer.write(doctypePublic);
|
||||
writer.write(34);
|
||||
}
|
||||
if (null != doctypeSystem) {
|
||||
if (null == doctypePublic) {
|
||||
writer.write(" SYSTEM \"");
|
||||
} else {
|
||||
writer.write(" \"");
|
||||
}
|
||||
writer.write(doctypeSystem);
|
||||
writer.write(34);
|
||||
}
|
||||
writer.write(62);
|
||||
outputLineSep();
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.m_needToOutputDocTypeDecl = false;
|
||||
}
|
||||
|
||||
public final void endDocument() throws SAXException {
|
||||
flushPending();
|
||||
if (this.m_doIndent && !this.m_isprevtext)
|
||||
try {
|
||||
outputLineSep();
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
flushWriter();
|
||||
if (this.m_tracer != null)
|
||||
fireEndDoc();
|
||||
}
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String name, Attributes atts) throws SAXException {
|
||||
ElemContext elemContext = this.m_elemContext;
|
||||
if (elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
elemContext.m_startTagOpen = false;
|
||||
} else if (this.m_cdataTagOpen) {
|
||||
closeCDATA();
|
||||
this.m_cdataTagOpen = false;
|
||||
} else if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
if (this.m_needToOutputDocTypeDecl) {
|
||||
String n = name;
|
||||
if (n == null || n.length() == 0)
|
||||
n = localName;
|
||||
outputDocTypeDecl(n);
|
||||
}
|
||||
if (null != namespaceURI && namespaceURI.length() > 0) {
|
||||
super.startElement(namespaceURI, localName, name, atts);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ElemDesc elemDesc = getElemDesc2(name);
|
||||
int elemFlags = elemDesc.getFlags();
|
||||
if (this.m_doIndent) {
|
||||
boolean isBlockElement = ((elemFlags & 0x8) != 0);
|
||||
if (this.m_ispreserve) {
|
||||
this.m_ispreserve = false;
|
||||
} else if (null != elemContext.m_elementName && (!this.m_inBlockElem || isBlockElement)) {
|
||||
this.m_startNewLine = true;
|
||||
indent();
|
||||
}
|
||||
this.m_inBlockElem = !isBlockElement;
|
||||
}
|
||||
if (atts != null)
|
||||
addAttributes(atts);
|
||||
this.m_isprevtext = false;
|
||||
Writer writer = this.m_writer;
|
||||
writer.write(60);
|
||||
writer.write(name);
|
||||
if (this.m_tracer != null)
|
||||
firePseudoAttributes();
|
||||
if ((elemFlags & 0x2) != 0) {
|
||||
this.m_elemContext = elemContext.push();
|
||||
this.m_elemContext.m_elementName = name;
|
||||
this.m_elemContext.m_elementDesc = elemDesc;
|
||||
return;
|
||||
}
|
||||
elemContext = elemContext.push(namespaceURI, localName, name);
|
||||
this.m_elemContext = elemContext;
|
||||
elemContext.m_elementDesc = elemDesc;
|
||||
elemContext.m_isRaw = ((elemFlags & 0x100) != 0);
|
||||
if ((elemFlags & 0x400000) != 0) {
|
||||
closeStartTag();
|
||||
elemContext.m_startTagOpen = false;
|
||||
if (!this.m_omitMetaTag) {
|
||||
if (this.m_doIndent)
|
||||
indent();
|
||||
writer.write("<META http-equiv=\"Content-Type\" content=\"text/html; charset=");
|
||||
String encoding = getEncoding();
|
||||
String encode = Encodings.getMimeEncoding(encoding);
|
||||
writer.write(encode);
|
||||
writer.write("\">");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public final void endElement(String namespaceURI, String localName, String name) throws SAXException {
|
||||
if (this.m_cdataTagOpen)
|
||||
closeCDATA();
|
||||
if (null != namespaceURI && namespaceURI.length() > 0) {
|
||||
super.endElement(namespaceURI, localName, name);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ElemContext elemContext = this.m_elemContext;
|
||||
ElemDesc elemDesc = elemContext.m_elementDesc;
|
||||
int elemFlags = elemDesc.getFlags();
|
||||
boolean elemEmpty = ((elemFlags & 0x2) != 0);
|
||||
if (this.m_doIndent) {
|
||||
boolean isBlockElement = ((elemFlags & 0x8) != 0);
|
||||
boolean shouldIndent = false;
|
||||
if (this.m_ispreserve) {
|
||||
this.m_ispreserve = false;
|
||||
} else if (this.m_doIndent && (!this.m_inBlockElem || isBlockElement)) {
|
||||
this.m_startNewLine = true;
|
||||
shouldIndent = true;
|
||||
}
|
||||
if (!elemContext.m_startTagOpen && shouldIndent)
|
||||
indent(elemContext.m_currentElemDepth - 1);
|
||||
this.m_inBlockElem = !isBlockElement;
|
||||
}
|
||||
Writer writer = this.m_writer;
|
||||
if (!elemContext.m_startTagOpen) {
|
||||
writer.write("</");
|
||||
writer.write(name);
|
||||
writer.write(62);
|
||||
} else {
|
||||
if (this.m_tracer != null)
|
||||
fireStartElem(name);
|
||||
int nAttrs = this.m_attributes.getLength();
|
||||
if (nAttrs > 0) {
|
||||
processAttributes(this.m_writer, nAttrs);
|
||||
this.m_attributes.clear();
|
||||
}
|
||||
if (!elemEmpty) {
|
||||
writer.write("></");
|
||||
writer.write(name);
|
||||
writer.write(62);
|
||||
} else {
|
||||
writer.write(62);
|
||||
}
|
||||
}
|
||||
if ((elemFlags & 0x200000) != 0)
|
||||
this.m_ispreserve = true;
|
||||
this.m_isprevtext = false;
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(name);
|
||||
if (elemEmpty) {
|
||||
this.m_elemContext = elemContext.m_prev;
|
||||
return;
|
||||
}
|
||||
if (!elemContext.m_startTagOpen)
|
||||
if (this.m_doIndent && !this.m_preserves.isEmpty())
|
||||
this.m_preserves.pop();
|
||||
this.m_elemContext = elemContext.m_prev;
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processAttribute(Writer writer, String name, String value, ElemDesc elemDesc) throws IOException {
|
||||
writer.write(32);
|
||||
if ((value.length() == 0 || value.equalsIgnoreCase(name)) && elemDesc != null && elemDesc.isAttrFlagSet(name, 4)) {
|
||||
writer.write(name);
|
||||
} else {
|
||||
writer.write(name);
|
||||
writer.write("=\"");
|
||||
if (elemDesc != null && elemDesc.isAttrFlagSet(name, 2)) {
|
||||
writeAttrURI(writer, value, this.m_specialEscapeURLs);
|
||||
} else {
|
||||
writeAttrString(writer, value, getEncoding());
|
||||
}
|
||||
writer.write(34);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isASCIIDigit(char c) {
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
private static String makeHHString(int i) {
|
||||
String s = Integer.toHexString(i).toUpperCase();
|
||||
if (s.length() == 1)
|
||||
s = "0" + s;
|
||||
return s;
|
||||
}
|
||||
|
||||
private boolean isHHSign(String str) {
|
||||
boolean sign = true;
|
||||
try {
|
||||
char r = (char)Integer.parseInt(str, 16);
|
||||
} catch (NumberFormatException e) {
|
||||
sign = false;
|
||||
}
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void writeAttrURI(Writer writer, String string, boolean doURLEscaping) throws IOException {
|
||||
int end = string.length();
|
||||
if (end > this.m_attrBuff.length)
|
||||
this.m_attrBuff = new char[end * 2 + 1];
|
||||
string.getChars(0, end, this.m_attrBuff, 0);
|
||||
char[] chars = this.m_attrBuff;
|
||||
int cleanStart = 0;
|
||||
int cleanLength = 0;
|
||||
char ch = '\000';
|
||||
for (int i = 0; i < end; i++) {
|
||||
ch = chars[i];
|
||||
if (ch < ' ' || ch > '~') {
|
||||
if (cleanLength > 0) {
|
||||
writer.write(chars, cleanStart, cleanLength);
|
||||
cleanLength = 0;
|
||||
}
|
||||
if (doURLEscaping) {
|
||||
if (ch <= '\u007F') {
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(ch));
|
||||
} else if (ch <= '߿') {
|
||||
int high = ch >> 6 | 0xC0;
|
||||
int low = ch & 0x3F | 0x80;
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(high));
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(low));
|
||||
} else if (Encodings.isHighUTF16Surrogate(ch)) {
|
||||
int highSurrogate = ch & 0x3FF;
|
||||
int wwww = (highSurrogate & 0x3C0) >> 6;
|
||||
int uuuuu = wwww + 1;
|
||||
int zzzz = (highSurrogate & 0x3C) >> 2;
|
||||
int yyyyyy = (highSurrogate & 0x3) << 4 & 0x30;
|
||||
ch = chars[++i];
|
||||
int lowSurrogate = ch & 0x3FF;
|
||||
yyyyyy |= (lowSurrogate & 0x3C0) >> 6;
|
||||
int xxxxxx = lowSurrogate & 0x3F;
|
||||
int byte1 = 0xF0 | uuuuu >> 2;
|
||||
int byte2 = 0x80 | (uuuuu & 0x3) << 4 & 0x30 | zzzz;
|
||||
int byte3 = 0x80 | yyyyyy;
|
||||
int byte4 = 0x80 | xxxxxx;
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(byte1));
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(byte2));
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(byte3));
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(byte4));
|
||||
} else {
|
||||
int high = ch >> 12 | 0xE0;
|
||||
int middle = (ch & 0xFC0) >> 6 | 0x80;
|
||||
int low = ch & 0x3F | 0x80;
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(high));
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(middle));
|
||||
writer.write(37);
|
||||
writer.write(makeHHString(low));
|
||||
}
|
||||
} else if (escapingNotNeeded(ch)) {
|
||||
writer.write(ch);
|
||||
} else {
|
||||
writer.write("&#");
|
||||
writer.write(Integer.toString(ch));
|
||||
writer.write(59);
|
||||
}
|
||||
cleanStart = i + 1;
|
||||
} else if (ch == '"') {
|
||||
if (cleanLength > 0) {
|
||||
writer.write(chars, cleanStart, cleanLength);
|
||||
cleanLength = 0;
|
||||
}
|
||||
if (doURLEscaping) {
|
||||
writer.write("%22");
|
||||
} else {
|
||||
writer.write(""");
|
||||
}
|
||||
cleanStart = i + 1;
|
||||
} else if (ch == '&') {
|
||||
if (cleanLength > 0) {
|
||||
writer.write(chars, cleanStart, cleanLength);
|
||||
cleanLength = 0;
|
||||
}
|
||||
writer.write("&");
|
||||
cleanStart = i + 1;
|
||||
} else {
|
||||
cleanLength++;
|
||||
}
|
||||
}
|
||||
if (cleanLength > 1) {
|
||||
if (cleanStart == 0) {
|
||||
writer.write(string);
|
||||
} else {
|
||||
writer.write(chars, cleanStart, cleanLength);
|
||||
}
|
||||
} else if (cleanLength == 1) {
|
||||
writer.write(ch);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeAttrString(Writer writer, String string, String encoding) throws IOException {
|
||||
int end = string.length();
|
||||
if (end > this.m_attrBuff.length)
|
||||
this.m_attrBuff = new char[end * 2 + 1];
|
||||
string.getChars(0, end, this.m_attrBuff, 0);
|
||||
char[] chars = this.m_attrBuff;
|
||||
int cleanStart = 0;
|
||||
int cleanLength = 0;
|
||||
char ch = '\000';
|
||||
for (int i = 0; i < end; i++) {
|
||||
ch = chars[i];
|
||||
if (escapingNotNeeded(ch) && !this.m_charInfo.shouldMapAttrChar(ch)) {
|
||||
cleanLength++;
|
||||
} else if ('<' == ch || '>' == ch) {
|
||||
cleanLength++;
|
||||
} else if ('&' == ch && i + 1 < end && '{' == chars[i + 1]) {
|
||||
cleanLength++;
|
||||
} else {
|
||||
if (cleanLength > 0) {
|
||||
writer.write(chars, cleanStart, cleanLength);
|
||||
cleanLength = 0;
|
||||
}
|
||||
int pos = accumDefaultEntity(writer, ch, i, chars, end, false, true);
|
||||
if (i != pos) {
|
||||
i = pos - 1;
|
||||
} else {
|
||||
if (Encodings.isHighUTF16Surrogate(ch)) {
|
||||
writeUTF16Surrogate(ch, chars, i, end);
|
||||
i++;
|
||||
}
|
||||
String outputStringForChar = this.m_charInfo.getOutputStringForChar(ch);
|
||||
if (null != outputStringForChar) {
|
||||
writer.write(outputStringForChar);
|
||||
} else if (escapingNotNeeded(ch)) {
|
||||
writer.write(ch);
|
||||
} else {
|
||||
writer.write("&#");
|
||||
writer.write(Integer.toString(ch));
|
||||
writer.write(59);
|
||||
}
|
||||
}
|
||||
cleanStart = i + 1;
|
||||
}
|
||||
}
|
||||
if (cleanLength > 1) {
|
||||
if (cleanStart == 0) {
|
||||
writer.write(string);
|
||||
} else {
|
||||
writer.write(chars, cleanStart, cleanLength);
|
||||
}
|
||||
} else if (cleanLength == 1) {
|
||||
writer.write(ch);
|
||||
}
|
||||
}
|
||||
|
||||
public final void characters(char[] chars, int start, int length) throws SAXException {
|
||||
if (this.m_elemContext.m_isRaw)
|
||||
try {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
this.m_ispreserve = true;
|
||||
writeNormalizedChars(chars, start, length, false, this.m_lineSepUse);
|
||||
if (this.m_tracer != null)
|
||||
fireCharEvent(chars, start, length);
|
||||
return;
|
||||
} catch (IOException ioe) {
|
||||
throw new SAXException(Utils.messages.createMessage("ER_OIERROR", null), ioe);
|
||||
}
|
||||
super.characters(chars, start, length);
|
||||
}
|
||||
|
||||
public final void cdata(char[] ch, int start, int length) throws SAXException {
|
||||
if (null != this.m_elemContext.m_elementName && (this.m_elemContext.m_elementName.equalsIgnoreCase("SCRIPT") || this.m_elemContext.m_elementName.equalsIgnoreCase("STYLE"))) {
|
||||
try {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
this.m_ispreserve = true;
|
||||
if (shouldIndent())
|
||||
indent();
|
||||
writeNormalizedChars(ch, start, length, true, this.m_lineSepUse);
|
||||
} catch (IOException ioe) {
|
||||
throw new SAXException(Utils.messages.createMessage("ER_OIERROR", null), ioe);
|
||||
}
|
||||
} else {
|
||||
super.cdata(ch, start, length);
|
||||
}
|
||||
}
|
||||
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
flushPending();
|
||||
if (target.equals("javax.xml.transform.disable-output-escaping")) {
|
||||
startNonEscaping();
|
||||
} else if (target.equals("javax.xml.transform.enable-output-escaping")) {
|
||||
endNonEscaping();
|
||||
} else {
|
||||
try {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
} else if (this.m_cdataTagOpen) {
|
||||
closeCDATA();
|
||||
} else if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
}
|
||||
if (true == this.m_needToOutputDocTypeDecl)
|
||||
outputDocTypeDecl("html");
|
||||
if (shouldIndent())
|
||||
indent();
|
||||
Writer writer = this.m_writer;
|
||||
writer.write("<?");
|
||||
writer.write(target);
|
||||
if (data.length() > 0 && !Character.isSpaceChar(data.charAt(0)))
|
||||
writer.write(32);
|
||||
writer.write(data);
|
||||
writer.write(62);
|
||||
if (this.m_elemContext.m_currentElemDepth <= 0)
|
||||
outputLineSep();
|
||||
this.m_startNewLine = true;
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
if (this.m_tracer != null)
|
||||
fireEscapingEvent(target, data);
|
||||
}
|
||||
|
||||
public final void entityReference(String name) throws SAXException {
|
||||
try {
|
||||
Writer writer = this.m_writer;
|
||||
writer.write(38);
|
||||
writer.write(name);
|
||||
writer.write(59);
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public final void endElement(String elemName) throws SAXException {
|
||||
endElement(null, null, elemName);
|
||||
}
|
||||
|
||||
public void processAttributes(Writer writer, int nAttrs) throws IOException, SAXException {
|
||||
for (int i = 0; i < nAttrs; i++)
|
||||
processAttribute(writer, this.m_attributes.getQName(i), this.m_attributes.getValue(i), this.m_elemContext.m_elementDesc);
|
||||
}
|
||||
|
||||
protected void closeStartTag() throws SAXException {
|
||||
try {
|
||||
if (this.m_tracer != null)
|
||||
fireStartElem(this.m_elemContext.m_elementName);
|
||||
int nAttrs = this.m_attributes.getLength();
|
||||
if (nAttrs > 0) {
|
||||
processAttributes(this.m_writer, nAttrs);
|
||||
this.m_attributes.clear();
|
||||
}
|
||||
this.m_writer.write(62);
|
||||
if (this.m_CdataElems != null)
|
||||
this.m_elemContext.m_isCdataSection = isCdataSection();
|
||||
if (this.m_doIndent) {
|
||||
this.m_isprevtext = false;
|
||||
this.m_preserves.push(this.m_ispreserve);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException {
|
||||
if (this.m_elemContext.m_elementURI == null) {
|
||||
String prefix1 = SerializerBase.getPrefixPart(this.m_elemContext.m_elementName);
|
||||
if (prefix1 == null && "".equals(prefix))
|
||||
this.m_elemContext.m_elementURI = uri;
|
||||
}
|
||||
startPrefixMapping(prefix, uri, false);
|
||||
}
|
||||
|
||||
public void startDTD(String name, String publicId, String systemId) throws SAXException {
|
||||
this.m_inDTD = true;
|
||||
super.startDTD(name, publicId, systemId);
|
||||
}
|
||||
|
||||
public void endDTD() throws SAXException {
|
||||
this.m_inDTD = false;
|
||||
}
|
||||
|
||||
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException {}
|
||||
|
||||
public void elementDecl(String name, String model) throws SAXException {}
|
||||
|
||||
public void internalEntityDecl(String name, String value) throws SAXException {}
|
||||
|
||||
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException {}
|
||||
|
||||
public void addUniqueAttribute(String name, String value, int flags) throws SAXException {
|
||||
try {
|
||||
Writer writer = this.m_writer;
|
||||
if ((flags & 0x1) > 0 && this.m_htmlcharInfo.onlyQuotAmpLtGt) {
|
||||
writer.write(32);
|
||||
writer.write(name);
|
||||
writer.write("=\"");
|
||||
writer.write(value);
|
||||
writer.write(34);
|
||||
} else if ((flags & 0x2) > 0 && (value.length() == 0 || value.equalsIgnoreCase(name))) {
|
||||
writer.write(32);
|
||||
writer.write(name);
|
||||
} else {
|
||||
writer.write(32);
|
||||
writer.write(name);
|
||||
writer.write("=\"");
|
||||
if ((flags & 0x4) > 0) {
|
||||
writeAttrURI(writer, value, this.m_specialEscapeURLs);
|
||||
} else {
|
||||
writeAttrString(writer, value, getEncoding());
|
||||
}
|
||||
writer.write(34);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void comment(char[] ch, int start, int length) throws SAXException {
|
||||
if (this.m_inDTD)
|
||||
return;
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
} else if (this.m_cdataTagOpen) {
|
||||
closeCDATA();
|
||||
} else if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
}
|
||||
if (this.m_needToOutputDocTypeDecl)
|
||||
outputDocTypeDecl("html");
|
||||
super.comment(ch, start, length);
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
boolean ret = super.reset();
|
||||
if (!ret)
|
||||
return false;
|
||||
resetToHTMLStream();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void resetToHTMLStream() {
|
||||
this.m_inBlockElem = false;
|
||||
this.m_inDTD = false;
|
||||
this.m_omitMetaTag = false;
|
||||
this.m_specialEscapeURLs = true;
|
||||
}
|
||||
|
||||
static class Trie {
|
||||
public static final int ALPHA_SIZE = 128;
|
||||
|
||||
final Node m_Root;
|
||||
|
||||
private char[] m_charBuffer = new char[0];
|
||||
|
||||
private final boolean m_lowerCaseOnly;
|
||||
|
||||
public Trie() {
|
||||
this.m_Root = new Node(this);
|
||||
this.m_lowerCaseOnly = false;
|
||||
}
|
||||
|
||||
public Trie(boolean lowerCaseOnly) {
|
||||
this.m_Root = new Node(this);
|
||||
this.m_lowerCaseOnly = lowerCaseOnly;
|
||||
}
|
||||
|
||||
public Object put(String key, Object value) {
|
||||
int len = key.length();
|
||||
if (len > this.m_charBuffer.length)
|
||||
this.m_charBuffer = new char[len];
|
||||
Node node = this.m_Root;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Node nextNode = node.m_nextChar[Character.toLowerCase(key.charAt(i))];
|
||||
if (nextNode != null) {
|
||||
node = nextNode;
|
||||
} else {
|
||||
for (; i < len; i++) {
|
||||
Node newNode = new Node(this);
|
||||
if (this.m_lowerCaseOnly) {
|
||||
node.m_nextChar[Character.toLowerCase(key.charAt(i))] = newNode;
|
||||
} else {
|
||||
node.m_nextChar[Character.toUpperCase(key.charAt(i))] = newNode;
|
||||
node.m_nextChar[Character.toLowerCase(key.charAt(i))] = newNode;
|
||||
}
|
||||
node = newNode;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Object ret = node.m_Value;
|
||||
node.m_Value = value;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Object get(String key) {
|
||||
char ch;
|
||||
int len = key.length();
|
||||
if (this.m_charBuffer.length < len)
|
||||
return null;
|
||||
Node node = this.m_Root;
|
||||
switch (len) {
|
||||
case 0:
|
||||
return null;
|
||||
case 1:
|
||||
ch = key.charAt(0);
|
||||
if (ch < '\u0080') {
|
||||
node = node.m_nextChar[ch];
|
||||
if (node != null)
|
||||
return node.m_Value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < len; i++) {
|
||||
char c = key.charAt(i);
|
||||
if ('\u0080' <= c)
|
||||
return null;
|
||||
node = node.m_nextChar[c];
|
||||
if (node == null)
|
||||
return null;
|
||||
}
|
||||
return node.m_Value;
|
||||
}
|
||||
|
||||
private class Node {
|
||||
final Node[] m_nextChar;
|
||||
|
||||
Object m_Value;
|
||||
|
||||
private final ToHTMLStream.Trie this$0;
|
||||
|
||||
Node(ToHTMLStream.Trie this$0) {
|
||||
this.this$0 = this$0;
|
||||
this.m_nextChar = new Node[128];
|
||||
this.m_Value = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Trie(Trie existingTrie) {
|
||||
this.m_Root = existingTrie.m_Root;
|
||||
this.m_lowerCaseOnly = existingTrie.m_lowerCaseOnly;
|
||||
int max = existingTrie.getLongestKeyLength();
|
||||
this.m_charBuffer = new char[max];
|
||||
}
|
||||
|
||||
public Object get2(String key) {
|
||||
char ch;
|
||||
int len = key.length();
|
||||
if (this.m_charBuffer.length < len)
|
||||
return null;
|
||||
Node node = this.m_Root;
|
||||
switch (len) {
|
||||
case 0:
|
||||
return null;
|
||||
case 1:
|
||||
ch = key.charAt(0);
|
||||
if (ch < '\u0080') {
|
||||
node = node.m_nextChar[ch];
|
||||
if (node != null)
|
||||
return node.m_Value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
key.getChars(0, len, this.m_charBuffer, 0);
|
||||
for (int i = 0; i < len; i++) {
|
||||
char c = this.m_charBuffer[i];
|
||||
if ('\u0080' <= c)
|
||||
return null;
|
||||
node = node.m_nextChar[c];
|
||||
if (node == null)
|
||||
return null;
|
||||
}
|
||||
return node.m_Value;
|
||||
}
|
||||
|
||||
public int getLongestKeyLength() {
|
||||
return this.m_charBuffer.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.util.Vector;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public abstract class ToSAXHandler extends SerializerBase {
|
||||
protected ContentHandler m_saxHandler;
|
||||
|
||||
protected LexicalHandler m_lexHandler;
|
||||
|
||||
public ToSAXHandler() {}
|
||||
|
||||
public ToSAXHandler(ContentHandler hdlr, LexicalHandler lex, String encoding) {
|
||||
setContentHandler(hdlr);
|
||||
setLexHandler(lex);
|
||||
setEncoding(encoding);
|
||||
}
|
||||
|
||||
public ToSAXHandler(ContentHandler handler, String encoding) {
|
||||
setContentHandler(handler);
|
||||
setEncoding(encoding);
|
||||
}
|
||||
|
||||
private boolean m_shouldGenerateNSAttribute = true;
|
||||
|
||||
protected TransformStateSetter m_state = null;
|
||||
|
||||
protected void startDocumentInternal() throws SAXException {
|
||||
if (this.m_needToCallStartDocument) {
|
||||
super.startDocumentInternal();
|
||||
this.m_saxHandler.startDocument();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void startDTD(String arg0, String arg1, String arg2) throws SAXException {}
|
||||
|
||||
public void characters(String characters) throws SAXException {
|
||||
int len = characters.length();
|
||||
if (len > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[len * 2 + 1];
|
||||
characters.getChars(0, len, this.m_charsBuff, 0);
|
||||
characters(this.m_charsBuff, 0, len);
|
||||
}
|
||||
|
||||
public void comment(String comment) throws SAXException {
|
||||
flushPending();
|
||||
if (this.m_lexHandler != null) {
|
||||
int len = comment.length();
|
||||
if (len > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[len * 2 + 1];
|
||||
comment.getChars(0, len, this.m_charsBuff, 0);
|
||||
this.m_lexHandler.comment(this.m_charsBuff, 0, len);
|
||||
if (this.m_tracer != null)
|
||||
fireCommentEvent(this.m_charsBuff, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
public void processingInstruction(String target, String data) throws SAXException {}
|
||||
|
||||
protected void closeStartTag() throws SAXException {}
|
||||
|
||||
protected void closeCDATA() throws SAXException {}
|
||||
|
||||
public void startElement(String arg0, String arg1, String arg2, Attributes arg3) throws SAXException {
|
||||
if (this.m_state != null)
|
||||
this.m_state.resetState(getTransformer());
|
||||
if (this.m_tracer != null)
|
||||
fireStartElem(arg2);
|
||||
}
|
||||
|
||||
public void setLexHandler(LexicalHandler _lexHandler) {
|
||||
this.m_lexHandler = _lexHandler;
|
||||
}
|
||||
|
||||
public void setContentHandler(ContentHandler _saxHandler) {
|
||||
this.m_saxHandler = _saxHandler;
|
||||
if (this.m_lexHandler == null && _saxHandler instanceof LexicalHandler)
|
||||
this.m_lexHandler = (LexicalHandler)_saxHandler;
|
||||
}
|
||||
|
||||
public void setCdataSectionElements(Vector URI_and_localNames) {}
|
||||
|
||||
public void setShouldOutputNSAttr(boolean doOutputNSAttr) {
|
||||
this.m_shouldGenerateNSAttribute = doOutputNSAttr;
|
||||
}
|
||||
|
||||
boolean getShouldOutputNSAttr() {
|
||||
return this.m_shouldGenerateNSAttribute;
|
||||
}
|
||||
|
||||
public void flushPending() throws SAXException {
|
||||
if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
if (this.m_cdataTagOpen) {
|
||||
closeCDATA();
|
||||
this.m_cdataTagOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTransformState(TransformStateSetter ts) {
|
||||
this.m_state = ts;
|
||||
}
|
||||
|
||||
public void startElement(String uri, String localName, String qName) throws SAXException {
|
||||
if (this.m_state != null)
|
||||
this.m_state.resetState(getTransformer());
|
||||
if (this.m_tracer != null)
|
||||
fireStartElem(qName);
|
||||
}
|
||||
|
||||
public void startElement(String qName) throws SAXException {
|
||||
if (this.m_state != null)
|
||||
this.m_state.resetState(getTransformer());
|
||||
if (this.m_tracer != null)
|
||||
fireStartElem(qName);
|
||||
}
|
||||
|
||||
public void characters(Node node) throws SAXException {
|
||||
if (this.m_state != null)
|
||||
this.m_state.setCurrentNode(node);
|
||||
String data = node.getNodeValue();
|
||||
if (data != null)
|
||||
characters(data);
|
||||
}
|
||||
|
||||
public void fatalError(SAXParseException exc) throws SAXException {
|
||||
super.fatalError(exc);
|
||||
this.m_needToCallStartDocument = false;
|
||||
if (this.m_saxHandler instanceof ErrorHandler)
|
||||
((ErrorHandler)this.m_saxHandler).fatalError(exc);
|
||||
}
|
||||
|
||||
public void error(SAXParseException exc) throws SAXException {
|
||||
super.error(exc);
|
||||
if (this.m_saxHandler instanceof ErrorHandler)
|
||||
((ErrorHandler)this.m_saxHandler).error(exc);
|
||||
}
|
||||
|
||||
public void warning(SAXParseException exc) throws SAXException {
|
||||
super.warning(exc);
|
||||
if (this.m_saxHandler instanceof ErrorHandler)
|
||||
((ErrorHandler)this.m_saxHandler).warning(exc);
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
boolean wasReset = false;
|
||||
if (super.reset()) {
|
||||
resetToSAXHandler();
|
||||
wasReset = true;
|
||||
}
|
||||
return wasReset;
|
||||
}
|
||||
|
||||
private void resetToSAXHandler() {
|
||||
this.m_lexHandler = null;
|
||||
this.m_saxHandler = null;
|
||||
this.m_state = null;
|
||||
this.m_shouldGenerateNSAttribute = false;
|
||||
}
|
||||
|
||||
public void addUniqueAttribute(String qName, String value, int flags) throws SAXException {
|
||||
addAttribute(qName, value);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,152 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.Properties;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public final class ToTextSAXHandler extends ToSAXHandler {
|
||||
public void endElement(String elemName) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(elemName);
|
||||
}
|
||||
|
||||
public void endElement(String arg0, String arg1, String arg2) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(arg2);
|
||||
}
|
||||
|
||||
public ToTextSAXHandler(ContentHandler hdlr, LexicalHandler lex, String encoding) {
|
||||
super(hdlr, lex, encoding);
|
||||
}
|
||||
|
||||
public ToTextSAXHandler(ContentHandler handler, String encoding) {
|
||||
super(handler, encoding);
|
||||
}
|
||||
|
||||
public void comment(char[] ch, int start, int length) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireCommentEvent(ch, start, length);
|
||||
}
|
||||
|
||||
public void comment(String data) throws SAXException {
|
||||
int length = data.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
data.getChars(0, length, this.m_charsBuff, 0);
|
||||
comment(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
public Properties getOutputFormat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void indent(int n) throws SAXException {}
|
||||
|
||||
public boolean reset() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void serialize(Node node) throws IOException {}
|
||||
|
||||
public boolean setEscaping(boolean escape) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setIndent(boolean indent) {}
|
||||
|
||||
public void setOutputFormat(Properties format) {}
|
||||
|
||||
public void setOutputStream(OutputStream output) {}
|
||||
|
||||
public void setWriter(Writer writer) {}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) {}
|
||||
|
||||
public void attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException {}
|
||||
|
||||
public void elementDecl(String arg0, String arg1) throws SAXException {}
|
||||
|
||||
public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException {}
|
||||
|
||||
public void internalEntityDecl(String arg0, String arg1) throws SAXException {}
|
||||
|
||||
public void endPrefixMapping(String arg0) throws SAXException {}
|
||||
|
||||
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException {}
|
||||
|
||||
public void processingInstruction(String arg0, String arg1) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireEscapingEvent(arg0, arg1);
|
||||
}
|
||||
|
||||
public void setDocumentLocator(Locator arg0) {}
|
||||
|
||||
public void skippedEntity(String arg0) throws SAXException {}
|
||||
|
||||
public void startElement(String arg0, String arg1, String arg2, Attributes arg3) throws SAXException {
|
||||
flushPending();
|
||||
super.startElement(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
public void endCDATA() throws SAXException {}
|
||||
|
||||
public void endDTD() throws SAXException {}
|
||||
|
||||
public void startCDATA() throws SAXException {}
|
||||
|
||||
public void startEntity(String arg0) throws SAXException {}
|
||||
|
||||
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException {
|
||||
super.startElement(elementNamespaceURI, elementLocalName, elementName);
|
||||
}
|
||||
|
||||
public void startElement(String elementName) throws SAXException {
|
||||
super.startElement(elementName);
|
||||
}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.endDocument();
|
||||
if (this.m_tracer != null)
|
||||
fireEndDoc();
|
||||
}
|
||||
|
||||
public void characters(String characters) throws SAXException {
|
||||
int length = characters.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
characters.getChars(0, length, this.m_charsBuff, 0);
|
||||
this.m_saxHandler.characters(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
public void characters(char[] characters, int offset, int length) throws SAXException {
|
||||
this.m_saxHandler.characters(characters, offset, length);
|
||||
if (this.m_tracer != null)
|
||||
fireCharEvent(characters, offset, length);
|
||||
}
|
||||
|
||||
public void addAttribute(String name, String value) {}
|
||||
|
||||
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void startPrefixMapping(String prefix, String uri) throws SAXException {}
|
||||
|
||||
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException {}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class ToTextStream extends ToStream {
|
||||
protected void startDocumentInternal() throws SAXException {
|
||||
super.startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
flushPending();
|
||||
flushWriter();
|
||||
if (this.m_tracer != null)
|
||||
fireEndDoc();
|
||||
}
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String name, Attributes atts) throws SAXException {
|
||||
if (this.m_tracer != null) {
|
||||
fireStartElem(name);
|
||||
firePseudoAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
public void endElement(String namespaceURI, String localName, String name) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(name);
|
||||
}
|
||||
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {
|
||||
flushPending();
|
||||
try {
|
||||
if (inTemporaryOutputState()) {
|
||||
this.m_writer.write(ch, start, length);
|
||||
} else {
|
||||
writeNormalizedChars(ch, start, length, this.m_lineSepUse);
|
||||
}
|
||||
if (this.m_tracer != null)
|
||||
fireCharEvent(ch, start, length);
|
||||
} catch (IOException ioe) {
|
||||
throw new SAXException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
public void charactersRaw(char[] ch, int start, int length) throws SAXException {
|
||||
try {
|
||||
writeNormalizedChars(ch, start, length, this.m_lineSepUse);
|
||||
} catch (IOException ioe) {
|
||||
throw new SAXException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
void writeNormalizedChars(char[] ch, int start, int length, boolean useLineSep) throws IOException, SAXException {
|
||||
String encoding = getEncoding();
|
||||
Writer writer = this.m_writer;
|
||||
int end = start + length;
|
||||
char S_LINEFEED = '\n';
|
||||
for (int i = start; i < end; i++) {
|
||||
char c = ch[i];
|
||||
if ('\n' == c && useLineSep) {
|
||||
writer.write(this.m_lineSep, 0, this.m_lineSepLen);
|
||||
} else if (this.m_encodingInfo.isInEncoding(c)) {
|
||||
writer.write(c);
|
||||
} else if (Encodings.isHighUTF16Surrogate(c)) {
|
||||
int codePoint = writeUTF16Surrogate(c, ch, i, end);
|
||||
if (codePoint != 0) {
|
||||
String integralValue = Integer.toString(codePoint);
|
||||
String msg = Utils.messages.createMessage("ER_ILLEGAL_CHARACTER", new Object[] { integralValue, encoding });
|
||||
System.err.println(msg);
|
||||
}
|
||||
i++;
|
||||
} else if (encoding != null) {
|
||||
writer.write(38);
|
||||
writer.write(35);
|
||||
writer.write(Integer.toString(c));
|
||||
writer.write(59);
|
||||
String integralValue = Integer.toString(c);
|
||||
String msg = Utils.messages.createMessage("ER_ILLEGAL_CHARACTER", new Object[] { integralValue, encoding });
|
||||
System.err.println(msg);
|
||||
} else {
|
||||
writer.write(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cdata(char[] ch, int start, int length) throws SAXException {
|
||||
try {
|
||||
writeNormalizedChars(ch, start, length, this.m_lineSepUse);
|
||||
if (this.m_tracer != null)
|
||||
fireCDATAEvent(ch, start, length);
|
||||
} catch (IOException ioe) {
|
||||
throw new SAXException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
|
||||
try {
|
||||
writeNormalizedChars(ch, start, length, this.m_lineSepUse);
|
||||
} catch (IOException ioe) {
|
||||
throw new SAXException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
flushPending();
|
||||
if (this.m_tracer != null)
|
||||
fireEscapingEvent(target, data);
|
||||
}
|
||||
|
||||
public void comment(String data) throws SAXException {
|
||||
int length = data.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
data.getChars(0, length, this.m_charsBuff, 0);
|
||||
comment(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
public void comment(char[] ch, int start, int length) throws SAXException {
|
||||
flushPending();
|
||||
if (this.m_tracer != null)
|
||||
fireCommentEvent(ch, start, length);
|
||||
}
|
||||
|
||||
public void entityReference(String name) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireEntityReference(name);
|
||||
}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) {}
|
||||
|
||||
public void endCDATA() throws SAXException {}
|
||||
|
||||
public void endElement(String elemName) throws SAXException {
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(elemName);
|
||||
}
|
||||
|
||||
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException {
|
||||
if (this.m_needToCallStartDocument)
|
||||
startDocumentInternal();
|
||||
if (this.m_tracer != null) {
|
||||
fireStartElem(elementName);
|
||||
firePseudoAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
public void characters(String characters) throws SAXException {
|
||||
int length = characters.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
characters.getChars(0, length, this.m_charsBuff, 0);
|
||||
characters(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
public void addAttribute(String name, String value) {}
|
||||
|
||||
public void addUniqueAttribute(String qName, String value, int flags) throws SAXException {}
|
||||
|
||||
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void startPrefixMapping(String prefix, String uri) throws SAXException {}
|
||||
|
||||
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException {}
|
||||
|
||||
public void flushPending() throws SAXException {
|
||||
if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,562 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import javax.xml.transform.SourceLocator;
|
||||
import javax.xml.transform.Transformer;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public final class ToUnknownStream extends SerializerBase {
|
||||
private SerializationHandler m_handler;
|
||||
|
||||
private static final String EMPTYSTRING = "";
|
||||
|
||||
private boolean m_wrapped_handler_not_initialized = false;
|
||||
|
||||
private String m_firstElementPrefix;
|
||||
|
||||
private String m_firstElementName;
|
||||
|
||||
private String m_firstElementURI;
|
||||
|
||||
private String m_firstElementLocalName = null;
|
||||
|
||||
private boolean m_firstTagNotEmitted = true;
|
||||
|
||||
private Vector m_namespaceURI = null;
|
||||
|
||||
private Vector m_namespacePrefix = null;
|
||||
|
||||
private boolean m_needToCallStartDocument = false;
|
||||
|
||||
private boolean m_setVersion_called = false;
|
||||
|
||||
private boolean m_setDoctypeSystem_called = false;
|
||||
|
||||
private boolean m_setDoctypePublic_called = false;
|
||||
|
||||
private boolean m_setMediaType_called = false;
|
||||
|
||||
public ToUnknownStream() {
|
||||
this.m_handler = new ToXMLStream();
|
||||
}
|
||||
|
||||
public ContentHandler asContentHandler() throws IOException {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.m_handler.close();
|
||||
}
|
||||
|
||||
public Properties getOutputFormat() {
|
||||
return this.m_handler.getOutputFormat();
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return this.m_handler.getOutputStream();
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
return this.m_handler.getWriter();
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
return this.m_handler.reset();
|
||||
}
|
||||
|
||||
public void serialize(Node node) throws IOException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.serialize(node);
|
||||
}
|
||||
|
||||
public boolean setEscaping(boolean escape) throws SAXException {
|
||||
return this.m_handler.setEscaping(escape);
|
||||
}
|
||||
|
||||
public void setOutputFormat(Properties format) {
|
||||
this.m_handler.setOutputFormat(format);
|
||||
}
|
||||
|
||||
public void setOutputStream(OutputStream output) {
|
||||
this.m_handler.setOutputStream(output);
|
||||
}
|
||||
|
||||
public void setWriter(Writer writer) {
|
||||
this.m_handler.setWriter(writer);
|
||||
}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.addAttribute(uri, localName, rawName, type, value, XSLAttribute);
|
||||
}
|
||||
|
||||
public void addAttribute(String rawName, String value) {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.addAttribute(rawName, value);
|
||||
}
|
||||
|
||||
public void addUniqueAttribute(String rawName, String value, int flags) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.addUniqueAttribute(rawName, value, flags);
|
||||
}
|
||||
|
||||
public void characters(String chars) throws SAXException {
|
||||
int length = chars.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
chars.getChars(0, length, this.m_charsBuff, 0);
|
||||
characters(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
public void endElement(String elementName) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.endElement(elementName);
|
||||
}
|
||||
|
||||
public void startPrefixMapping(String prefix, String uri) throws SAXException {
|
||||
startPrefixMapping(prefix, uri, true);
|
||||
}
|
||||
|
||||
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted && this.m_firstElementURI == null && this.m_firstElementName != null) {
|
||||
String prefix1 = SerializerBase.getPrefixPart(this.m_firstElementName);
|
||||
if (prefix1 == null && "".equals(prefix))
|
||||
this.m_firstElementURI = uri;
|
||||
}
|
||||
startPrefixMapping(prefix, uri, false);
|
||||
}
|
||||
|
||||
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException {
|
||||
boolean pushed = false;
|
||||
if (this.m_firstTagNotEmitted) {
|
||||
if (this.m_firstElementName != null && shouldFlush) {
|
||||
flush();
|
||||
pushed = this.m_handler.startPrefixMapping(prefix, uri, shouldFlush);
|
||||
} else {
|
||||
if (this.m_namespacePrefix == null) {
|
||||
this.m_namespacePrefix = new Vector();
|
||||
this.m_namespaceURI = new Vector();
|
||||
}
|
||||
this.m_namespacePrefix.addElement(prefix);
|
||||
this.m_namespaceURI.addElement(uri);
|
||||
if (this.m_firstElementURI == null)
|
||||
if (prefix.equals(this.m_firstElementPrefix))
|
||||
this.m_firstElementURI = uri;
|
||||
}
|
||||
} else {
|
||||
pushed = this.m_handler.startPrefixMapping(prefix, uri, shouldFlush);
|
||||
}
|
||||
return pushed;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.m_handler.setVersion(version);
|
||||
this.m_setVersion_called = true;
|
||||
}
|
||||
|
||||
public void startDocument() throws SAXException {
|
||||
this.m_needToCallStartDocument = true;
|
||||
}
|
||||
|
||||
public void startElement(String qName) throws SAXException {
|
||||
startElement(null, null, qName, null);
|
||||
}
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String qName) throws SAXException {
|
||||
startElement(namespaceURI, localName, qName, null);
|
||||
}
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted) {
|
||||
if (this.m_firstElementName != null) {
|
||||
flush();
|
||||
this.m_handler.startElement(namespaceURI, localName, elementName, atts);
|
||||
} else {
|
||||
this.m_wrapped_handler_not_initialized = true;
|
||||
this.m_firstElementName = elementName;
|
||||
this.m_firstElementPrefix = getPrefixPartUnknown(elementName);
|
||||
this.m_firstElementURI = namespaceURI;
|
||||
this.m_firstElementLocalName = localName;
|
||||
if (this.m_tracer != null)
|
||||
firePseudoElement(elementName);
|
||||
if (atts != null)
|
||||
super.addAttributes(atts);
|
||||
if (atts != null)
|
||||
flush();
|
||||
}
|
||||
} else {
|
||||
this.m_handler.startElement(namespaceURI, localName, elementName, atts);
|
||||
}
|
||||
}
|
||||
|
||||
public void comment(String comment) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted && this.m_firstElementName != null) {
|
||||
emitFirstTag();
|
||||
} else if (this.m_needToCallStartDocument) {
|
||||
this.m_handler.startDocument();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
this.m_handler.comment(comment);
|
||||
}
|
||||
|
||||
public String getDoctypePublic() {
|
||||
return this.m_handler.getDoctypePublic();
|
||||
}
|
||||
|
||||
public String getDoctypeSystem() {
|
||||
return this.m_handler.getDoctypeSystem();
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return this.m_handler.getEncoding();
|
||||
}
|
||||
|
||||
public boolean getIndent() {
|
||||
return this.m_handler.getIndent();
|
||||
}
|
||||
|
||||
public int getIndentAmount() {
|
||||
return this.m_handler.getIndentAmount();
|
||||
}
|
||||
|
||||
public String getMediaType() {
|
||||
return this.m_handler.getMediaType();
|
||||
}
|
||||
|
||||
public boolean getOmitXMLDeclaration() {
|
||||
return this.m_handler.getOmitXMLDeclaration();
|
||||
}
|
||||
|
||||
public String getStandalone() {
|
||||
return this.m_handler.getStandalone();
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.m_handler.getVersion();
|
||||
}
|
||||
|
||||
public void setDoctype(String system, String pub) {
|
||||
this.m_handler.setDoctypePublic(pub);
|
||||
this.m_handler.setDoctypeSystem(system);
|
||||
}
|
||||
|
||||
public void setDoctypePublic(String doctype) {
|
||||
this.m_handler.setDoctypePublic(doctype);
|
||||
this.m_setDoctypePublic_called = true;
|
||||
}
|
||||
|
||||
public void setDoctypeSystem(String doctype) {
|
||||
this.m_handler.setDoctypeSystem(doctype);
|
||||
this.m_setDoctypeSystem_called = true;
|
||||
}
|
||||
|
||||
public void setEncoding(String encoding) {
|
||||
this.m_handler.setEncoding(encoding);
|
||||
}
|
||||
|
||||
public void setIndent(boolean indent) {
|
||||
this.m_handler.setIndent(indent);
|
||||
}
|
||||
|
||||
public void setIndentAmount(int value) {
|
||||
this.m_handler.setIndentAmount(value);
|
||||
}
|
||||
|
||||
public void setMediaType(String mediaType) {
|
||||
this.m_handler.setMediaType(mediaType);
|
||||
this.m_setMediaType_called = true;
|
||||
}
|
||||
|
||||
public void setOmitXMLDeclaration(boolean b) {
|
||||
this.m_handler.setOmitXMLDeclaration(b);
|
||||
}
|
||||
|
||||
public void setStandalone(String standalone) {
|
||||
this.m_handler.setStandalone(standalone);
|
||||
}
|
||||
|
||||
public void attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException {
|
||||
this.m_handler.attributeDecl(arg0, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
public void elementDecl(String arg0, String arg1) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
emitFirstTag();
|
||||
this.m_handler.elementDecl(arg0, arg1);
|
||||
}
|
||||
|
||||
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.externalEntityDecl(name, publicId, systemId);
|
||||
}
|
||||
|
||||
public void internalEntityDecl(String arg0, String arg1) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.internalEntityDecl(arg0, arg1);
|
||||
}
|
||||
|
||||
public void characters(char[] characters, int offset, int length) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.characters(characters, offset, length);
|
||||
}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.endDocument();
|
||||
}
|
||||
|
||||
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted) {
|
||||
flush();
|
||||
if (namespaceURI == null && this.m_firstElementURI != null)
|
||||
namespaceURI = this.m_firstElementURI;
|
||||
if (localName == null && this.m_firstElementLocalName != null)
|
||||
localName = this.m_firstElementLocalName;
|
||||
}
|
||||
this.m_handler.endElement(namespaceURI, localName, qName);
|
||||
}
|
||||
|
||||
public void endPrefixMapping(String prefix) throws SAXException {
|
||||
this.m_handler.endPrefixMapping(prefix);
|
||||
}
|
||||
|
||||
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.ignorableWhitespace(ch, start, length);
|
||||
}
|
||||
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.processingInstruction(target, data);
|
||||
}
|
||||
|
||||
public void setDocumentLocator(Locator locator) {
|
||||
this.m_handler.setDocumentLocator(locator);
|
||||
}
|
||||
|
||||
public void skippedEntity(String name) throws SAXException {
|
||||
this.m_handler.skippedEntity(name);
|
||||
}
|
||||
|
||||
public void comment(char[] ch, int start, int length) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
flush();
|
||||
this.m_handler.comment(ch, start, length);
|
||||
}
|
||||
|
||||
public void endCDATA() throws SAXException {
|
||||
this.m_handler.endCDATA();
|
||||
}
|
||||
|
||||
public void endDTD() throws SAXException {
|
||||
this.m_handler.endDTD();
|
||||
}
|
||||
|
||||
public void endEntity(String name) throws SAXException {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
emitFirstTag();
|
||||
this.m_handler.endEntity(name);
|
||||
}
|
||||
|
||||
public void startCDATA() throws SAXException {
|
||||
this.m_handler.startCDATA();
|
||||
}
|
||||
|
||||
public void startDTD(String name, String publicId, String systemId) throws SAXException {
|
||||
this.m_handler.startDTD(name, publicId, systemId);
|
||||
}
|
||||
|
||||
public void startEntity(String name) throws SAXException {
|
||||
this.m_handler.startEntity(name);
|
||||
}
|
||||
|
||||
private void initStreamOutput() throws SAXException {
|
||||
boolean firstElementIsHTML = isFirstElemHTML();
|
||||
if (firstElementIsHTML) {
|
||||
SerializationHandler oldHandler = this.m_handler;
|
||||
Properties htmlProperties = OutputPropertiesFactory.getDefaultMethodProperties("html");
|
||||
Serializer serializer = SerializerFactory.getSerializer(htmlProperties);
|
||||
this.m_handler = (SerializationHandler)serializer;
|
||||
Writer writer = oldHandler.getWriter();
|
||||
if (null != writer) {
|
||||
this.m_handler.setWriter(writer);
|
||||
} else {
|
||||
OutputStream os = oldHandler.getOutputStream();
|
||||
if (null != os)
|
||||
this.m_handler.setOutputStream(os);
|
||||
}
|
||||
this.m_handler.setVersion(oldHandler.getVersion());
|
||||
this.m_handler.setDoctypeSystem(oldHandler.getDoctypeSystem());
|
||||
this.m_handler.setDoctypePublic(oldHandler.getDoctypePublic());
|
||||
this.m_handler.setMediaType(oldHandler.getMediaType());
|
||||
this.m_handler.setTransformer(oldHandler.getTransformer());
|
||||
}
|
||||
if (this.m_needToCallStartDocument) {
|
||||
this.m_handler.startDocument();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
this.m_wrapped_handler_not_initialized = false;
|
||||
}
|
||||
|
||||
private void emitFirstTag() throws SAXException {
|
||||
if (this.m_firstElementName != null) {
|
||||
if (this.m_wrapped_handler_not_initialized) {
|
||||
initStreamOutput();
|
||||
this.m_wrapped_handler_not_initialized = false;
|
||||
}
|
||||
this.m_handler.startElement(this.m_firstElementURI, null, this.m_firstElementName, this.m_attributes);
|
||||
this.m_attributes = null;
|
||||
if (this.m_namespacePrefix != null) {
|
||||
int n = this.m_namespacePrefix.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
String prefix = (String)this.m_namespacePrefix.elementAt(i);
|
||||
String uri = (String)this.m_namespaceURI.elementAt(i);
|
||||
this.m_handler.startPrefixMapping(prefix, uri, false);
|
||||
}
|
||||
this.m_namespacePrefix = null;
|
||||
this.m_namespaceURI = null;
|
||||
}
|
||||
this.m_firstTagNotEmitted = false;
|
||||
}
|
||||
}
|
||||
|
||||
private String getLocalNameUnknown(String value) {
|
||||
int idx = value.lastIndexOf(':');
|
||||
if (idx >= 0)
|
||||
value = value.substring(idx + 1);
|
||||
idx = value.lastIndexOf('@');
|
||||
if (idx >= 0)
|
||||
value = value.substring(idx + 1);
|
||||
return value;
|
||||
}
|
||||
|
||||
private String getPrefixPartUnknown(String qname) {
|
||||
int index = qname.indexOf(':');
|
||||
return (index > 0) ? qname.substring(0, index) : "";
|
||||
}
|
||||
|
||||
private boolean isFirstElemHTML() {
|
||||
boolean isHTML = getLocalNameUnknown(this.m_firstElementName).equalsIgnoreCase("html");
|
||||
if (isHTML && this.m_firstElementURI != null && !"".equals(this.m_firstElementURI))
|
||||
isHTML = false;
|
||||
if (isHTML && this.m_namespacePrefix != null) {
|
||||
int max = this.m_namespacePrefix.size();
|
||||
for (int i = 0; i < max; i++) {
|
||||
String prefix = (String)this.m_namespacePrefix.elementAt(i);
|
||||
String uri = (String)this.m_namespaceURI.elementAt(i);
|
||||
if (this.m_firstElementPrefix != null && this.m_firstElementPrefix.equals(prefix) && !"".equals(uri)) {
|
||||
isHTML = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isHTML;
|
||||
}
|
||||
|
||||
public DOMSerializer asDOMSerializer() throws IOException {
|
||||
return this.m_handler.asDOMSerializer();
|
||||
}
|
||||
|
||||
public void setCdataSectionElements(Vector URI_and_localNames) {
|
||||
this.m_handler.setCdataSectionElements(URI_and_localNames);
|
||||
}
|
||||
|
||||
public void addAttributes(Attributes atts) throws SAXException {
|
||||
this.m_handler.addAttributes(atts);
|
||||
}
|
||||
|
||||
public NamespaceMappings getNamespaceMappings() {
|
||||
NamespaceMappings mappings = null;
|
||||
if (this.m_handler != null)
|
||||
mappings = this.m_handler.getNamespaceMappings();
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public void flushPending() throws SAXException {
|
||||
flush();
|
||||
this.m_handler.flushPending();
|
||||
}
|
||||
|
||||
private void flush() {
|
||||
try {
|
||||
if (this.m_firstTagNotEmitted)
|
||||
emitFirstTag();
|
||||
if (this.m_needToCallStartDocument) {
|
||||
this.m_handler.startDocument();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
} catch (SAXException e) {
|
||||
throw new RuntimeException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public String getPrefix(String namespaceURI) {
|
||||
return this.m_handler.getPrefix(namespaceURI);
|
||||
}
|
||||
|
||||
public void entityReference(String entityName) throws SAXException {
|
||||
this.m_handler.entityReference(entityName);
|
||||
}
|
||||
|
||||
public String getNamespaceURI(String qname, boolean isElement) {
|
||||
return this.m_handler.getNamespaceURI(qname, isElement);
|
||||
}
|
||||
|
||||
public String getNamespaceURIFromPrefix(String prefix) {
|
||||
return this.m_handler.getNamespaceURIFromPrefix(prefix);
|
||||
}
|
||||
|
||||
public void setTransformer(Transformer t) {
|
||||
this.m_handler.setTransformer(t);
|
||||
if (t instanceof SerializerTrace && ((SerializerTrace)t).hasTraceListeners()) {
|
||||
this.m_tracer = (SerializerTrace)t;
|
||||
} else {
|
||||
this.m_tracer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Transformer getTransformer() {
|
||||
return this.m_handler.getTransformer();
|
||||
}
|
||||
|
||||
public void setContentHandler(ContentHandler ch) {
|
||||
this.m_handler.setContentHandler(ch);
|
||||
}
|
||||
|
||||
public void setSourceLocator(SourceLocator locator) {
|
||||
this.m_handler.setSourceLocator(locator);
|
||||
}
|
||||
|
||||
protected void firePseudoElement(String elementName) {
|
||||
if (this.m_tracer != null) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append('<');
|
||||
sb.append(elementName);
|
||||
char[] ch = sb.toString().toCharArray();
|
||||
this.m_tracer.fireGenerateEvent(11, ch, 0, ch.length);
|
||||
}
|
||||
}
|
||||
|
||||
public Object asDOM3Serializer() throws IOException {
|
||||
return this.m_handler.asDOM3Serializer();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,306 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.Properties;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
public final class ToXMLSAXHandler extends ToSAXHandler {
|
||||
protected boolean m_escapeSetting = true;
|
||||
|
||||
public ToXMLSAXHandler() {
|
||||
this.m_prefixMap = new NamespaceMappings();
|
||||
initCDATA();
|
||||
}
|
||||
|
||||
public Properties getOutputFormat() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void indent(int n) throws SAXException {}
|
||||
|
||||
public void serialize(Node node) throws IOException {}
|
||||
|
||||
public boolean setEscaping(boolean escape) throws SAXException {
|
||||
boolean oldEscapeSetting = this.m_escapeSetting;
|
||||
this.m_escapeSetting = escape;
|
||||
if (escape) {
|
||||
processingInstruction("javax.xml.transform.enable-output-escaping", "");
|
||||
} else {
|
||||
processingInstruction("javax.xml.transform.disable-output-escaping", "");
|
||||
}
|
||||
return oldEscapeSetting;
|
||||
}
|
||||
|
||||
public void setOutputFormat(Properties format) {}
|
||||
|
||||
public void setOutputStream(OutputStream output) {}
|
||||
|
||||
public void setWriter(Writer writer) {}
|
||||
|
||||
public void attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException {}
|
||||
|
||||
public void elementDecl(String arg0, String arg1) throws SAXException {}
|
||||
|
||||
public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException {}
|
||||
|
||||
public void internalEntityDecl(String arg0, String arg1) throws SAXException {}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.endDocument();
|
||||
if (this.m_tracer != null)
|
||||
fireEndDoc();
|
||||
}
|
||||
|
||||
protected void closeStartTag() throws SAXException {
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
String localName = SerializerBase.getLocalName(this.m_elemContext.m_elementName);
|
||||
String uri = getNamespaceURI(this.m_elemContext.m_elementName, true);
|
||||
if (this.m_needToCallStartDocument)
|
||||
startDocumentInternal();
|
||||
this.m_saxHandler.startElement(uri, localName, this.m_elemContext.m_elementName, this.m_attributes);
|
||||
this.m_attributes.clear();
|
||||
if (this.m_state != null)
|
||||
this.m_state.setCurrentNode(null);
|
||||
}
|
||||
|
||||
public void closeCDATA() throws SAXException {
|
||||
if (this.m_lexHandler != null && this.m_cdataTagOpen)
|
||||
this.m_lexHandler.endCDATA();
|
||||
this.m_cdataTagOpen = false;
|
||||
}
|
||||
|
||||
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
|
||||
flushPending();
|
||||
if (namespaceURI == null)
|
||||
if (this.m_elemContext.m_elementURI != null) {
|
||||
namespaceURI = this.m_elemContext.m_elementURI;
|
||||
} else {
|
||||
namespaceURI = getNamespaceURI(qName, true);
|
||||
}
|
||||
if (localName == null)
|
||||
if (this.m_elemContext.m_elementLocalName != null) {
|
||||
localName = this.m_elemContext.m_elementLocalName;
|
||||
} else {
|
||||
localName = SerializerBase.getLocalName(qName);
|
||||
}
|
||||
this.m_saxHandler.endElement(namespaceURI, localName, qName);
|
||||
if (this.m_tracer != null)
|
||||
fireEndElem(qName);
|
||||
this.m_prefixMap.popNamespaces(this.m_elemContext.m_currentElemDepth, this.m_saxHandler);
|
||||
this.m_elemContext = this.m_elemContext.m_prev;
|
||||
}
|
||||
|
||||
public void endPrefixMapping(String prefix) throws SAXException {}
|
||||
|
||||
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException {
|
||||
this.m_saxHandler.ignorableWhitespace(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
public void setDocumentLocator(Locator arg0) {
|
||||
this.m_saxHandler.setDocumentLocator(arg0);
|
||||
}
|
||||
|
||||
public void skippedEntity(String arg0) throws SAXException {
|
||||
this.m_saxHandler.skippedEntity(arg0);
|
||||
}
|
||||
|
||||
public void startPrefixMapping(String prefix, String uri) throws SAXException {
|
||||
startPrefixMapping(prefix, uri, true);
|
||||
}
|
||||
|
||||
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException {
|
||||
int i;
|
||||
if (shouldFlush) {
|
||||
flushPending();
|
||||
i = this.m_elemContext.m_currentElemDepth + 1;
|
||||
} else {
|
||||
i = this.m_elemContext.m_currentElemDepth;
|
||||
}
|
||||
boolean pushed = this.m_prefixMap.pushNamespace(prefix, uri, i);
|
||||
if (pushed) {
|
||||
this.m_saxHandler.startPrefixMapping(prefix, uri);
|
||||
if (getShouldOutputNSAttr())
|
||||
if ("".equals(prefix)) {
|
||||
String name = "xmlns";
|
||||
addAttributeAlways("http://www.w3.org/2000/xmlns/", name, name, "CDATA", uri, false);
|
||||
} else if (!"".equals(uri)) {
|
||||
String str = "xmlns:" + prefix;
|
||||
addAttributeAlways("http://www.w3.org/2000/xmlns/", prefix, str, "CDATA", uri, false);
|
||||
}
|
||||
}
|
||||
return pushed;
|
||||
}
|
||||
|
||||
public void comment(char[] arg0, int arg1, int arg2) throws SAXException {
|
||||
flushPending();
|
||||
if (this.m_lexHandler != null)
|
||||
this.m_lexHandler.comment(arg0, arg1, arg2);
|
||||
if (this.m_tracer != null)
|
||||
fireCommentEvent(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
public void endCDATA() throws SAXException {}
|
||||
|
||||
public void endDTD() throws SAXException {
|
||||
if (this.m_lexHandler != null)
|
||||
this.m_lexHandler.endDTD();
|
||||
}
|
||||
|
||||
public void startEntity(String arg0) throws SAXException {
|
||||
if (this.m_lexHandler != null)
|
||||
this.m_lexHandler.startEntity(arg0);
|
||||
}
|
||||
|
||||
public void characters(String chars) throws SAXException {
|
||||
int length = chars.length();
|
||||
if (length > this.m_charsBuff.length)
|
||||
this.m_charsBuff = new char[length * 2 + 1];
|
||||
chars.getChars(0, length, this.m_charsBuff, 0);
|
||||
characters(this.m_charsBuff, 0, length);
|
||||
}
|
||||
|
||||
public ToXMLSAXHandler(ContentHandler handler, String encoding) {
|
||||
super(handler, encoding);
|
||||
initCDATA();
|
||||
this.m_prefixMap = new NamespaceMappings();
|
||||
}
|
||||
|
||||
public ToXMLSAXHandler(ContentHandler handler, LexicalHandler lex, String encoding) {
|
||||
super(handler, lex, encoding);
|
||||
initCDATA();
|
||||
this.m_prefixMap = new NamespaceMappings();
|
||||
}
|
||||
|
||||
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException {
|
||||
startElement(elementNamespaceURI, elementLocalName, elementName, null);
|
||||
}
|
||||
|
||||
public void startElement(String elementName) throws SAXException {
|
||||
startElement(null, null, elementName, null);
|
||||
}
|
||||
|
||||
public void characters(char[] ch, int off, int len) throws SAXException {
|
||||
if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
}
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
if (this.m_elemContext.m_isCdataSection && !this.m_cdataTagOpen && this.m_lexHandler != null) {
|
||||
this.m_lexHandler.startCDATA();
|
||||
this.m_cdataTagOpen = true;
|
||||
}
|
||||
this.m_saxHandler.characters(ch, off, len);
|
||||
if (this.m_tracer != null)
|
||||
fireCharEvent(ch, off, len);
|
||||
}
|
||||
|
||||
public void endElement(String elemName) throws SAXException {
|
||||
endElement(null, null, elemName);
|
||||
}
|
||||
|
||||
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException {
|
||||
startPrefixMapping(prefix, uri, false);
|
||||
}
|
||||
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
flushPending();
|
||||
this.m_saxHandler.processingInstruction(target, data);
|
||||
if (this.m_tracer != null)
|
||||
fireEscapingEvent(target, data);
|
||||
}
|
||||
|
||||
protected boolean popNamespace(String prefix) {
|
||||
try {
|
||||
if (this.m_prefixMap.popNamespace(prefix)) {
|
||||
this.m_saxHandler.endPrefixMapping(prefix);
|
||||
return true;
|
||||
}
|
||||
} catch (SAXException e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void startCDATA() throws SAXException {
|
||||
if (!this.m_cdataTagOpen) {
|
||||
flushPending();
|
||||
if (this.m_lexHandler != null) {
|
||||
this.m_lexHandler.startCDATA();
|
||||
this.m_cdataTagOpen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void startElement(String namespaceURI, String localName, String name, Attributes atts) throws SAXException {
|
||||
flushPending();
|
||||
super.startElement(namespaceURI, localName, name, atts);
|
||||
if (this.m_needToOutputDocTypeDecl) {
|
||||
String doctypeSystem = getDoctypeSystem();
|
||||
if (doctypeSystem != null && this.m_lexHandler != null) {
|
||||
String doctypePublic = getDoctypePublic();
|
||||
if (doctypeSystem != null)
|
||||
this.m_lexHandler.startDTD(name, doctypePublic, doctypeSystem);
|
||||
}
|
||||
this.m_needToOutputDocTypeDecl = false;
|
||||
}
|
||||
this.m_elemContext = this.m_elemContext.push(namespaceURI, localName, name);
|
||||
if (namespaceURI != null)
|
||||
ensurePrefixIsDeclared(namespaceURI, name);
|
||||
if (atts != null)
|
||||
addAttributes(atts);
|
||||
this.m_elemContext.m_isCdataSection = isCdataSection();
|
||||
}
|
||||
|
||||
private void ensurePrefixIsDeclared(String ns, String rawName) throws SAXException {
|
||||
if (ns != null && ns.length() > 0) {
|
||||
int index;
|
||||
boolean no_prefix = ((index = rawName.indexOf(":")) < 0);
|
||||
String prefix = no_prefix ? "" : rawName.substring(0, index);
|
||||
if (null != prefix) {
|
||||
String foundURI = this.m_prefixMap.lookupNamespace(prefix);
|
||||
if (null == foundURI || !foundURI.equals(ns)) {
|
||||
startPrefixMapping(prefix, ns, false);
|
||||
if (getShouldOutputNSAttr())
|
||||
addAttributeAlways("http://www.w3.org/2000/xmlns/", no_prefix ? "xmlns" : prefix, no_prefix ? "xmlns" : ("xmlns:" + prefix), "CDATA", ns, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
ensurePrefixIsDeclared(uri, rawName);
|
||||
addAttributeAlways(uri, localName, rawName, type, value, false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
boolean wasReset = false;
|
||||
if (super.reset()) {
|
||||
resetToXMLSAXHandler();
|
||||
wasReset = true;
|
||||
}
|
||||
return wasReset;
|
||||
}
|
||||
|
||||
private void resetToXMLSAXHandler() {
|
||||
this.m_escapeSetting = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,264 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class ToXMLStream extends ToStream {
|
||||
private CharInfo m_xmlcharInfo = CharInfo.getCharInfo(CharInfo.XML_ENTITIES_RESOURCE, "xml");
|
||||
|
||||
public ToXMLStream() {
|
||||
this.m_charInfo = this.m_xmlcharInfo;
|
||||
initCDATA();
|
||||
this.m_prefixMap = new NamespaceMappings();
|
||||
}
|
||||
|
||||
public void CopyFrom(ToXMLStream xmlListener) {
|
||||
setWriter(xmlListener.m_writer);
|
||||
String encoding = xmlListener.getEncoding();
|
||||
setEncoding(encoding);
|
||||
setOmitXMLDeclaration(xmlListener.getOmitXMLDeclaration());
|
||||
this.m_ispreserve = xmlListener.m_ispreserve;
|
||||
this.m_preserves = xmlListener.m_preserves;
|
||||
this.m_isprevtext = xmlListener.m_isprevtext;
|
||||
this.m_doIndent = xmlListener.m_doIndent;
|
||||
setIndentAmount(xmlListener.getIndentAmount());
|
||||
this.m_startNewLine = xmlListener.m_startNewLine;
|
||||
this.m_needToOutputDocTypeDecl = xmlListener.m_needToOutputDocTypeDecl;
|
||||
setDoctypeSystem(xmlListener.getDoctypeSystem());
|
||||
setDoctypePublic(xmlListener.getDoctypePublic());
|
||||
setStandalone(xmlListener.getStandalone());
|
||||
setMediaType(xmlListener.getMediaType());
|
||||
this.m_encodingInfo = xmlListener.m_encodingInfo;
|
||||
this.m_spaceBeforeClose = xmlListener.m_spaceBeforeClose;
|
||||
this.m_cdataStartCalled = xmlListener.m_cdataStartCalled;
|
||||
}
|
||||
|
||||
public void startDocumentInternal() throws SAXException {
|
||||
if (this.m_needToCallStartDocument) {
|
||||
super.startDocumentInternal();
|
||||
this.m_needToCallStartDocument = false;
|
||||
if (this.m_inEntityRef)
|
||||
return;
|
||||
this.m_needToOutputDocTypeDecl = true;
|
||||
this.m_startNewLine = false;
|
||||
String version = getXMLVersion();
|
||||
if (!getOmitXMLDeclaration()) {
|
||||
String str1;
|
||||
String encoding = Encodings.getMimeEncoding(getEncoding());
|
||||
if (this.m_standaloneWasSpecified) {
|
||||
str1 = " standalone=\"" + getStandalone() + "\"";
|
||||
} else {
|
||||
str1 = "";
|
||||
}
|
||||
try {
|
||||
Writer writer = this.m_writer;
|
||||
writer.write("<?xml version=\"");
|
||||
writer.write(version);
|
||||
writer.write("\" encoding=\"");
|
||||
writer.write(encoding);
|
||||
writer.write(34);
|
||||
writer.write(str1);
|
||||
writer.write("?>");
|
||||
if (this.m_doIndent && (
|
||||
this.m_standaloneWasSpecified || getDoctypePublic() != null || getDoctypeSystem() != null))
|
||||
writer.write(this.m_lineSep, 0, this.m_lineSepLen);
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
flushPending();
|
||||
if (this.m_doIndent && !this.m_isprevtext)
|
||||
try {
|
||||
outputLineSep();
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
flushWriter();
|
||||
if (this.m_tracer != null)
|
||||
fireEndDoc();
|
||||
}
|
||||
|
||||
public void startPreserving() throws SAXException {
|
||||
this.m_preserves.push(true);
|
||||
this.m_ispreserve = true;
|
||||
}
|
||||
|
||||
public void endPreserving() throws SAXException {
|
||||
this.m_ispreserve = this.m_preserves.isEmpty() ? false : this.m_preserves.pop();
|
||||
}
|
||||
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
if (this.m_inEntityRef)
|
||||
return;
|
||||
flushPending();
|
||||
if (target.equals("javax.xml.transform.disable-output-escaping")) {
|
||||
startNonEscaping();
|
||||
} else if (target.equals("javax.xml.transform.enable-output-escaping")) {
|
||||
endNonEscaping();
|
||||
} else {
|
||||
try {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
} else if (this.m_needToCallStartDocument) {
|
||||
startDocumentInternal();
|
||||
}
|
||||
if (shouldIndent())
|
||||
indent();
|
||||
Writer writer = this.m_writer;
|
||||
writer.write("<?");
|
||||
writer.write(target);
|
||||
if (data.length() > 0 && !Character.isSpaceChar(data.charAt(0)))
|
||||
writer.write(32);
|
||||
int indexOfQLT = data.indexOf("?>");
|
||||
if (indexOfQLT >= 0) {
|
||||
if (indexOfQLT > 0)
|
||||
writer.write(data.substring(0, indexOfQLT));
|
||||
writer.write("? >");
|
||||
if (indexOfQLT + 2 < data.length())
|
||||
writer.write(data.substring(indexOfQLT + 2));
|
||||
} else {
|
||||
writer.write(data);
|
||||
}
|
||||
writer.write(63);
|
||||
writer.write(62);
|
||||
this.m_startNewLine = true;
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
if (this.m_tracer != null)
|
||||
fireEscapingEvent(target, data);
|
||||
}
|
||||
|
||||
public void entityReference(String name) throws SAXException {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
closeStartTag();
|
||||
this.m_elemContext.m_startTagOpen = false;
|
||||
}
|
||||
try {
|
||||
if (shouldIndent())
|
||||
indent();
|
||||
Writer writer = this.m_writer;
|
||||
writer.write(38);
|
||||
writer.write(name);
|
||||
writer.write(59);
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
if (this.m_tracer != null)
|
||||
fireEntityReference(name);
|
||||
}
|
||||
|
||||
public void addUniqueAttribute(String name, String value, int flags) throws SAXException {
|
||||
if (this.m_elemContext.m_startTagOpen)
|
||||
try {
|
||||
String patchedName = patchName(name);
|
||||
Writer writer = this.m_writer;
|
||||
if ((flags & 0x1) > 0 && this.m_xmlcharInfo.onlyQuotAmpLtGt) {
|
||||
writer.write(32);
|
||||
writer.write(patchedName);
|
||||
writer.write("=\"");
|
||||
writer.write(value);
|
||||
writer.write(34);
|
||||
} else {
|
||||
writer.write(32);
|
||||
writer.write(patchedName);
|
||||
writer.write("=\"");
|
||||
writeAttrString(writer, value, getEncoding());
|
||||
writer.write(34);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean xslAttribute) throws SAXException {
|
||||
if (this.m_elemContext.m_startTagOpen) {
|
||||
boolean was_added = addAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
|
||||
if (was_added && !xslAttribute && !rawName.startsWith("xmlns")) {
|
||||
String prefixUsed = ensureAttributesNamespaceIsDeclared(uri, localName, rawName);
|
||||
if (prefixUsed != null && rawName != null && !rawName.startsWith(prefixUsed))
|
||||
rawName = prefixUsed + ":" + localName;
|
||||
}
|
||||
addAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
|
||||
} else {
|
||||
String msg = Utils.messages.createMessage("ER_ILLEGAL_ATTRIBUTE_POSITION", new Object[] { localName });
|
||||
try {
|
||||
Transformer tran = getTransformer();
|
||||
ErrorListener errHandler = tran.getErrorListener();
|
||||
if (null != errHandler && this.m_sourceLocator != null) {
|
||||
errHandler.warning(new TransformerException(msg, this.m_sourceLocator));
|
||||
} else {
|
||||
System.out.println(msg);
|
||||
}
|
||||
} catch (TransformerException e) {
|
||||
SAXException se = new SAXException(e);
|
||||
throw se;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void endElement(String elemName) throws SAXException {
|
||||
endElement(null, null, elemName);
|
||||
}
|
||||
|
||||
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException {
|
||||
if (this.m_elemContext.m_elementURI == null) {
|
||||
String prefix1 = SerializerBase.getPrefixPart(this.m_elemContext.m_elementName);
|
||||
if (prefix1 == null && "".equals(prefix))
|
||||
this.m_elemContext.m_elementURI = uri;
|
||||
}
|
||||
startPrefixMapping(prefix, uri, false);
|
||||
}
|
||||
|
||||
protected boolean pushNamespace(String prefix, String uri) {
|
||||
try {
|
||||
if (this.m_prefixMap.pushNamespace(prefix, uri, this.m_elemContext.m_currentElemDepth)) {
|
||||
startPrefixMapping(prefix, uri);
|
||||
return true;
|
||||
}
|
||||
} catch (SAXException e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
boolean wasReset = false;
|
||||
if (super.reset())
|
||||
wasReset = true;
|
||||
return wasReset;
|
||||
}
|
||||
|
||||
private void resetToXMLStream() {}
|
||||
|
||||
private String getXMLVersion() {
|
||||
String xmlVersion = getVersion();
|
||||
if (xmlVersion == null || xmlVersion.equals("1.0")) {
|
||||
xmlVersion = "1.0";
|
||||
} else if (xmlVersion.equals("1.1")) {
|
||||
xmlVersion = "1.1";
|
||||
} else {
|
||||
String msg = Utils.messages.createMessage("ER_XML_VERSION_NOT_SUPPORTED", new Object[] { xmlVersion });
|
||||
try {
|
||||
Transformer tran = getTransformer();
|
||||
ErrorListener errHandler = tran.getErrorListener();
|
||||
if (null != errHandler && this.m_sourceLocator != null) {
|
||||
errHandler.warning(new TransformerException(msg, this.m_sourceLocator));
|
||||
} else {
|
||||
System.out.println(msg);
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
xmlVersion = "1.0";
|
||||
}
|
||||
return xmlVersion;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import javax.xml.transform.Transformer;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public interface TransformStateSetter {
|
||||
void setCurrentNode(Node paramNode);
|
||||
|
||||
void resetState(Transformer paramTransformer);
|
||||
}
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.File;
|
||||
import org.apache.xml.serializer.utils.AttList;
|
||||
import org.apache.xml.serializer.utils.DOM2Helper;
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.EntityReference;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.ProcessingInstruction;
|
||||
import org.w3c.dom.Text;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
import org.xml.sax.helpers.LocatorImpl;
|
||||
|
||||
public final class TreeWalker {
|
||||
private final ContentHandler m_contentHandler;
|
||||
|
||||
private final SerializationHandler m_Serializer;
|
||||
|
||||
protected final DOM2Helper m_dh;
|
||||
|
||||
private final LocatorImpl m_locator = new LocatorImpl();
|
||||
|
||||
public ContentHandler getContentHandler() {
|
||||
return this.m_contentHandler;
|
||||
}
|
||||
|
||||
public TreeWalker(ContentHandler ch) {
|
||||
this(ch, null);
|
||||
}
|
||||
|
||||
public TreeWalker(ContentHandler contentHandler, String systemId) {
|
||||
this.m_contentHandler = contentHandler;
|
||||
if (this.m_contentHandler instanceof SerializationHandler) {
|
||||
this.m_Serializer = (SerializationHandler)this.m_contentHandler;
|
||||
} else {
|
||||
this.m_Serializer = null;
|
||||
}
|
||||
this.m_contentHandler.setDocumentLocator(this.m_locator);
|
||||
if (systemId != null) {
|
||||
this.m_locator.setSystemId(systemId);
|
||||
} else {
|
||||
try {
|
||||
this.m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
|
||||
} catch (SecurityException se) {}
|
||||
}
|
||||
if (this.m_contentHandler != null)
|
||||
this.m_contentHandler.setDocumentLocator(this.m_locator);
|
||||
try {
|
||||
this.m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
|
||||
} catch (SecurityException se) {}
|
||||
this.m_dh = new DOM2Helper();
|
||||
}
|
||||
|
||||
public void traverse(Node pos) throws SAXException {
|
||||
this.m_contentHandler.startDocument();
|
||||
Node top = pos;
|
||||
while (null != pos) {
|
||||
startNode(pos);
|
||||
Node nextNode = pos.getFirstChild();
|
||||
while (null == nextNode) {
|
||||
endNode(pos);
|
||||
if (top.equals(pos))
|
||||
break;
|
||||
nextNode = pos.getNextSibling();
|
||||
if (null == nextNode) {
|
||||
pos = pos.getParentNode();
|
||||
if (null == pos || top.equals(pos)) {
|
||||
if (null != pos)
|
||||
endNode(pos);
|
||||
nextNode = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos = nextNode;
|
||||
}
|
||||
this.m_contentHandler.endDocument();
|
||||
}
|
||||
|
||||
public void traverse(Node pos, Node top) throws SAXException {
|
||||
this.m_contentHandler.startDocument();
|
||||
while (null != pos) {
|
||||
startNode(pos);
|
||||
Node nextNode = pos.getFirstChild();
|
||||
while (null == nextNode) {
|
||||
endNode(pos);
|
||||
if (null != top && top.equals(pos))
|
||||
break;
|
||||
nextNode = pos.getNextSibling();
|
||||
if (null == nextNode) {
|
||||
pos = pos.getParentNode();
|
||||
if (null == pos || (null != top && top.equals(pos))) {
|
||||
nextNode = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos = nextNode;
|
||||
}
|
||||
this.m_contentHandler.endDocument();
|
||||
}
|
||||
|
||||
boolean nextIsRaw = false;
|
||||
|
||||
private final void dispatachChars(Node node) throws SAXException {
|
||||
if (this.m_Serializer != null) {
|
||||
this.m_Serializer.characters(node);
|
||||
} else {
|
||||
String data = ((Text)node).getData();
|
||||
this.m_contentHandler.characters(data.toCharArray(), 0, data.length());
|
||||
}
|
||||
}
|
||||
|
||||
protected void startNode(Node node) throws SAXException {
|
||||
String data;
|
||||
Element elem_node;
|
||||
String uri;
|
||||
NamedNodeMap atts;
|
||||
int nAttrs, i;
|
||||
String ns;
|
||||
ProcessingInstruction pi;
|
||||
boolean isLexH;
|
||||
EntityReference eref;
|
||||
String name;
|
||||
LexicalHandler lh;
|
||||
if (node instanceof Locator) {
|
||||
Locator loc = (Locator)node;
|
||||
this.m_locator.setColumnNumber(loc.getColumnNumber());
|
||||
this.m_locator.setLineNumber(loc.getLineNumber());
|
||||
this.m_locator.setPublicId(loc.getPublicId());
|
||||
this.m_locator.setSystemId(loc.getSystemId());
|
||||
} else {
|
||||
this.m_locator.setColumnNumber(0);
|
||||
this.m_locator.setLineNumber(0);
|
||||
}
|
||||
switch (node.getNodeType()) {
|
||||
case 8:
|
||||
data = ((Comment)node).getData();
|
||||
if (this.m_contentHandler instanceof LexicalHandler) {
|
||||
LexicalHandler lexicalHandler = (LexicalHandler)this.m_contentHandler;
|
||||
lexicalHandler.comment(data.toCharArray(), 0, data.length());
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
elem_node = (Element)node;
|
||||
uri = elem_node.getNamespaceURI();
|
||||
if (uri != null) {
|
||||
String prefix = elem_node.getPrefix();
|
||||
if (prefix == null)
|
||||
prefix = "";
|
||||
this.m_contentHandler.startPrefixMapping(prefix, uri);
|
||||
}
|
||||
atts = elem_node.getAttributes();
|
||||
nAttrs = atts.getLength();
|
||||
for (i = 0; i < nAttrs; i++) {
|
||||
Node attr = atts.item(i);
|
||||
String attrName = attr.getNodeName();
|
||||
int colon = attrName.indexOf(':');
|
||||
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) {
|
||||
String str;
|
||||
if (colon < 0) {
|
||||
str = "";
|
||||
} else {
|
||||
str = attrName.substring(colon + 1);
|
||||
}
|
||||
this.m_contentHandler.startPrefixMapping(str, attr.getNodeValue());
|
||||
} else if (colon > 0) {
|
||||
String str1 = attrName.substring(0, colon);
|
||||
String str2 = attr.getNamespaceURI();
|
||||
if (str2 != null)
|
||||
this.m_contentHandler.startPrefixMapping(str1, str2);
|
||||
}
|
||||
}
|
||||
ns = this.m_dh.getNamespaceOfNode(node);
|
||||
if (null == ns)
|
||||
ns = "";
|
||||
this.m_contentHandler.startElement(ns, this.m_dh.getLocalNameOfNode(node), node.getNodeName(), new AttList(atts, this.m_dh));
|
||||
break;
|
||||
case 7:
|
||||
pi = (ProcessingInstruction)node;
|
||||
name = pi.getNodeName();
|
||||
if (name.equals("xslt-next-is-raw")) {
|
||||
this.nextIsRaw = true;
|
||||
} else {
|
||||
this.m_contentHandler.processingInstruction(pi.getNodeName(), pi.getData());
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
isLexH = this.m_contentHandler instanceof LexicalHandler;
|
||||
lh = isLexH ? (LexicalHandler)this.m_contentHandler : null;
|
||||
if (isLexH)
|
||||
lh.startCDATA();
|
||||
dispatachChars(node);
|
||||
if (isLexH)
|
||||
lh.endCDATA();
|
||||
break;
|
||||
case 3:
|
||||
if (this.nextIsRaw) {
|
||||
this.nextIsRaw = false;
|
||||
this.m_contentHandler.processingInstruction("javax.xml.transform.disable-output-escaping", "");
|
||||
dispatachChars(node);
|
||||
this.m_contentHandler.processingInstruction("javax.xml.transform.enable-output-escaping", "");
|
||||
} else {
|
||||
dispatachChars(node);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
eref = (EntityReference)node;
|
||||
if (this.m_contentHandler instanceof LexicalHandler)
|
||||
((LexicalHandler)this.m_contentHandler).startEntity(eref.getNodeName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void endNode(Node node) throws SAXException {
|
||||
String ns;
|
||||
EntityReference eref;
|
||||
switch (node.getNodeType()) {
|
||||
case 1:
|
||||
ns = this.m_dh.getNamespaceOfNode(node);
|
||||
if (null == ns)
|
||||
ns = "";
|
||||
this.m_contentHandler.endElement(ns, this.m_dh.getLocalNameOfNode(node), node.getNodeName());
|
||||
if (this.m_Serializer == null) {
|
||||
Element elem_node = (Element)node;
|
||||
NamedNodeMap atts = elem_node.getAttributes();
|
||||
int nAttrs = atts.getLength();
|
||||
for (int i = nAttrs - 1; 0 <= i; i--) {
|
||||
Node attr = atts.item(i);
|
||||
String attrName = attr.getNodeName();
|
||||
int colon = attrName.indexOf(':');
|
||||
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) {
|
||||
String str;
|
||||
if (colon < 0) {
|
||||
str = "";
|
||||
} else {
|
||||
str = attrName.substring(colon + 1);
|
||||
}
|
||||
this.m_contentHandler.endPrefixMapping(str);
|
||||
} else if (colon > 0) {
|
||||
String str = attrName.substring(0, colon);
|
||||
this.m_contentHandler.endPrefixMapping(str);
|
||||
}
|
||||
}
|
||||
String uri = elem_node.getNamespaceURI();
|
||||
if (uri != null) {
|
||||
String prefix = elem_node.getPrefix();
|
||||
if (prefix == null)
|
||||
prefix = "";
|
||||
this.m_contentHandler.endPrefixMapping(prefix);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
eref = (EntityReference)node;
|
||||
if (this.m_contentHandler instanceof LexicalHandler) {
|
||||
LexicalHandler lh = (LexicalHandler)this.m_contentHandler;
|
||||
lh.endEntity(eref.getNodeName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
public final class Version {
|
||||
public static String getVersion() {
|
||||
return getProduct() + " " + getImplementationLanguage() + " " + getMajorVersionNum() + "." + getReleaseVersionNum() + "." + ((getDevelopmentVersionNum() > 0) ? ("D" + getDevelopmentVersionNum()) : ("" + getMaintenanceVersionNum()));
|
||||
}
|
||||
|
||||
public static void main(String[] argv) {
|
||||
System.out.println(getVersion());
|
||||
}
|
||||
|
||||
public static String getProduct() {
|
||||
return "Serializer";
|
||||
}
|
||||
|
||||
public static String getImplementationLanguage() {
|
||||
return "Java";
|
||||
}
|
||||
|
||||
public static int getMajorVersionNum() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static int getReleaseVersionNum() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
public static int getMaintenanceVersionNum() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int getDevelopmentVersionNum() {
|
||||
try {
|
||||
if (new String("").length() == 0)
|
||||
return 0;
|
||||
return Integer.parseInt("");
|
||||
} catch (NumberFormatException nfe) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
|
||||
interface WriterChain {
|
||||
void write(int paramInt) throws IOException;
|
||||
|
||||
void write(char[] paramArrayOfchar) throws IOException;
|
||||
|
||||
void write(char[] paramArrayOfchar, int paramInt1, int paramInt2) throws IOException;
|
||||
|
||||
void write(String paramString) throws IOException;
|
||||
|
||||
void write(String paramString, int paramInt1, int paramInt2) throws IOException;
|
||||
|
||||
void flush() throws IOException;
|
||||
|
||||
void close() throws IOException;
|
||||
|
||||
Writer getWriter();
|
||||
|
||||
OutputStream getOutputStream();
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
|
||||
class WriterToASCI extends Writer implements WriterChain {
|
||||
private final OutputStream m_os;
|
||||
|
||||
public WriterToASCI(OutputStream os) {
|
||||
this.m_os = os;
|
||||
}
|
||||
|
||||
public void write(char[] chars, int start, int length) throws IOException {
|
||||
int n = length + start;
|
||||
for (int i = start; i < n; i++)
|
||||
this.m_os.write(chars[i]);
|
||||
}
|
||||
|
||||
public void write(int c) throws IOException {
|
||||
this.m_os.write(c);
|
||||
}
|
||||
|
||||
public void write(String s) throws IOException {
|
||||
int n = s.length();
|
||||
for (int i = 0; i < n; i++)
|
||||
this.m_os.write(s.charAt(i));
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
this.m_os.flush();
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
this.m_os.close();
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return this.m_os;
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
|
||||
final class WriterToUTF8Buffered extends Writer implements WriterChain {
|
||||
private static final int BYTES_MAX = 16384;
|
||||
|
||||
private static final int CHARS_MAX = 5461;
|
||||
|
||||
private final OutputStream m_os;
|
||||
|
||||
private final byte[] m_outputBytes;
|
||||
|
||||
private final char[] m_inputChars;
|
||||
|
||||
private int count;
|
||||
|
||||
public WriterToUTF8Buffered(OutputStream out) {
|
||||
this.m_os = out;
|
||||
this.m_outputBytes = new byte[16387];
|
||||
this.m_inputChars = new char[5463];
|
||||
this.count = 0;
|
||||
}
|
||||
|
||||
public void write(int c) throws IOException {
|
||||
if (this.count >= 16384)
|
||||
flushBuffer();
|
||||
if (c < 128) {
|
||||
this.m_outputBytes[this.count++] = (byte)c;
|
||||
} else if (c < 2048) {
|
||||
this.m_outputBytes[this.count++] = (byte)(192 + (c >> 6));
|
||||
this.m_outputBytes[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
} else if (c < 65536) {
|
||||
this.m_outputBytes[this.count++] = (byte)(224 + (c >> 12));
|
||||
this.m_outputBytes[this.count++] = (byte)(128 + (c >> 6 & 0x3F));
|
||||
this.m_outputBytes[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
} else {
|
||||
this.m_outputBytes[this.count++] = (byte)(240 + (c >> 18));
|
||||
this.m_outputBytes[this.count++] = (byte)(128 + (c >> 12 & 0x3F));
|
||||
this.m_outputBytes[this.count++] = (byte)(128 + (c >> 6 & 0x3F));
|
||||
this.m_outputBytes[this.count++] = (byte)(128 + (c & 0x3F));
|
||||
}
|
||||
}
|
||||
|
||||
public void write(char[] chars, int start, int length) throws IOException {
|
||||
int lengthx3 = 3 * length;
|
||||
if (lengthx3 >= 16384 - this.count) {
|
||||
flushBuffer();
|
||||
if (lengthx3 > 16384) {
|
||||
int j;
|
||||
int split = length / 5461;
|
||||
if (length % 5461 > 0) {
|
||||
int chunks = split + 1;
|
||||
} else {
|
||||
j = split;
|
||||
}
|
||||
int end_chunk = start;
|
||||
for (int chunk = 1; chunk <= j; chunk++) {
|
||||
int start_chunk = end_chunk;
|
||||
end_chunk = start + (int)((long)length * (long)chunk / (long)j);
|
||||
char c1 = chars[end_chunk - 1];
|
||||
int ic = chars[end_chunk - 1];
|
||||
if (c1 >= '?' && c1 <= '?')
|
||||
if (end_chunk < start + length) {
|
||||
end_chunk++;
|
||||
} else {
|
||||
end_chunk--;
|
||||
}
|
||||
int len_chunk = end_chunk - start_chunk;
|
||||
write(chars, start_chunk, len_chunk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
int n = length + start;
|
||||
byte[] buf_loc = this.m_outputBytes;
|
||||
int count_loc = this.count;
|
||||
int i = start;
|
||||
char c;
|
||||
for (; i < n && (c = chars[i]) < '\u0080'; i++)
|
||||
buf_loc[count_loc++] = (byte)c;
|
||||
for (; i < n; i++) {
|
||||
c = chars[i];
|
||||
if (c < '\u0080') {
|
||||
buf_loc[count_loc++] = (byte)c;
|
||||
} else if (c < 'ࠀ') {
|
||||
buf_loc[count_loc++] = (byte)(192 + (c >> 6));
|
||||
buf_loc[count_loc++] = (byte)(128 + (c & 0x3F));
|
||||
} else if (c >= '?' && c <= '?') {
|
||||
char high = c;
|
||||
i++;
|
||||
char low = chars[i];
|
||||
buf_loc[count_loc++] = (byte)(0xF0 | high + 64 >> 8 & 0xF0);
|
||||
buf_loc[count_loc++] = (byte)(0x80 | high + 64 >> 2 & 0x3F);
|
||||
buf_loc[count_loc++] = (byte)(0x80 | (low >> 6 & 0xF) + (high << 4 & 0x30));
|
||||
buf_loc[count_loc++] = (byte)(0x80 | low & 0x3F);
|
||||
} else {
|
||||
buf_loc[count_loc++] = (byte)(224 + (c >> 12));
|
||||
buf_loc[count_loc++] = (byte)(128 + (c >> 6 & 0x3F));
|
||||
buf_loc[count_loc++] = (byte)(128 + (c & 0x3F));
|
||||
}
|
||||
}
|
||||
this.count = count_loc;
|
||||
}
|
||||
|
||||
public void write(String s) throws IOException {
|
||||
int length = s.length();
|
||||
int lengthx3 = 3 * length;
|
||||
if (lengthx3 >= 16384 - this.count) {
|
||||
flushBuffer();
|
||||
if (lengthx3 > 16384) {
|
||||
int j;
|
||||
int start = 0;
|
||||
int split = length / 5461;
|
||||
if (length % 5461 > 0) {
|
||||
int chunks = split + 1;
|
||||
} else {
|
||||
j = split;
|
||||
}
|
||||
int end_chunk = 0;
|
||||
for (int chunk = 1; chunk <= j; chunk++) {
|
||||
int start_chunk = end_chunk;
|
||||
end_chunk = 0 + (int)((long)length * (long)chunk / (long)j);
|
||||
s.getChars(start_chunk, end_chunk, this.m_inputChars, 0);
|
||||
int len_chunk = end_chunk - start_chunk;
|
||||
char c1 = this.m_inputChars[len_chunk - 1];
|
||||
if (c1 >= '?' && c1 <= '?') {
|
||||
end_chunk--;
|
||||
len_chunk--;
|
||||
if (chunk == j);
|
||||
}
|
||||
write(this.m_inputChars, 0, len_chunk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
s.getChars(0, length, this.m_inputChars, 0);
|
||||
char[] chars = this.m_inputChars;
|
||||
int n = length;
|
||||
byte[] buf_loc = this.m_outputBytes;
|
||||
int count_loc = this.count;
|
||||
int i = 0;
|
||||
char c;
|
||||
for (; i < n && (c = chars[i]) < '\u0080'; i++)
|
||||
buf_loc[count_loc++] = (byte)c;
|
||||
for (; i < n; i++) {
|
||||
c = chars[i];
|
||||
if (c < '\u0080') {
|
||||
buf_loc[count_loc++] = (byte)c;
|
||||
} else if (c < 'ࠀ') {
|
||||
buf_loc[count_loc++] = (byte)(192 + (c >> 6));
|
||||
buf_loc[count_loc++] = (byte)(128 + (c & 0x3F));
|
||||
} else if (c >= '?' && c <= '?') {
|
||||
char high = c;
|
||||
i++;
|
||||
char low = chars[i];
|
||||
buf_loc[count_loc++] = (byte)(0xF0 | high + 64 >> 8 & 0xF0);
|
||||
buf_loc[count_loc++] = (byte)(0x80 | high + 64 >> 2 & 0x3F);
|
||||
buf_loc[count_loc++] = (byte)(0x80 | (low >> 6 & 0xF) + (high << 4 & 0x30));
|
||||
buf_loc[count_loc++] = (byte)(0x80 | low & 0x3F);
|
||||
} else {
|
||||
buf_loc[count_loc++] = (byte)(224 + (c >> 12));
|
||||
buf_loc[count_loc++] = (byte)(128 + (c >> 6 & 0x3F));
|
||||
buf_loc[count_loc++] = (byte)(128 + (c & 0x3F));
|
||||
}
|
||||
}
|
||||
this.count = count_loc;
|
||||
}
|
||||
|
||||
public void flushBuffer() throws IOException {
|
||||
if (this.count > 0) {
|
||||
this.m_os.write(this.m_outputBytes, 0, this.count);
|
||||
this.count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
flushBuffer();
|
||||
this.m_os.flush();
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
flushBuffer();
|
||||
this.m_os.close();
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return this.m_os;
|
||||
}
|
||||
|
||||
public Writer getWriter() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
##
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
##
|
||||
#
|
||||
# $Id: XMLEntities.properties 468654 2006-10-28 07:09:23Z minchau $
|
||||
#
|
||||
# @version $Revision$ $Date: 2006-10-28 03:09:23 -0400 (Sat, 28 Oct 2006) $
|
||||
# This file must be encoded in UTF-8; see CharInfo.java
|
||||
#
|
||||
# Character entity references for markup-significant
|
||||
#
|
||||
quot=34
|
||||
amp=38
|
||||
lt=60
|
||||
gt=62
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package org.apache.xml.serializer;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
interface XSLOutputAttributes {
|
||||
String getDoctypePublic();
|
||||
|
||||
String getDoctypeSystem();
|
||||
|
||||
String getEncoding();
|
||||
|
||||
boolean getIndent();
|
||||
|
||||
int getIndentAmount();
|
||||
|
||||
String getMediaType();
|
||||
|
||||
boolean getOmitXMLDeclaration();
|
||||
|
||||
String getStandalone();
|
||||
|
||||
String getVersion();
|
||||
|
||||
void setCdataSectionElements(Vector paramVector);
|
||||
|
||||
void setDoctype(String paramString1, String paramString2);
|
||||
|
||||
void setDoctypePublic(String paramString);
|
||||
|
||||
void setDoctypeSystem(String paramString);
|
||||
|
||||
void setEncoding(String paramString);
|
||||
|
||||
void setIndent(boolean paramBoolean);
|
||||
|
||||
void setMediaType(String paramString);
|
||||
|
||||
void setOmitXMLDeclaration(boolean paramBoolean);
|
||||
|
||||
void setStandalone(String paramString);
|
||||
|
||||
void setVersion(String paramString);
|
||||
|
||||
String getOutputProperty(String paramString);
|
||||
|
||||
String getOutputPropertyDefault(String paramString);
|
||||
|
||||
void setOutputProperty(String paramString1, String paramString2);
|
||||
|
||||
void setOutputPropertyDefault(String paramString1, String paramString2);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.xml.serializer.DOM3Serializer;
|
||||
import org.apache.xml.serializer.SerializationHandler;
|
||||
import org.apache.xml.serializer.utils.WrappedRuntimeException;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.ls.LSSerializerFilter;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public final class DOM3SerializerImpl implements DOM3Serializer {
|
||||
private DOMErrorHandler fErrorHandler;
|
||||
|
||||
private LSSerializerFilter fSerializerFilter;
|
||||
|
||||
private String fNewLine;
|
||||
|
||||
private SerializationHandler fSerializationHandler;
|
||||
|
||||
public DOM3SerializerImpl(SerializationHandler handler) {
|
||||
this.fSerializationHandler = handler;
|
||||
}
|
||||
|
||||
public DOMErrorHandler getErrorHandler() {
|
||||
return this.fErrorHandler;
|
||||
}
|
||||
|
||||
public LSSerializerFilter getNodeFilter() {
|
||||
return this.fSerializerFilter;
|
||||
}
|
||||
|
||||
public char[] getNewLine() {
|
||||
return (this.fNewLine != null) ? this.fNewLine.toCharArray() : null;
|
||||
}
|
||||
|
||||
public void serializeDOM3(Node node) throws IOException {
|
||||
try {
|
||||
DOM3TreeWalker walker = new DOM3TreeWalker(this.fSerializationHandler, this.fErrorHandler, this.fSerializerFilter, this.fNewLine);
|
||||
walker.traverse(node);
|
||||
} catch (SAXException se) {
|
||||
throw new WrappedRuntimeException(se);
|
||||
}
|
||||
}
|
||||
|
||||
public void setErrorHandler(DOMErrorHandler handler) {
|
||||
this.fErrorHandler = handler;
|
||||
}
|
||||
|
||||
public void setNodeFilter(LSSerializerFilter filter) {
|
||||
this.fSerializerFilter = filter;
|
||||
}
|
||||
|
||||
public void setSerializationHandler(SerializationHandler handler) {
|
||||
this.fSerializationHandler = handler;
|
||||
}
|
||||
|
||||
public void setNewLine(char[] newLine) {
|
||||
this.fNewLine = (newLine != null) ? new String(newLine) : null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,978 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import org.apache.xml.serializer.SerializationHandler;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.apache.xml.serializer.utils.XML11Char;
|
||||
import org.apache.xml.serializer.utils.XMLChar;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.CDATASection;
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentType;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Entity;
|
||||
import org.w3c.dom.EntityReference;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.ProcessingInstruction;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.ls.LSSerializerFilter;
|
||||
import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
import org.xml.sax.helpers.LocatorImpl;
|
||||
|
||||
final class DOM3TreeWalker {
|
||||
private SerializationHandler fSerializer = null;
|
||||
|
||||
private LocatorImpl fLocator = new LocatorImpl();
|
||||
|
||||
private DOMErrorHandler fErrorHandler = null;
|
||||
|
||||
private LSSerializerFilter fFilter = null;
|
||||
|
||||
private LexicalHandler fLexicalHandler = null;
|
||||
|
||||
private int fWhatToShowFilter;
|
||||
|
||||
private String fNewLine = null;
|
||||
|
||||
private Properties fDOMConfigProperties = null;
|
||||
|
||||
private boolean fInEntityRef = false;
|
||||
|
||||
private String fXMLVersion = null;
|
||||
|
||||
private boolean fIsXMLVersion11 = false;
|
||||
|
||||
private boolean fIsLevel3DOM = false;
|
||||
|
||||
private int fFeatures = 0;
|
||||
|
||||
boolean fNextIsRaw = false;
|
||||
|
||||
private static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
|
||||
|
||||
private static final String XMLNS_PREFIX = "xmlns";
|
||||
|
||||
private static final String XML_URI = "http://www.w3.org/XML/1998/namespace";
|
||||
|
||||
private static final String XML_PREFIX = "xml";
|
||||
|
||||
protected NamespaceSupport fNSBinder;
|
||||
|
||||
protected NamespaceSupport fLocalNSBinder;
|
||||
|
||||
private int fElementDepth = 0;
|
||||
|
||||
private static final int CANONICAL = 1;
|
||||
|
||||
private static final int CDATA = 2;
|
||||
|
||||
private static final int CHARNORMALIZE = 4;
|
||||
|
||||
private static final int COMMENTS = 8;
|
||||
|
||||
private static final int DTNORMALIZE = 16;
|
||||
|
||||
private static final int ELEM_CONTENT_WHITESPACE = 32;
|
||||
|
||||
private static final int ENTITIES = 64;
|
||||
|
||||
private static final int INFOSET = 128;
|
||||
|
||||
private static final int NAMESPACES = 256;
|
||||
|
||||
private static final int NAMESPACEDECLS = 512;
|
||||
|
||||
private static final int NORMALIZECHARS = 1024;
|
||||
|
||||
private static final int SPLITCDATA = 2048;
|
||||
|
||||
private static final int VALIDATE = 4096;
|
||||
|
||||
private static final int SCHEMAVALIDATE = 8192;
|
||||
|
||||
private static final int WELLFORMED = 16384;
|
||||
|
||||
private static final int DISCARDDEFAULT = 32768;
|
||||
|
||||
private static final int PRETTY_PRINT = 65536;
|
||||
|
||||
private static final int IGNORE_CHAR_DENORMALIZE = 131072;
|
||||
|
||||
private static final int XMLDECL = 262144;
|
||||
|
||||
DOM3TreeWalker(SerializationHandler serialHandler, DOMErrorHandler errHandler, LSSerializerFilter filter, String newLine) {
|
||||
this.fSerializer = serialHandler;
|
||||
this.fErrorHandler = errHandler;
|
||||
this.fFilter = filter;
|
||||
this.fLexicalHandler = null;
|
||||
this.fNewLine = newLine;
|
||||
this.fNSBinder = new NamespaceSupport();
|
||||
this.fLocalNSBinder = new NamespaceSupport();
|
||||
this.fDOMConfigProperties = this.fSerializer.getOutputFormat();
|
||||
this.fSerializer.setDocumentLocator(this.fLocator);
|
||||
initProperties(this.fDOMConfigProperties);
|
||||
try {
|
||||
this.fLocator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl");
|
||||
} catch (SecurityException se) {}
|
||||
}
|
||||
|
||||
public void traverse(Node pos) throws SAXException {
|
||||
this.fSerializer.startDocument();
|
||||
if (pos.getNodeType() != 9) {
|
||||
Document ownerDoc = pos.getOwnerDocument();
|
||||
if (ownerDoc != null && ownerDoc.getImplementation().hasFeature("Core", "3.0"))
|
||||
this.fIsLevel3DOM = true;
|
||||
} else if (((Document)pos).getImplementation().hasFeature("Core", "3.0")) {
|
||||
this.fIsLevel3DOM = true;
|
||||
}
|
||||
if (this.fSerializer instanceof LexicalHandler)
|
||||
this.fLexicalHandler = this.fSerializer;
|
||||
if (this.fFilter != null)
|
||||
this.fWhatToShowFilter = this.fFilter.getWhatToShow();
|
||||
Node top = pos;
|
||||
while (null != pos) {
|
||||
startNode(pos);
|
||||
Node nextNode = null;
|
||||
nextNode = pos.getFirstChild();
|
||||
while (null == nextNode) {
|
||||
endNode(pos);
|
||||
if (top.equals(pos))
|
||||
break;
|
||||
nextNode = pos.getNextSibling();
|
||||
if (null == nextNode) {
|
||||
pos = pos.getParentNode();
|
||||
if (null == pos || top.equals(pos)) {
|
||||
if (null != pos)
|
||||
endNode(pos);
|
||||
nextNode = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos = nextNode;
|
||||
}
|
||||
this.fSerializer.endDocument();
|
||||
}
|
||||
|
||||
public void traverse(Node pos, Node top) throws SAXException {
|
||||
this.fSerializer.startDocument();
|
||||
if (pos.getNodeType() != 9) {
|
||||
Document ownerDoc = pos.getOwnerDocument();
|
||||
if (ownerDoc != null && ownerDoc.getImplementation().hasFeature("Core", "3.0"))
|
||||
this.fIsLevel3DOM = true;
|
||||
} else if (((Document)pos).getImplementation().hasFeature("Core", "3.0")) {
|
||||
this.fIsLevel3DOM = true;
|
||||
}
|
||||
if (this.fSerializer instanceof LexicalHandler)
|
||||
this.fLexicalHandler = this.fSerializer;
|
||||
if (this.fFilter != null)
|
||||
this.fWhatToShowFilter = this.fFilter.getWhatToShow();
|
||||
while (null != pos) {
|
||||
startNode(pos);
|
||||
Node nextNode = null;
|
||||
nextNode = pos.getFirstChild();
|
||||
while (null == nextNode) {
|
||||
endNode(pos);
|
||||
if (null != top && top.equals(pos))
|
||||
break;
|
||||
nextNode = pos.getNextSibling();
|
||||
if (null == nextNode) {
|
||||
pos = pos.getParentNode();
|
||||
if (null == pos || (null != top && top.equals(pos))) {
|
||||
nextNode = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos = nextNode;
|
||||
}
|
||||
this.fSerializer.endDocument();
|
||||
}
|
||||
|
||||
private final void dispatachChars(Node node) throws SAXException {
|
||||
if (this.fSerializer != null) {
|
||||
this.fSerializer.characters(node);
|
||||
} else {
|
||||
String data = ((Text)node).getData();
|
||||
this.fSerializer.characters(data.toCharArray(), 0, data.length());
|
||||
}
|
||||
}
|
||||
|
||||
protected void startNode(Node node) throws SAXException {
|
||||
if (node instanceof Locator) {
|
||||
Locator loc = (Locator)node;
|
||||
this.fLocator.setColumnNumber(loc.getColumnNumber());
|
||||
this.fLocator.setLineNumber(loc.getLineNumber());
|
||||
this.fLocator.setPublicId(loc.getPublicId());
|
||||
this.fLocator.setSystemId(loc.getSystemId());
|
||||
} else {
|
||||
this.fLocator.setColumnNumber(0);
|
||||
this.fLocator.setLineNumber(0);
|
||||
}
|
||||
switch (node.getNodeType()) {
|
||||
case 10:
|
||||
serializeDocType((DocumentType)node, true);
|
||||
break;
|
||||
case 8:
|
||||
serializeComment((Comment)node);
|
||||
break;
|
||||
case 1:
|
||||
serializeElement((Element)node, true);
|
||||
break;
|
||||
case 7:
|
||||
serializePI((ProcessingInstruction)node);
|
||||
break;
|
||||
case 4:
|
||||
serializeCDATASection((CDATASection)node);
|
||||
break;
|
||||
case 3:
|
||||
serializeText((Text)node);
|
||||
break;
|
||||
case 5:
|
||||
serializeEntityReference((EntityReference)node, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void endNode(Node node) throws SAXException {
|
||||
switch (node.getNodeType()) {
|
||||
case 10:
|
||||
serializeDocType((DocumentType)node, false);
|
||||
break;
|
||||
case 1:
|
||||
serializeElement((Element)node, false);
|
||||
break;
|
||||
case 5:
|
||||
serializeEntityReference((EntityReference)node, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean applyFilter(Node node, int nodeType) {
|
||||
if (this.fFilter != null && (this.fWhatToShowFilter & nodeType) != 0) {
|
||||
short code = this.fFilter.acceptNode(node);
|
||||
switch (code) {
|
||||
case 2:
|
||||
case 3:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void serializeDocType(DocumentType node, boolean bStart) throws SAXException {
|
||||
String docTypeName = node.getNodeName();
|
||||
String publicId = node.getPublicId();
|
||||
String systemId = node.getSystemId();
|
||||
String internalSubset = node.getInternalSubset();
|
||||
if (internalSubset != null && !"".equals(internalSubset)) {
|
||||
if (bStart)
|
||||
try {
|
||||
Writer writer = this.fSerializer.getWriter();
|
||||
StringBuffer dtd = new StringBuffer();
|
||||
dtd.append("<!DOCTYPE ");
|
||||
dtd.append(docTypeName);
|
||||
if (null != publicId) {
|
||||
dtd.append(" PUBLIC \"");
|
||||
dtd.append(publicId);
|
||||
dtd.append('"');
|
||||
}
|
||||
if (null != systemId) {
|
||||
if (null == publicId) {
|
||||
dtd.append(" SYSTEM \"");
|
||||
} else {
|
||||
dtd.append(" \"");
|
||||
}
|
||||
dtd.append(systemId);
|
||||
dtd.append('"');
|
||||
}
|
||||
dtd.append(" [ ");
|
||||
dtd.append(this.fNewLine);
|
||||
dtd.append(internalSubset);
|
||||
dtd.append("]>");
|
||||
dtd.append(new String(this.fNewLine));
|
||||
writer.write(dtd.toString());
|
||||
writer.flush();
|
||||
} catch (IOException e) {
|
||||
throw new SAXException(Utils.messages.createMessage("ER_WRITING_INTERNAL_SUBSET", null), e);
|
||||
}
|
||||
} else if (bStart) {
|
||||
if (this.fLexicalHandler != null)
|
||||
this.fLexicalHandler.startDTD(docTypeName, publicId, systemId);
|
||||
} else if (this.fLexicalHandler != null) {
|
||||
this.fLexicalHandler.endDTD();
|
||||
}
|
||||
}
|
||||
|
||||
protected void serializeComment(Comment node) throws SAXException {
|
||||
if ((this.fFeatures & 0x8) != 0) {
|
||||
String data = node.getData();
|
||||
if ((this.fFeatures & 0x4000) != 0)
|
||||
isCommentWellFormed(data);
|
||||
if (this.fLexicalHandler != null) {
|
||||
if (!applyFilter(node, 128))
|
||||
return;
|
||||
this.fLexicalHandler.comment(data.toCharArray(), 0, data.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void serializeElement(Element node, boolean bStart) throws SAXException {
|
||||
if (bStart) {
|
||||
this.fElementDepth++;
|
||||
if ((this.fFeatures & 0x4000) != 0)
|
||||
isElementWellFormed(node);
|
||||
if (!applyFilter(node, 1))
|
||||
return;
|
||||
if ((this.fFeatures & 0x100) != 0) {
|
||||
this.fNSBinder.pushContext();
|
||||
this.fLocalNSBinder.reset();
|
||||
recordLocalNSDecl(node);
|
||||
fixupElementNS(node);
|
||||
}
|
||||
this.fSerializer.startElement(node.getNamespaceURI(), node.getLocalName(), node.getNodeName());
|
||||
serializeAttList(node);
|
||||
} else {
|
||||
this.fElementDepth--;
|
||||
if (!applyFilter(node, 1))
|
||||
return;
|
||||
this.fSerializer.endElement(node.getNamespaceURI(), node.getLocalName(), node.getNodeName());
|
||||
if ((this.fFeatures & 0x100) != 0)
|
||||
this.fNSBinder.popContext();
|
||||
}
|
||||
}
|
||||
|
||||
protected void serializeAttList(Element node) throws SAXException {
|
||||
NamedNodeMap atts = node.getAttributes();
|
||||
int nAttrs = atts.getLength();
|
||||
for (int i = 0; i < nAttrs; i++) {
|
||||
Node attr = atts.item(i);
|
||||
String localName = attr.getLocalName();
|
||||
String attrName = attr.getNodeName();
|
||||
String attrPrefix = (attr.getPrefix() == null) ? "" : attr.getPrefix();
|
||||
String attrValue = attr.getNodeValue();
|
||||
String type = null;
|
||||
if (this.fIsLevel3DOM)
|
||||
type = ((Attr)attr).getSchemaTypeInfo().getTypeName();
|
||||
type = (type == null) ? "CDATA" : type;
|
||||
String attrNS = attr.getNamespaceURI();
|
||||
if (attrNS != null && attrNS.length() == 0) {
|
||||
attrNS = null;
|
||||
attrName = attr.getLocalName();
|
||||
}
|
||||
boolean isSpecified = ((Attr)attr).getSpecified();
|
||||
boolean addAttr = true;
|
||||
boolean applyFilter = false;
|
||||
boolean xmlnsAttr = (attrName.equals("xmlns") || attrName.startsWith("xmlns:"));
|
||||
if ((this.fFeatures & 0x4000) != 0)
|
||||
isAttributeWellFormed(attr);
|
||||
if ((this.fFeatures & 0x100) != 0 && !xmlnsAttr)
|
||||
if (attrNS != null) {
|
||||
attrPrefix = (attrPrefix == null) ? "" : attrPrefix;
|
||||
String declAttrPrefix = this.fNSBinder.getPrefix(attrNS);
|
||||
String declAttrNS = this.fNSBinder.getURI(attrPrefix);
|
||||
if ("".equals(attrPrefix) || "".equals(declAttrPrefix) || !attrPrefix.equals(declAttrPrefix))
|
||||
if (declAttrPrefix != null && !"".equals(declAttrPrefix)) {
|
||||
attrPrefix = declAttrPrefix;
|
||||
if (declAttrPrefix.length() > 0) {
|
||||
attrName = declAttrPrefix + ":" + localName;
|
||||
} else {
|
||||
attrName = localName;
|
||||
}
|
||||
} else if (attrPrefix != null && !"".equals(attrPrefix) && declAttrNS == null) {
|
||||
if ((this.fFeatures & 0x200) != 0) {
|
||||
this.fSerializer.addAttribute("http://www.w3.org/2000/xmlns/", attrPrefix, "xmlns:" + attrPrefix, "CDATA", attrNS);
|
||||
this.fNSBinder.declarePrefix(attrPrefix, attrNS);
|
||||
this.fLocalNSBinder.declarePrefix(attrPrefix, attrNS);
|
||||
}
|
||||
} else {
|
||||
int counter = 1;
|
||||
attrPrefix = "NS" + counter++;
|
||||
while (this.fLocalNSBinder.getURI(attrPrefix) != null)
|
||||
attrPrefix = "NS" + counter++;
|
||||
attrName = attrPrefix + ":" + localName;
|
||||
if ((this.fFeatures & 0x200) != 0) {
|
||||
this.fSerializer.addAttribute("http://www.w3.org/2000/xmlns/", attrPrefix, "xmlns:" + attrPrefix, "CDATA", attrNS);
|
||||
this.fNSBinder.declarePrefix(attrPrefix, attrNS);
|
||||
this.fLocalNSBinder.declarePrefix(attrPrefix, attrNS);
|
||||
}
|
||||
}
|
||||
} else if (localName == null) {
|
||||
String msg = Utils.messages.createMessage("ER_NULL_LOCAL_ELEMENT_NAME", new Object[] { attrName });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)2, msg, "ER_NULL_LOCAL_ELEMENT_NAME", null, null, null));
|
||||
}
|
||||
if (((this.fFeatures & 0x8000) != 0 && isSpecified) || (this.fFeatures & 0x8000) == 0) {
|
||||
applyFilter = true;
|
||||
} else {
|
||||
addAttr = false;
|
||||
}
|
||||
if (applyFilter)
|
||||
if (this.fFilter != null && (this.fFilter.getWhatToShow() & 0x2) != 0)
|
||||
if (!xmlnsAttr) {
|
||||
short code = this.fFilter.acceptNode(attr);
|
||||
switch (code) {
|
||||
case 2:
|
||||
case 3:
|
||||
addAttr = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (addAttr && xmlnsAttr) {
|
||||
if ((this.fFeatures & 0x200) != 0)
|
||||
if (localName != null && !"".equals(localName))
|
||||
this.fSerializer.addAttribute(attrNS, localName, attrName, type, attrValue);
|
||||
} else if (addAttr && !xmlnsAttr) {
|
||||
if ((this.fFeatures & 0x200) != 0 && attrNS != null) {
|
||||
this.fSerializer.addAttribute(attrNS, localName, attrName, type, attrValue);
|
||||
} else {
|
||||
this.fSerializer.addAttribute("", localName, attrName, type, attrValue);
|
||||
}
|
||||
}
|
||||
if (xmlnsAttr && (this.fFeatures & 0x200) != 0) {
|
||||
int index;
|
||||
String prefix = ((index = attrName.indexOf(":")) < 0) ? "" : attrName.substring(index + 1);
|
||||
if (!"".equals(prefix))
|
||||
this.fSerializer.namespaceAfterStartElement(prefix, attrValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void serializePI(ProcessingInstruction node) throws SAXException {
|
||||
ProcessingInstruction pi = node;
|
||||
String name = pi.getNodeName();
|
||||
if ((this.fFeatures & 0x4000) != 0)
|
||||
isPIWellFormed(node);
|
||||
if (!applyFilter(node, 64))
|
||||
return;
|
||||
if (name.equals("xslt-next-is-raw")) {
|
||||
this.fNextIsRaw = true;
|
||||
} else {
|
||||
this.fSerializer.processingInstruction(name, pi.getData());
|
||||
}
|
||||
}
|
||||
|
||||
protected void serializeCDATASection(CDATASection node) throws SAXException {
|
||||
if ((this.fFeatures & 0x4000) != 0)
|
||||
isCDATASectionWellFormed(node);
|
||||
if ((this.fFeatures & 0x2) != 0) {
|
||||
String nodeValue = node.getNodeValue();
|
||||
int endIndex = nodeValue.indexOf("]]>");
|
||||
if ((this.fFeatures & 0x800) != 0) {
|
||||
if (endIndex >= 0) {
|
||||
String relatedData = nodeValue.substring(0, endIndex + 2);
|
||||
String msg = Utils.messages.createMessage("cdata-sections-splitted", null);
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)1, msg, "cdata-sections-splitted", null, relatedData, null));
|
||||
}
|
||||
} else if (endIndex >= 0) {
|
||||
String relatedData = nodeValue.substring(0, endIndex + 2);
|
||||
String msg = Utils.messages.createMessage("cdata-sections-splitted", null);
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)2, msg, "cdata-sections-splitted"));
|
||||
return;
|
||||
}
|
||||
if (!applyFilter(node, 8))
|
||||
return;
|
||||
if (this.fLexicalHandler != null)
|
||||
this.fLexicalHandler.startCDATA();
|
||||
dispatachChars(node);
|
||||
if (this.fLexicalHandler != null)
|
||||
this.fLexicalHandler.endCDATA();
|
||||
} else {
|
||||
dispatachChars(node);
|
||||
}
|
||||
}
|
||||
|
||||
protected void serializeText(Text node) throws SAXException {
|
||||
if (this.fNextIsRaw) {
|
||||
this.fNextIsRaw = false;
|
||||
this.fSerializer.processingInstruction("javax.xml.transform.disable-output-escaping", "");
|
||||
dispatachChars(node);
|
||||
this.fSerializer.processingInstruction("javax.xml.transform.enable-output-escaping", "");
|
||||
} else {
|
||||
boolean bDispatch = false;
|
||||
if ((this.fFeatures & 0x4000) != 0)
|
||||
isTextWellFormed(node);
|
||||
boolean isElementContentWhitespace = false;
|
||||
if (this.fIsLevel3DOM)
|
||||
isElementContentWhitespace = node.isElementContentWhitespace();
|
||||
if (isElementContentWhitespace) {
|
||||
if ((this.fFeatures & 0x20) != 0)
|
||||
bDispatch = true;
|
||||
} else {
|
||||
bDispatch = true;
|
||||
}
|
||||
if (!applyFilter(node, 4))
|
||||
return;
|
||||
if (bDispatch)
|
||||
dispatachChars(node);
|
||||
}
|
||||
}
|
||||
|
||||
protected void serializeEntityReference(EntityReference node, boolean bStart) throws SAXException {
|
||||
if (bStart) {
|
||||
EntityReference eref = node;
|
||||
if ((this.fFeatures & 0x40) != 0) {
|
||||
if ((this.fFeatures & 0x4000) != 0)
|
||||
isEntityReferneceWellFormed(node);
|
||||
if ((this.fFeatures & 0x100) != 0)
|
||||
checkUnboundPrefixInEntRef(node);
|
||||
}
|
||||
if (this.fLexicalHandler != null)
|
||||
this.fLexicalHandler.startEntity(eref.getNodeName());
|
||||
} else {
|
||||
EntityReference eref = node;
|
||||
if (this.fLexicalHandler != null)
|
||||
this.fLexicalHandler.endEntity(eref.getNodeName());
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isXMLName(String s, boolean xml11Version) {
|
||||
if (s == null)
|
||||
return false;
|
||||
if (!xml11Version)
|
||||
return XMLChar.isValidName(s);
|
||||
return XML11Char.isXML11ValidName(s);
|
||||
}
|
||||
|
||||
protected boolean isValidQName(String prefix, String local, boolean xml11Version) {
|
||||
if (local == null)
|
||||
return false;
|
||||
boolean validNCName = false;
|
||||
if (!xml11Version) {
|
||||
validNCName = ((prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local));
|
||||
} else {
|
||||
validNCName = ((prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local));
|
||||
}
|
||||
return validNCName;
|
||||
}
|
||||
|
||||
protected boolean isWFXMLChar(String chardata, Character refInvalidChar) {
|
||||
if (chardata == null || chardata.length() == 0)
|
||||
return true;
|
||||
char[] dataarray = chardata.toCharArray();
|
||||
int datalength = dataarray.length;
|
||||
if (this.fIsXMLVersion11) {
|
||||
int i = 0;
|
||||
while (i < datalength) {
|
||||
if (XML11Char.isXML11Invalid(dataarray[i++])) {
|
||||
char ch = dataarray[i - 1];
|
||||
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
|
||||
char ch2 = dataarray[i++];
|
||||
if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental(XMLChar.supplemental(ch, ch2)))
|
||||
continue;
|
||||
}
|
||||
refInvalidChar = new Character(ch);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int i = 0;
|
||||
while (i < datalength) {
|
||||
if (XMLChar.isInvalid(dataarray[i++])) {
|
||||
char ch = dataarray[i - 1];
|
||||
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
|
||||
char ch2 = dataarray[i++];
|
||||
if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental(XMLChar.supplemental(ch, ch2)))
|
||||
continue;
|
||||
}
|
||||
refInvalidChar = new Character(ch);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Character isWFXMLChar(String chardata) {
|
||||
if (chardata == null || chardata.length() == 0)
|
||||
return null;
|
||||
char[] dataarray = chardata.toCharArray();
|
||||
int datalength = dataarray.length;
|
||||
if (this.fIsXMLVersion11) {
|
||||
int i = 0;
|
||||
while (i < datalength) {
|
||||
if (XML11Char.isXML11Invalid(dataarray[i++])) {
|
||||
char ch = dataarray[i - 1];
|
||||
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
|
||||
char ch2 = dataarray[i++];
|
||||
if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental(XMLChar.supplemental(ch, ch2)))
|
||||
continue;
|
||||
}
|
||||
Character refInvalidChar = new Character(ch);
|
||||
return refInvalidChar;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int i = 0;
|
||||
while (i < datalength) {
|
||||
if (XMLChar.isInvalid(dataarray[i++])) {
|
||||
char ch = dataarray[i - 1];
|
||||
if (XMLChar.isHighSurrogate(ch) && i < datalength) {
|
||||
char ch2 = dataarray[i++];
|
||||
if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental(XMLChar.supplemental(ch, ch2)))
|
||||
continue;
|
||||
}
|
||||
return new Character(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void isCommentWellFormed(String data) {
|
||||
if (data == null || data.length() == 0)
|
||||
return;
|
||||
char[] dataarray = data.toCharArray();
|
||||
int datalength = dataarray.length;
|
||||
if (this.fIsXMLVersion11) {
|
||||
int i = 0;
|
||||
while (i < datalength) {
|
||||
char c = dataarray[i++];
|
||||
if (XML11Char.isXML11Invalid(c)) {
|
||||
if (XMLChar.isHighSurrogate(c) && i < datalength) {
|
||||
char c2 = dataarray[i++];
|
||||
if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental(XMLChar.supplemental(c, c2)))
|
||||
continue;
|
||||
}
|
||||
String msg = Utils.messages.createMessage("ER_WF_INVALID_CHARACTER_IN_COMMENT", new Object[] { new Character(c) });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character", null, null, null));
|
||||
continue;
|
||||
}
|
||||
if (c == '-' && i < datalength && dataarray[i] == '-') {
|
||||
String msg = Utils.messages.createMessage("ER_WF_DASH_IN_COMMENT", null);
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character", null, null, null));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int i = 0;
|
||||
while (i < datalength) {
|
||||
char c = dataarray[i++];
|
||||
if (XMLChar.isInvalid(c)) {
|
||||
if (XMLChar.isHighSurrogate(c) && i < datalength) {
|
||||
char c2 = dataarray[i++];
|
||||
if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental(XMLChar.supplemental(c, c2)))
|
||||
continue;
|
||||
}
|
||||
String msg = Utils.messages.createMessage("ER_WF_INVALID_CHARACTER_IN_COMMENT", new Object[] { new Character(c) });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character", null, null, null));
|
||||
continue;
|
||||
}
|
||||
if (c == '-' && i < datalength && dataarray[i] == '-') {
|
||||
String msg = Utils.messages.createMessage("ER_WF_DASH_IN_COMMENT", null);
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character", null, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void isElementWellFormed(Node node) {
|
||||
boolean isNameWF = false;
|
||||
if ((this.fFeatures & 0x100) != 0) {
|
||||
isNameWF = isValidQName(node.getPrefix(), node.getLocalName(), this.fIsXMLVersion11);
|
||||
} else {
|
||||
isNameWF = isXMLName(node.getNodeName(), this.fIsXMLVersion11);
|
||||
}
|
||||
if (!isNameWF) {
|
||||
String msg = Utils.messages.createMessage("wf-invalid-character-in-node-name", new Object[] { "Element", node.getNodeName() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character-in-node-name", null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
protected void isAttributeWellFormed(Node node) {
|
||||
boolean isNameWF = false;
|
||||
if ((this.fFeatures & 0x100) != 0) {
|
||||
isNameWF = isValidQName(node.getPrefix(), node.getLocalName(), this.fIsXMLVersion11);
|
||||
} else {
|
||||
isNameWF = isXMLName(node.getNodeName(), this.fIsXMLVersion11);
|
||||
}
|
||||
if (!isNameWF) {
|
||||
String msg = Utils.messages.createMessage("wf-invalid-character-in-node-name", new Object[] { "Attr", node.getNodeName() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character-in-node-name", null, null, null));
|
||||
}
|
||||
String value = node.getNodeValue();
|
||||
if (value.indexOf('<') >= 0) {
|
||||
String msg = Utils.messages.createMessage("ER_WF_LT_IN_ATTVAL", new Object[] { ((Attr)node).getOwnerElement().getNodeName(), node.getNodeName() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "ER_WF_LT_IN_ATTVAL", null, null, null));
|
||||
}
|
||||
NodeList children = node.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
Node child = children.item(i);
|
||||
if (child != null)
|
||||
switch (child.getNodeType()) {
|
||||
case 3:
|
||||
isTextWellFormed((Text)child);
|
||||
break;
|
||||
case 5:
|
||||
isEntityReferneceWellFormed((EntityReference)child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void isPIWellFormed(ProcessingInstruction node) {
|
||||
if (!isXMLName(node.getNodeName(), this.fIsXMLVersion11)) {
|
||||
String msg = Utils.messages.createMessage("wf-invalid-character-in-node-name", new Object[] { "ProcessingInstruction", node.getTarget() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character-in-node-name", null, null, null));
|
||||
}
|
||||
Character invalidChar = isWFXMLChar(node.getData());
|
||||
if (invalidChar != null) {
|
||||
String msg = Utils.messages.createMessage("ER_WF_INVALID_CHARACTER_IN_PI", new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character", null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
protected void isCDATASectionWellFormed(CDATASection node) {
|
||||
Character invalidChar = isWFXMLChar(node.getData());
|
||||
if (invalidChar != null) {
|
||||
String msg = Utils.messages.createMessage("ER_WF_INVALID_CHARACTER_IN_CDATA", new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character", null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
protected void isTextWellFormed(Text node) {
|
||||
Character invalidChar = isWFXMLChar(node.getData());
|
||||
if (invalidChar != null) {
|
||||
String msg = Utils.messages.createMessage("ER_WF_INVALID_CHARACTER_IN_TEXT", new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character", null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
protected void isEntityReferneceWellFormed(EntityReference node) {
|
||||
if (!isXMLName(node.getNodeName(), this.fIsXMLVersion11)) {
|
||||
String msg = Utils.messages.createMessage("wf-invalid-character-in-node-name", new Object[] { "EntityReference", node.getNodeName() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "wf-invalid-character-in-node-name", null, null, null));
|
||||
}
|
||||
Node parent = node.getParentNode();
|
||||
DocumentType docType = node.getOwnerDocument().getDoctype();
|
||||
if (docType != null) {
|
||||
NamedNodeMap entities = docType.getEntities();
|
||||
for (int i = 0; i < entities.getLength(); i++) {
|
||||
Entity ent = (Entity)entities.item(i);
|
||||
String nodeName = (node.getNodeName() == null) ? "" : node.getNodeName();
|
||||
String nodeNamespaceURI = (node.getNamespaceURI() == null) ? "" : node.getNamespaceURI();
|
||||
String entName = (ent.getNodeName() == null) ? "" : ent.getNodeName();
|
||||
String entNamespaceURI = (ent.getNamespaceURI() == null) ? "" : ent.getNamespaceURI();
|
||||
if (parent.getNodeType() == 1 &&
|
||||
entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName))
|
||||
if (ent.getNotationName() != null) {
|
||||
String msg = Utils.messages.createMessage("ER_WF_REF_TO_UNPARSED_ENT", new Object[] { node.getNodeName() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "ER_WF_REF_TO_UNPARSED_ENT", null, null, null));
|
||||
}
|
||||
if (parent.getNodeType() == 2 &&
|
||||
entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName))
|
||||
if (ent.getPublicId() != null || ent.getSystemId() != null || ent.getNotationName() != null) {
|
||||
String msg = Utils.messages.createMessage("ER_WF_REF_TO_EXTERNAL_ENT", new Object[] { node.getNodeName() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "ER_WF_REF_TO_EXTERNAL_ENT", null, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkUnboundPrefixInEntRef(Node node) {
|
||||
Node next;
|
||||
for (Node child = node.getFirstChild(); child != null; child = next) {
|
||||
next = child.getNextSibling();
|
||||
if (child.getNodeType() == 1) {
|
||||
String prefix = child.getPrefix();
|
||||
if (prefix != null && this.fNSBinder.getURI(prefix) == null) {
|
||||
String msg = Utils.messages.createMessage("unbound-prefix-in-entity-reference", new Object[] { node.getNodeName(), child.getNodeName(), prefix });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "unbound-prefix-in-entity-reference", null, null, null));
|
||||
}
|
||||
NamedNodeMap attrs = child.getAttributes();
|
||||
for (int i = 0; i < attrs.getLength(); i++) {
|
||||
String attrPrefix = attrs.item(i).getPrefix();
|
||||
if (attrPrefix != null && this.fNSBinder.getURI(attrPrefix) == null) {
|
||||
String msg = Utils.messages.createMessage("unbound-prefix-in-entity-reference", new Object[] { node.getNodeName(), child.getNodeName(), attrs.item(i) });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "unbound-prefix-in-entity-reference", null, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (child.hasChildNodes())
|
||||
checkUnboundPrefixInEntRef(child);
|
||||
}
|
||||
}
|
||||
|
||||
protected void recordLocalNSDecl(Node node) {
|
||||
NamedNodeMap atts = ((Element)node).getAttributes();
|
||||
int length = atts.getLength();
|
||||
for (int i = 0; i < length; i++) {
|
||||
Node attr = atts.item(i);
|
||||
String localName = attr.getLocalName();
|
||||
String attrPrefix = attr.getPrefix();
|
||||
String attrValue = attr.getNodeValue();
|
||||
String attrNS = attr.getNamespaceURI();
|
||||
localName = (localName == null || "xmlns".equals(localName)) ? "" : localName;
|
||||
attrPrefix = (attrPrefix == null) ? "" : attrPrefix;
|
||||
attrValue = (attrValue == null) ? "" : attrValue;
|
||||
attrNS = (attrNS == null) ? "" : attrNS;
|
||||
if ("http://www.w3.org/2000/xmlns/".equals(attrNS))
|
||||
if ("http://www.w3.org/2000/xmlns/".equals(attrValue)) {
|
||||
String msg = Utils.messages.createMessage("ER_NS_PREFIX_CANNOT_BE_BOUND", new Object[] { attrPrefix, "http://www.w3.org/2000/xmlns/" });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)2, msg, "ER_NS_PREFIX_CANNOT_BE_BOUND", null, null, null));
|
||||
} else if ("xmlns".equals(attrPrefix)) {
|
||||
if (attrValue.length() != 0)
|
||||
this.fNSBinder.declarePrefix(localName, attrValue);
|
||||
} else {
|
||||
this.fNSBinder.declarePrefix("", attrValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fixupElementNS(Node node) throws SAXException {
|
||||
String namespaceURI = ((Element)node).getNamespaceURI();
|
||||
String prefix = ((Element)node).getPrefix();
|
||||
String localName = ((Element)node).getLocalName();
|
||||
if (namespaceURI != null) {
|
||||
prefix = (prefix == null) ? "" : prefix;
|
||||
String inScopeNamespaceURI = this.fNSBinder.getURI(prefix);
|
||||
if (inScopeNamespaceURI == null || !inScopeNamespaceURI.equals(namespaceURI)) {
|
||||
if ((this.fFeatures & 0x200) != 0)
|
||||
if ("".equals(prefix) || "".equals(namespaceURI)) {
|
||||
((Element)node).setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", namespaceURI);
|
||||
} else {
|
||||
((Element)node).setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" + prefix, namespaceURI);
|
||||
}
|
||||
this.fLocalNSBinder.declarePrefix(prefix, namespaceURI);
|
||||
this.fNSBinder.declarePrefix(prefix, namespaceURI);
|
||||
}
|
||||
} else if (localName == null || "".equals(localName)) {
|
||||
String msg = Utils.messages.createMessage("ER_NULL_LOCAL_ELEMENT_NAME", new Object[] { node.getNodeName() });
|
||||
if (this.fErrorHandler != null)
|
||||
this.fErrorHandler.handleError(new DOMErrorImpl((short)2, msg, "ER_NULL_LOCAL_ELEMENT_NAME", null, null, null));
|
||||
} else {
|
||||
namespaceURI = this.fNSBinder.getURI("");
|
||||
if (namespaceURI != null && namespaceURI.length() > 0) {
|
||||
((Element)node).setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "");
|
||||
this.fLocalNSBinder.declarePrefix("", "");
|
||||
this.fNSBinder.declarePrefix("", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Hashtable s_propKeys = new Hashtable();
|
||||
|
||||
static {
|
||||
int i = 2;
|
||||
Integer val = new Integer(i);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}cdata-sections", val);
|
||||
int i1 = 8;
|
||||
val = new Integer(i1);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}comments", val);
|
||||
int i2 = 32;
|
||||
val = new Integer(i2);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}element-content-whitespace", val);
|
||||
int i3 = 64;
|
||||
val = new Integer(i3);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}entities", val);
|
||||
int i4 = 256;
|
||||
val = new Integer(i4);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}namespaces", val);
|
||||
int i5 = 512;
|
||||
val = new Integer(i5);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}namespace-declarations", val);
|
||||
int i6 = 2048;
|
||||
val = new Integer(i6);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}split-cdata-sections", val);
|
||||
int i7 = 16384;
|
||||
val = new Integer(i7);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}well-formed", val);
|
||||
int i8 = 32768;
|
||||
val = new Integer(i8);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}discard-default-content", val);
|
||||
s_propKeys.put("{http://www.w3.org/TR/DOM-Level-3-LS}format-pretty-print", "");
|
||||
s_propKeys.put("omit-xml-declaration", "");
|
||||
s_propKeys.put("{http://xml.apache.org/xerces-2j}xml-version", "");
|
||||
s_propKeys.put("encoding", "");
|
||||
s_propKeys.put("{http://xml.apache.org/xerces-2j}entities", "");
|
||||
}
|
||||
|
||||
protected void initProperties(Properties properties) {
|
||||
for (Enumeration keys = properties.keys(); keys.hasMoreElements(); ) {
|
||||
String key = (String)keys.nextElement();
|
||||
Object iobj = s_propKeys.get(key);
|
||||
if (iobj != null) {
|
||||
if (iobj instanceof Integer) {
|
||||
int BITFLAG = ((Integer)iobj).intValue();
|
||||
if (properties.getProperty(key).endsWith("yes")) {
|
||||
this.fFeatures |= BITFLAG;
|
||||
continue;
|
||||
}
|
||||
this.fFeatures &= BITFLAG ^ 0xFFFFFFFF;
|
||||
continue;
|
||||
}
|
||||
if ("{http://www.w3.org/TR/DOM-Level-3-LS}format-pretty-print".equals(key)) {
|
||||
if (properties.getProperty(key).endsWith("yes")) {
|
||||
this.fSerializer.setIndent(true);
|
||||
this.fSerializer.setIndentAmount(3);
|
||||
continue;
|
||||
}
|
||||
this.fSerializer.setIndent(false);
|
||||
continue;
|
||||
}
|
||||
if ("omit-xml-declaration".equals(key)) {
|
||||
if (properties.getProperty(key).endsWith("yes")) {
|
||||
this.fSerializer.setOmitXMLDeclaration(true);
|
||||
continue;
|
||||
}
|
||||
this.fSerializer.setOmitXMLDeclaration(false);
|
||||
continue;
|
||||
}
|
||||
if ("{http://xml.apache.org/xerces-2j}xml-version".equals(key)) {
|
||||
String version = properties.getProperty(key);
|
||||
if ("1.1".equals(version)) {
|
||||
this.fIsXMLVersion11 = true;
|
||||
this.fSerializer.setVersion(version);
|
||||
continue;
|
||||
}
|
||||
this.fSerializer.setVersion("1.0");
|
||||
continue;
|
||||
}
|
||||
if ("encoding".equals(key)) {
|
||||
String encoding = properties.getProperty(key);
|
||||
if (encoding != null)
|
||||
this.fSerializer.setEncoding(encoding);
|
||||
continue;
|
||||
}
|
||||
if ("{http://xml.apache.org/xerces-2j}entities".equals(key)) {
|
||||
if (properties.getProperty(key).endsWith("yes")) {
|
||||
this.fSerializer.setDTDEntityExpansion(false);
|
||||
continue;
|
||||
}
|
||||
this.fSerializer.setDTDEntityExpansion(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.fNewLine != null)
|
||||
this.fSerializer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", this.fNewLine);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
final class DOMConstants {
|
||||
public static final String DOM3_REC_URL = "http://www.w3.org/TR/DOM-Level-3-LS";
|
||||
|
||||
public static final String XERCES_URL = "http://xml.apache.org/xerces-2j";
|
||||
|
||||
public static final String S_DOM3_PROPERTIES_NS = "{http://www.w3.org/TR/DOM-Level-3-LS}";
|
||||
|
||||
public static final String S_XERCES_PROPERTIES_NS = "{http://xml.apache.org/xerces-2j}";
|
||||
|
||||
private static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
|
||||
|
||||
private static final String XMLNS_PREFIX = "xmlns";
|
||||
|
||||
public static final String DOM_CANONICAL_FORM = "canonical-form";
|
||||
|
||||
public static final String DOM_CDATA_SECTIONS = "cdata-sections";
|
||||
|
||||
public static final String DOM_CHECK_CHAR_NORMALIZATION = "check-character-normalization";
|
||||
|
||||
public static final String DOM_COMMENTS = "comments";
|
||||
|
||||
public static final String DOM_DATATYPE_NORMALIZATION = "datatype-normalization";
|
||||
|
||||
public static final String DOM_ELEMENT_CONTENT_WHITESPACE = "element-content-whitespace";
|
||||
|
||||
public static final String DOM_ENTITIES = "entities";
|
||||
|
||||
public static final String DOM_INFOSET = "infoset";
|
||||
|
||||
public static final String DOM_NAMESPACES = "namespaces";
|
||||
|
||||
public static final String DOM_NAMESPACE_DECLARATIONS = "namespace-declarations";
|
||||
|
||||
public static final String DOM_NORMALIZE_CHARACTERS = "normalize-characters";
|
||||
|
||||
public static final String DOM_SPLIT_CDATA = "split-cdata-sections";
|
||||
|
||||
public static final String DOM_VALIDATE_IF_SCHEMA = "validate-if-schema";
|
||||
|
||||
public static final String DOM_VALIDATE = "validate";
|
||||
|
||||
public static final String DOM_WELLFORMED = "well-formed";
|
||||
|
||||
public static final String DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content";
|
||||
|
||||
public static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
|
||||
|
||||
public static final String DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS = "ignore-unknown-character-denormalizations";
|
||||
|
||||
public static final String DOM_XMLDECL = "xml-declaration";
|
||||
|
||||
public static final String DOM_ERROR_HANDLER = "error-handler";
|
||||
|
||||
public static final String DOM_SCHEMA_TYPE = "schema-type";
|
||||
|
||||
public static final String DOM_SCHEMA_LOCATION = "schema-location";
|
||||
|
||||
public static final String S_XSL_OUTPUT_INDENT = "indent";
|
||||
|
||||
public static final String S_XSL_OUTPUT_ENCODING = "encoding";
|
||||
|
||||
public static final String S_XSL_OUTPUT_OMIT_XML_DECL = "omit-xml-declaration";
|
||||
|
||||
public static final String S_XML_VERSION = "xml-version";
|
||||
|
||||
public static final String S_XSL_VALUE_ENTITIES = "org/apache/xml/serializer/XMLEntities";
|
||||
|
||||
public static final String DOM3_EXPLICIT_TRUE = "explicit:yes";
|
||||
|
||||
public static final String DOM3_DEFAULT_TRUE = "default:yes";
|
||||
|
||||
public static final String DOM3_EXPLICIT_FALSE = "explicit:no";
|
||||
|
||||
public static final String DOM3_DEFAULT_FALSE = "default:no";
|
||||
|
||||
public static final String DOM_EXCEPTION_FEATURE_NOT_FOUND = "FEATURE_NOT_FOUND";
|
||||
|
||||
public static final String DOM_EXCEPTION_FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED";
|
||||
|
||||
public static final String DOM_LSEXCEPTION_SERIALIZER_ERR = "SERIALIZER_ERROR";
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import org.w3c.dom.DOMError;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
|
||||
final class DOMErrorHandlerImpl implements DOMErrorHandler {
|
||||
public boolean handleError(DOMError error) {
|
||||
boolean fail = true;
|
||||
String severity = null;
|
||||
if (error.getSeverity() == 1) {
|
||||
fail = false;
|
||||
severity = "[Warning]";
|
||||
} else if (error.getSeverity() == 2) {
|
||||
severity = "[Error]";
|
||||
} else if (error.getSeverity() == 3) {
|
||||
severity = "[Fatal Error]";
|
||||
}
|
||||
System.err.println(severity + ": " + error.getMessage() + "\t");
|
||||
System.err.println("Type : " + error.getType() + "\t" + "Related Data: " + error.getRelatedData() + "\t" + "Related Exception: " + error.getRelatedException());
|
||||
return fail;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import org.w3c.dom.DOMError;
|
||||
import org.w3c.dom.DOMLocator;
|
||||
|
||||
final class DOMErrorImpl implements DOMError {
|
||||
private short fSeverity = 1;
|
||||
|
||||
private String fMessage = null;
|
||||
|
||||
private String fType;
|
||||
|
||||
private Exception fException = null;
|
||||
|
||||
private Object fRelatedData;
|
||||
|
||||
private DOMLocatorImpl fLocation = new DOMLocatorImpl();
|
||||
|
||||
DOMErrorImpl() {}
|
||||
|
||||
DOMErrorImpl(short severity, String message, String type) {
|
||||
this.fSeverity = severity;
|
||||
this.fMessage = message;
|
||||
this.fType = type;
|
||||
}
|
||||
|
||||
DOMErrorImpl(short severity, String message, String type, Exception exception) {
|
||||
this.fSeverity = severity;
|
||||
this.fMessage = message;
|
||||
this.fType = type;
|
||||
this.fException = exception;
|
||||
}
|
||||
|
||||
DOMErrorImpl(short severity, String message, String type, Exception exception, Object relatedData, DOMLocatorImpl location) {
|
||||
this.fSeverity = severity;
|
||||
this.fMessage = message;
|
||||
this.fType = type;
|
||||
this.fException = exception;
|
||||
this.fRelatedData = relatedData;
|
||||
this.fLocation = location;
|
||||
}
|
||||
|
||||
public short getSeverity() {
|
||||
return this.fSeverity;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return this.fMessage;
|
||||
}
|
||||
|
||||
public DOMLocator getLocation() {
|
||||
return this.fLocation;
|
||||
}
|
||||
|
||||
public Object getRelatedException() {
|
||||
return this.fException;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.fType;
|
||||
}
|
||||
|
||||
public Object getRelatedData() {
|
||||
return this.fRelatedData;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.fSeverity = 1;
|
||||
this.fException = null;
|
||||
this.fMessage = null;
|
||||
this.fType = null;
|
||||
this.fRelatedData = null;
|
||||
this.fLocation = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import org.w3c.dom.DOMLocator;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
final class DOMLocatorImpl implements DOMLocator {
|
||||
private final int fColumnNumber;
|
||||
|
||||
private final int fLineNumber;
|
||||
|
||||
private final Node fRelatedNode;
|
||||
|
||||
private final String fUri;
|
||||
|
||||
private final int fByteOffset;
|
||||
|
||||
private final int fUtf16Offset;
|
||||
|
||||
DOMLocatorImpl() {
|
||||
this.fColumnNumber = -1;
|
||||
this.fLineNumber = -1;
|
||||
this.fRelatedNode = null;
|
||||
this.fUri = null;
|
||||
this.fByteOffset = -1;
|
||||
this.fUtf16Offset = -1;
|
||||
}
|
||||
|
||||
DOMLocatorImpl(int lineNumber, int columnNumber, String uri) {
|
||||
this.fLineNumber = lineNumber;
|
||||
this.fColumnNumber = columnNumber;
|
||||
this.fUri = uri;
|
||||
this.fRelatedNode = null;
|
||||
this.fByteOffset = -1;
|
||||
this.fUtf16Offset = -1;
|
||||
}
|
||||
|
||||
DOMLocatorImpl(int lineNumber, int columnNumber, int utf16Offset, String uri) {
|
||||
this.fLineNumber = lineNumber;
|
||||
this.fColumnNumber = columnNumber;
|
||||
this.fUri = uri;
|
||||
this.fUtf16Offset = utf16Offset;
|
||||
this.fRelatedNode = null;
|
||||
this.fByteOffset = -1;
|
||||
}
|
||||
|
||||
DOMLocatorImpl(int lineNumber, int columnNumber, int byteoffset, Node relatedData, String uri) {
|
||||
this.fLineNumber = lineNumber;
|
||||
this.fColumnNumber = columnNumber;
|
||||
this.fByteOffset = byteoffset;
|
||||
this.fRelatedNode = relatedData;
|
||||
this.fUri = uri;
|
||||
this.fUtf16Offset = -1;
|
||||
}
|
||||
|
||||
DOMLocatorImpl(int lineNumber, int columnNumber, int byteoffset, Node relatedData, String uri, int utf16Offset) {
|
||||
this.fLineNumber = lineNumber;
|
||||
this.fColumnNumber = columnNumber;
|
||||
this.fByteOffset = byteoffset;
|
||||
this.fRelatedNode = relatedData;
|
||||
this.fUri = uri;
|
||||
this.fUtf16Offset = utf16Offset;
|
||||
}
|
||||
|
||||
public int getLineNumber() {
|
||||
return this.fLineNumber;
|
||||
}
|
||||
|
||||
public int getColumnNumber() {
|
||||
return this.fColumnNumber;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return this.fUri;
|
||||
}
|
||||
|
||||
public Node getRelatedNode() {
|
||||
return this.fRelatedNode;
|
||||
}
|
||||
|
||||
public int getByteOffset() {
|
||||
return this.fByteOffset;
|
||||
}
|
||||
|
||||
public int getUtf16Offset() {
|
||||
return this.fUtf16Offset;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
|
||||
final class DOMOutputImpl implements LSOutput {
|
||||
private Writer fCharStream = null;
|
||||
|
||||
private OutputStream fByteStream = null;
|
||||
|
||||
private String fSystemId = null;
|
||||
|
||||
private String fEncoding = null;
|
||||
|
||||
public Writer getCharacterStream() {
|
||||
return this.fCharStream;
|
||||
}
|
||||
|
||||
public void setCharacterStream(Writer characterStream) {
|
||||
this.fCharStream = characterStream;
|
||||
}
|
||||
|
||||
public OutputStream getByteStream() {
|
||||
return this.fByteStream;
|
||||
}
|
||||
|
||||
public void setByteStream(OutputStream byteStream) {
|
||||
this.fByteStream = byteStream;
|
||||
}
|
||||
|
||||
public String getSystemId() {
|
||||
return this.fSystemId;
|
||||
}
|
||||
|
||||
public void setSystemId(String systemId) {
|
||||
this.fSystemId = systemId;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return this.fEncoding;
|
||||
}
|
||||
|
||||
public void setEncoding(String encoding) {
|
||||
this.fEncoding = encoding;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import java.util.Vector;
|
||||
import org.w3c.dom.DOMStringList;
|
||||
|
||||
final class DOMStringListImpl implements DOMStringList {
|
||||
private Vector fStrings;
|
||||
|
||||
DOMStringListImpl() {
|
||||
this.fStrings = new Vector();
|
||||
}
|
||||
|
||||
DOMStringListImpl(Vector params) {
|
||||
this.fStrings = params;
|
||||
}
|
||||
|
||||
DOMStringListImpl(String[] params) {
|
||||
this.fStrings = new Vector();
|
||||
if (params != null)
|
||||
for (int i = 0; i < params.length; i++)
|
||||
this.fStrings.add(params[i]);
|
||||
}
|
||||
|
||||
public String item(int index) {
|
||||
try {
|
||||
return (String)this.fStrings.elementAt(index);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return this.fStrings.size();
|
||||
}
|
||||
|
||||
public boolean contains(String param) {
|
||||
return this.fStrings.contains(param);
|
||||
}
|
||||
|
||||
public void add(String param) {
|
||||
this.fStrings.add(param);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,705 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
import org.apache.xml.serializer.DOM3Serializer;
|
||||
import org.apache.xml.serializer.Encodings;
|
||||
import org.apache.xml.serializer.OutputPropertiesFactory;
|
||||
import org.apache.xml.serializer.Serializer;
|
||||
import org.apache.xml.serializer.SerializerFactory;
|
||||
import org.apache.xml.serializer.utils.SystemIDResolver;
|
||||
import org.apache.xml.serializer.utils.Utils;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.DOMStringList;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.ls.LSException;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
import org.w3c.dom.ls.LSSerializer;
|
||||
import org.w3c.dom.ls.LSSerializerFilter;
|
||||
|
||||
public final class LSSerializerImpl implements DOMConfiguration, LSSerializer {
|
||||
private static final String DEFAULT_END_OF_LINE;
|
||||
|
||||
static {
|
||||
String lineSeparator = (String)AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
try {
|
||||
return System.getProperty("line.separator");
|
||||
} catch (SecurityException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
DEFAULT_END_OF_LINE = (lineSeparator != null && (lineSeparator.equals("\r\n") || lineSeparator.equals("\r"))) ? lineSeparator : "\n";
|
||||
}
|
||||
|
||||
private Serializer fXMLSerializer = null;
|
||||
|
||||
protected int fFeatures = 0;
|
||||
|
||||
private DOM3Serializer fDOMSerializer = null;
|
||||
|
||||
private LSSerializerFilter fSerializerFilter = null;
|
||||
|
||||
private Node fVisitedNode = null;
|
||||
|
||||
private String fEndOfLine = DEFAULT_END_OF_LINE;
|
||||
|
||||
private DOMErrorHandler fDOMErrorHandler = null;
|
||||
|
||||
private Properties fDOMConfigProperties = null;
|
||||
|
||||
private String fEncoding;
|
||||
|
||||
private static final int CANONICAL = 1;
|
||||
|
||||
private static final int CDATA = 2;
|
||||
|
||||
private static final int CHARNORMALIZE = 4;
|
||||
|
||||
private static final int COMMENTS = 8;
|
||||
|
||||
private static final int DTNORMALIZE = 16;
|
||||
|
||||
private static final int ELEM_CONTENT_WHITESPACE = 32;
|
||||
|
||||
private static final int ENTITIES = 64;
|
||||
|
||||
private static final int INFOSET = 128;
|
||||
|
||||
private static final int NAMESPACES = 256;
|
||||
|
||||
private static final int NAMESPACEDECLS = 512;
|
||||
|
||||
private static final int NORMALIZECHARS = 1024;
|
||||
|
||||
private static final int SPLITCDATA = 2048;
|
||||
|
||||
private static final int VALIDATE = 4096;
|
||||
|
||||
private static final int SCHEMAVALIDATE = 8192;
|
||||
|
||||
private static final int WELLFORMED = 16384;
|
||||
|
||||
private static final int DISCARDDEFAULT = 32768;
|
||||
|
||||
private static final int PRETTY_PRINT = 65536;
|
||||
|
||||
private static final int IGNORE_CHAR_DENORMALIZE = 131072;
|
||||
|
||||
private static final int XMLDECL = 262144;
|
||||
|
||||
private String[] fRecognizedParameters = new String[] {
|
||||
"canonical-form", "cdata-sections", "check-character-normalization", "comments", "datatype-normalization", "element-content-whitespace", "entities", "infoset", "namespaces", "namespace-declarations",
|
||||
"split-cdata-sections", "validate", "validate-if-schema", "well-formed", "discard-default-content", "format-pretty-print", "ignore-unknown-character-denormalizations", "xml-declaration", "error-handler" };
|
||||
|
||||
public LSSerializerImpl() {
|
||||
this.fFeatures |= 0x2;
|
||||
this.fFeatures |= 0x8;
|
||||
this.fFeatures |= 0x20;
|
||||
this.fFeatures |= 0x40;
|
||||
this.fFeatures |= 0x100;
|
||||
this.fFeatures |= 0x200;
|
||||
this.fFeatures |= 0x800;
|
||||
this.fFeatures |= 0x4000;
|
||||
this.fFeatures |= 0x8000;
|
||||
this.fFeatures |= 0x40000;
|
||||
this.fDOMConfigProperties = new Properties();
|
||||
initializeSerializerProps();
|
||||
Properties configProps = OutputPropertiesFactory.getDefaultMethodProperties("xml");
|
||||
this.fXMLSerializer = SerializerFactory.getSerializer(configProps);
|
||||
this.fXMLSerializer.setOutputFormat(this.fDOMConfigProperties);
|
||||
}
|
||||
|
||||
public void initializeSerializerProps() {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}canonical-form", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}cdata-sections", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}check-character-normalization", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}comments", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}datatype-normalization", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}element-content-whitespace", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}entities", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}entities", "default:yes");
|
||||
if ((this.fFeatures & 0x80) != 0) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespaces", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespace-declarations", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}comments", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}element-content-whitespace", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}well-formed", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}entities", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}entities", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}cdata-sections", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}validate-if-schema", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}datatype-normalization", "default:no");
|
||||
}
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespaces", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespace-declarations", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}split-cdata-sections", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}validate", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}validate-if-schema", "default:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}well-formed", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("indent", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xalan}indent-amount", Integer.toString(3));
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}discard-default-content", "default:yes");
|
||||
this.fDOMConfigProperties.setProperty("omit-xml-declaration", "no");
|
||||
}
|
||||
|
||||
public boolean canSetParameter(String name, Object value) {
|
||||
if (value instanceof Boolean) {
|
||||
if (name.equalsIgnoreCase("cdata-sections") || name.equalsIgnoreCase("comments") || name.equalsIgnoreCase("entities") || name.equalsIgnoreCase("infoset") || name.equalsIgnoreCase("element-content-whitespace") || name.equalsIgnoreCase("namespaces") || name.equalsIgnoreCase("namespace-declarations") || name.equalsIgnoreCase("split-cdata-sections") || name.equalsIgnoreCase("well-formed") || name.equalsIgnoreCase("discard-default-content") || name.equalsIgnoreCase("format-pretty-print") || name.equalsIgnoreCase("xml-declaration"))
|
||||
return true;
|
||||
if (name.equalsIgnoreCase("canonical-form") || name.equalsIgnoreCase("check-character-normalization") || name.equalsIgnoreCase("datatype-normalization") || name.equalsIgnoreCase("validate-if-schema") || name.equalsIgnoreCase("validate"))
|
||||
return !((Boolean)value).booleanValue();
|
||||
if (name.equalsIgnoreCase("ignore-unknown-character-denormalizations"))
|
||||
return ((Boolean)value).booleanValue();
|
||||
} else if ((name.equalsIgnoreCase("error-handler") && value == null) || value instanceof DOMErrorHandler) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object getParameter(String name) throws DOMException {
|
||||
if (name.equalsIgnoreCase("comments"))
|
||||
return ((this.fFeatures & 0x8) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("cdata-sections"))
|
||||
return ((this.fFeatures & 0x2) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("entities"))
|
||||
return ((this.fFeatures & 0x40) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("namespaces"))
|
||||
return ((this.fFeatures & 0x100) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("namespace-declarations"))
|
||||
return ((this.fFeatures & 0x200) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("split-cdata-sections"))
|
||||
return ((this.fFeatures & 0x800) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("well-formed"))
|
||||
return ((this.fFeatures & 0x4000) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("discard-default-content"))
|
||||
return ((this.fFeatures & 0x8000) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("format-pretty-print"))
|
||||
return ((this.fFeatures & 0x10000) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("xml-declaration"))
|
||||
return ((this.fFeatures & 0x40000) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("element-content-whitespace"))
|
||||
return ((this.fFeatures & 0x20) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("format-pretty-print"))
|
||||
return ((this.fFeatures & 0x10000) != 0) ? Boolean.TRUE : Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("ignore-unknown-character-denormalizations"))
|
||||
return Boolean.TRUE;
|
||||
if (name.equalsIgnoreCase("canonical-form") || name.equalsIgnoreCase("check-character-normalization") || name.equalsIgnoreCase("datatype-normalization") || name.equalsIgnoreCase("validate") || name.equalsIgnoreCase("validate-if-schema"))
|
||||
return Boolean.FALSE;
|
||||
if (name.equalsIgnoreCase("infoset")) {
|
||||
if ((this.fFeatures & 0x40) == 0 && (this.fFeatures & 0x2) == 0 && (this.fFeatures & 0x20) != 0 && (this.fFeatures & 0x100) != 0 && (this.fFeatures & 0x200) != 0 && (this.fFeatures & 0x4000) != 0 && (this.fFeatures & 0x8) != 0)
|
||||
return Boolean.TRUE;
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
if (name.equalsIgnoreCase("error-handler"))
|
||||
return this.fDOMErrorHandler;
|
||||
if (name.equalsIgnoreCase("schema-location") || name.equalsIgnoreCase("schema-type"))
|
||||
return null;
|
||||
String msg = Utils.messages.createMessage("FEATURE_NOT_FOUND", new Object[] { name });
|
||||
throw new DOMException((short)8, msg);
|
||||
}
|
||||
|
||||
public DOMStringList getParameterNames() {
|
||||
return new DOMStringListImpl(this.fRecognizedParameters);
|
||||
}
|
||||
|
||||
public void setParameter(String name, Object value) throws DOMException {
|
||||
if (value instanceof Boolean) {
|
||||
boolean state = ((Boolean)value).booleanValue();
|
||||
if (name.equalsIgnoreCase("comments")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x8) : (this.fFeatures & 0xFFFFFFF7);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}comments", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}comments", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("cdata-sections")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x2) : (this.fFeatures & 0xFFFFFFFD);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}cdata-sections", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}cdata-sections", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("entities")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x40) : (this.fFeatures & 0xFFFFFFBF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}entities", "explicit:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}entities", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}entities", "explicit:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}entities", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("namespaces")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x100) : (this.fFeatures & 0xFFFFFEFF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespaces", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespaces", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("namespace-declarations")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x200) : (this.fFeatures & 0xFFFFFDFF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespace-declarations", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespace-declarations", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("split-cdata-sections")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x800) : (this.fFeatures & 0xFFFFF7FF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}split-cdata-sections", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}split-cdata-sections", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("well-formed")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x4000) : (this.fFeatures & 0xFFFFBFFF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}well-formed", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}well-formed", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("discard-default-content")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x8000) : (this.fFeatures & 0xFFFF7FFF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}discard-default-content", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}discard-default-content", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("format-pretty-print")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x10000) : (this.fFeatures & 0xFFFEFFFF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}format-pretty-print", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}format-pretty-print", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("xml-declaration")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x40000) : (this.fFeatures & 0xFFFBFFFF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("omit-xml-declaration", "no");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("omit-xml-declaration", "yes");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("element-content-whitespace")) {
|
||||
this.fFeatures = state ? (this.fFeatures | 0x20) : (this.fFeatures & 0xFFFFFFDF);
|
||||
if (state) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}element-content-whitespace", "explicit:yes");
|
||||
} else {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}element-content-whitespace", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("ignore-unknown-character-denormalizations")) {
|
||||
if (!state) {
|
||||
String msg = Utils.messages.createMessage("FEATURE_NOT_SUPPORTED", new Object[] { name });
|
||||
throw new DOMException((short)9, msg);
|
||||
}
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}ignore-unknown-character-denormalizations", "explicit:yes");
|
||||
} else if (name.equalsIgnoreCase("canonical-form") || name.equalsIgnoreCase("validate-if-schema") || name.equalsIgnoreCase("validate") || name.equalsIgnoreCase("check-character-normalization") || name.equalsIgnoreCase("datatype-normalization")) {
|
||||
if (state) {
|
||||
String msg = Utils.messages.createMessage("FEATURE_NOT_SUPPORTED", new Object[] { name });
|
||||
throw new DOMException((short)9, msg);
|
||||
}
|
||||
if (name.equalsIgnoreCase("canonical-form")) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}canonical-form", "explicit:no");
|
||||
} else if (name.equalsIgnoreCase("validate-if-schema")) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}validate-if-schema", "explicit:no");
|
||||
} else if (name.equalsIgnoreCase("validate")) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}validate", "explicit:no");
|
||||
} else if (name.equalsIgnoreCase("validate-if-schema")) {
|
||||
this.fDOMConfigProperties.setProperty("check-character-normalizationcheck-character-normalization", "explicit:no");
|
||||
} else if (name.equalsIgnoreCase("datatype-normalization")) {
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}datatype-normalization", "explicit:no");
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("infoset")) {
|
||||
if (state) {
|
||||
this.fFeatures &= 0xFFFFFFBF;
|
||||
this.fFeatures &= 0xFFFFFFFD;
|
||||
this.fFeatures &= 0xFFFFDFFF;
|
||||
this.fFeatures &= 0xFFFFFFEF;
|
||||
this.fFeatures |= 0x100;
|
||||
this.fFeatures |= 0x200;
|
||||
this.fFeatures |= 0x4000;
|
||||
this.fFeatures |= 0x20;
|
||||
this.fFeatures |= 0x8;
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespaces", "explicit:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}namespace-declarations", "explicit:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}comments", "explicit:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}element-content-whitespace", "explicit:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}well-formed", "explicit:yes");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}entities", "explicit:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}entities", "explicit:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}cdata-sections", "explicit:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}validate-if-schema", "explicit:no");
|
||||
this.fDOMConfigProperties.setProperty("{http://www.w3.org/TR/DOM-Level-3-LS}datatype-normalization", "explicit:no");
|
||||
}
|
||||
} else {
|
||||
if (name.equalsIgnoreCase("error-handler") || name.equalsIgnoreCase("schema-location") || name.equalsIgnoreCase("schema-type")) {
|
||||
String str = Utils.messages.createMessage("TYPE_MISMATCH_ERR", new Object[] { name });
|
||||
throw new DOMException((short)17, str);
|
||||
}
|
||||
String msg = Utils.messages.createMessage("FEATURE_NOT_FOUND", new Object[] { name });
|
||||
throw new DOMException((short)8, msg);
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("error-handler")) {
|
||||
if (value == null || value instanceof DOMErrorHandler) {
|
||||
this.fDOMErrorHandler = (DOMErrorHandler)value;
|
||||
} else {
|
||||
String msg = Utils.messages.createMessage("TYPE_MISMATCH_ERR", new Object[] { name });
|
||||
throw new DOMException((short)17, msg);
|
||||
}
|
||||
} else if (name.equalsIgnoreCase("schema-location") || name.equalsIgnoreCase("schema-type")) {
|
||||
if (value != null) {
|
||||
if (!(value instanceof String)) {
|
||||
String str = Utils.messages.createMessage("TYPE_MISMATCH_ERR", new Object[] { name });
|
||||
throw new DOMException((short)17, str);
|
||||
}
|
||||
String msg = Utils.messages.createMessage("FEATURE_NOT_SUPPORTED", new Object[] { name });
|
||||
throw new DOMException((short)9, msg);
|
||||
}
|
||||
} else {
|
||||
if (name.equalsIgnoreCase("comments") || name.equalsIgnoreCase("cdata-sections") || name.equalsIgnoreCase("entities") || name.equalsIgnoreCase("namespaces") || name.equalsIgnoreCase("namespace-declarations") || name.equalsIgnoreCase("split-cdata-sections") || name.equalsIgnoreCase("well-formed") || name.equalsIgnoreCase("discard-default-content") || name.equalsIgnoreCase("format-pretty-print") || name.equalsIgnoreCase("xml-declaration") || name.equalsIgnoreCase("element-content-whitespace") || name.equalsIgnoreCase("ignore-unknown-character-denormalizations") || name.equalsIgnoreCase("canonical-form") || name.equalsIgnoreCase("validate-if-schema") || name.equalsIgnoreCase("validate") || name.equalsIgnoreCase("check-character-normalization") || name.equalsIgnoreCase("datatype-normalization") || name.equalsIgnoreCase("infoset")) {
|
||||
String str = Utils.messages.createMessage("TYPE_MISMATCH_ERR", new Object[] { name });
|
||||
throw new DOMException((short)17, str);
|
||||
}
|
||||
String msg = Utils.messages.createMessage("FEATURE_NOT_FOUND", new Object[] { name });
|
||||
throw new DOMException((short)8, msg);
|
||||
}
|
||||
}
|
||||
|
||||
public DOMConfiguration getDomConfig() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public LSSerializerFilter getFilter() {
|
||||
return this.fSerializerFilter;
|
||||
}
|
||||
|
||||
public String getNewLine() {
|
||||
return this.fEndOfLine;
|
||||
}
|
||||
|
||||
public void setFilter(LSSerializerFilter filter) {
|
||||
this.fSerializerFilter = filter;
|
||||
}
|
||||
|
||||
public void setNewLine(String newLine) {
|
||||
this.fEndOfLine = (newLine != null) ? newLine : DEFAULT_END_OF_LINE;
|
||||
}
|
||||
|
||||
public boolean write(Node nodeArg, LSOutput destination) throws LSException {
|
||||
if (destination == null) {
|
||||
String msg = Utils.messages.createMessage("no-output-specified", null);
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "no-output-specified"));
|
||||
throw new LSException((short)82, msg);
|
||||
}
|
||||
if (nodeArg == null)
|
||||
return false;
|
||||
Serializer serializer = this.fXMLSerializer;
|
||||
serializer.reset();
|
||||
if (nodeArg != this.fVisitedNode) {
|
||||
String xmlVersion = getXMLVersion(nodeArg);
|
||||
this.fEncoding = destination.getEncoding();
|
||||
if (this.fEncoding == null) {
|
||||
this.fEncoding = getInputEncoding(nodeArg);
|
||||
this.fEncoding = (this.fEncoding != null) ? this.fEncoding : ((getXMLEncoding(nodeArg) == null) ? "UTF-8" : getXMLEncoding(nodeArg));
|
||||
}
|
||||
if (!Encodings.isRecognizedEncoding(this.fEncoding)) {
|
||||
String msg = Utils.messages.createMessage("unsupported-encoding", null);
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "unsupported-encoding"));
|
||||
throw new LSException((short)82, msg);
|
||||
}
|
||||
serializer.getOutputFormat().setProperty("version", xmlVersion);
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}xml-version", xmlVersion);
|
||||
this.fDOMConfigProperties.setProperty("encoding", this.fEncoding);
|
||||
if ((nodeArg.getNodeType() != 9 || nodeArg.getNodeType() != 1 || nodeArg.getNodeType() != 6) && (this.fFeatures & 0x40000) != 0)
|
||||
this.fDOMConfigProperties.setProperty("omit-xml-declaration", "default:no");
|
||||
this.fVisitedNode = nodeArg;
|
||||
}
|
||||
this.fXMLSerializer.setOutputFormat(this.fDOMConfigProperties);
|
||||
try {
|
||||
Writer writer = destination.getCharacterStream();
|
||||
if (writer == null) {
|
||||
OutputStream outputStream = destination.getByteStream();
|
||||
if (outputStream == null) {
|
||||
String uri = destination.getSystemId();
|
||||
if (uri == null) {
|
||||
String msg = Utils.messages.createMessage("no-output-specified", null);
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "no-output-specified"));
|
||||
throw new LSException((short)82, msg);
|
||||
}
|
||||
String absoluteURI = SystemIDResolver.getAbsoluteURI(uri);
|
||||
URL url = new URL(absoluteURI);
|
||||
OutputStream urlOutStream = null;
|
||||
String protocol = url.getProtocol();
|
||||
String host = url.getHost();
|
||||
if (protocol.equalsIgnoreCase("file") && (host == null || host.length() == 0 || host.equals("localhost"))) {
|
||||
urlOutStream = new FileOutputStream(getPathWithoutEscapes(url.getPath()));
|
||||
} else {
|
||||
URLConnection urlCon = url.openConnection();
|
||||
urlCon.setDoInput(false);
|
||||
urlCon.setDoOutput(true);
|
||||
urlCon.setUseCaches(false);
|
||||
urlCon.setAllowUserInteraction(false);
|
||||
if (urlCon instanceof HttpURLConnection) {
|
||||
HttpURLConnection httpCon = (HttpURLConnection)urlCon;
|
||||
httpCon.setRequestMethod("PUT");
|
||||
}
|
||||
urlOutStream = urlCon.getOutputStream();
|
||||
}
|
||||
serializer.setOutputStream(urlOutStream);
|
||||
} else {
|
||||
serializer.setOutputStream(outputStream);
|
||||
}
|
||||
} else {
|
||||
serializer.setWriter(writer);
|
||||
}
|
||||
if (this.fDOMSerializer == null)
|
||||
this.fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer();
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMSerializer.setErrorHandler(this.fDOMErrorHandler);
|
||||
if (this.fSerializerFilter != null)
|
||||
this.fDOMSerializer.setNodeFilter(this.fSerializerFilter);
|
||||
this.fDOMSerializer.setNewLine(this.fEndOfLine.toCharArray());
|
||||
this.fDOMSerializer.serializeDOM3(nodeArg);
|
||||
} catch (UnsupportedEncodingException ue) {
|
||||
String msg = Utils.messages.createMessage("unsupported-encoding", null);
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "unsupported-encoding", ue));
|
||||
throw (LSException)createLSException((short)82, ue).fillInStackTrace();
|
||||
} catch (LSException lse) {
|
||||
throw lse;
|
||||
} catch (RuntimeException e) {
|
||||
throw (LSException)createLSException((short)82, e).fillInStackTrace();
|
||||
} catch (Exception e) {
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, e.getMessage(), null, e));
|
||||
throw (LSException)createLSException((short)82, e).fillInStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String writeToString(Node nodeArg) throws DOMException, LSException {
|
||||
if (nodeArg == null)
|
||||
return null;
|
||||
Serializer serializer = this.fXMLSerializer;
|
||||
serializer.reset();
|
||||
if (nodeArg != this.fVisitedNode) {
|
||||
String xmlVersion = getXMLVersion(nodeArg);
|
||||
serializer.getOutputFormat().setProperty("version", xmlVersion);
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}xml-version", xmlVersion);
|
||||
this.fDOMConfigProperties.setProperty("encoding", "UTF-16");
|
||||
if ((nodeArg.getNodeType() != 9 || nodeArg.getNodeType() != 1 || nodeArg.getNodeType() != 6) && (this.fFeatures & 0x40000) != 0)
|
||||
this.fDOMConfigProperties.setProperty("omit-xml-declaration", "default:no");
|
||||
this.fVisitedNode = nodeArg;
|
||||
}
|
||||
this.fXMLSerializer.setOutputFormat(this.fDOMConfigProperties);
|
||||
StringWriter output = new StringWriter();
|
||||
try {
|
||||
serializer.setWriter(output);
|
||||
if (this.fDOMSerializer == null)
|
||||
this.fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer();
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMSerializer.setErrorHandler(this.fDOMErrorHandler);
|
||||
if (this.fSerializerFilter != null)
|
||||
this.fDOMSerializer.setNodeFilter(this.fSerializerFilter);
|
||||
this.fDOMSerializer.setNewLine(this.fEndOfLine.toCharArray());
|
||||
this.fDOMSerializer.serializeDOM3(nodeArg);
|
||||
} catch (LSException lse) {
|
||||
throw lse;
|
||||
} catch (RuntimeException e) {
|
||||
throw (LSException)createLSException((short)82, e).fillInStackTrace();
|
||||
} catch (Exception e) {
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, e.getMessage(), null, e));
|
||||
throw (LSException)createLSException((short)82, e).fillInStackTrace();
|
||||
}
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
public boolean writeToURI(Node nodeArg, String uri) throws LSException {
|
||||
if (nodeArg == null)
|
||||
return false;
|
||||
Serializer serializer = this.fXMLSerializer;
|
||||
serializer.reset();
|
||||
if (nodeArg != this.fVisitedNode) {
|
||||
String xmlVersion = getXMLVersion(nodeArg);
|
||||
this.fEncoding = getInputEncoding(nodeArg);
|
||||
if (this.fEncoding == null)
|
||||
this.fEncoding = (this.fEncoding != null) ? this.fEncoding : ((getXMLEncoding(nodeArg) == null) ? "UTF-8" : getXMLEncoding(nodeArg));
|
||||
serializer.getOutputFormat().setProperty("version", xmlVersion);
|
||||
this.fDOMConfigProperties.setProperty("{http://xml.apache.org/xerces-2j}xml-version", xmlVersion);
|
||||
this.fDOMConfigProperties.setProperty("encoding", this.fEncoding);
|
||||
if ((nodeArg.getNodeType() != 9 || nodeArg.getNodeType() != 1 || nodeArg.getNodeType() != 6) && (this.fFeatures & 0x40000) != 0)
|
||||
this.fDOMConfigProperties.setProperty("omit-xml-declaration", "default:no");
|
||||
this.fVisitedNode = nodeArg;
|
||||
}
|
||||
this.fXMLSerializer.setOutputFormat(this.fDOMConfigProperties);
|
||||
try {
|
||||
if (uri == null) {
|
||||
String msg = Utils.messages.createMessage("no-output-specified", null);
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, msg, "no-output-specified"));
|
||||
throw new LSException((short)82, msg);
|
||||
}
|
||||
String absoluteURI = SystemIDResolver.getAbsoluteURI(uri);
|
||||
URL url = new URL(absoluteURI);
|
||||
OutputStream urlOutStream = null;
|
||||
String protocol = url.getProtocol();
|
||||
String host = url.getHost();
|
||||
if (protocol.equalsIgnoreCase("file") && (host == null || host.length() == 0 || host.equals("localhost"))) {
|
||||
urlOutStream = new FileOutputStream(getPathWithoutEscapes(url.getPath()));
|
||||
} else {
|
||||
URLConnection urlCon = url.openConnection();
|
||||
urlCon.setDoInput(false);
|
||||
urlCon.setDoOutput(true);
|
||||
urlCon.setUseCaches(false);
|
||||
urlCon.setAllowUserInteraction(false);
|
||||
if (urlCon instanceof HttpURLConnection) {
|
||||
HttpURLConnection httpCon = (HttpURLConnection)urlCon;
|
||||
httpCon.setRequestMethod("PUT");
|
||||
}
|
||||
urlOutStream = urlCon.getOutputStream();
|
||||
}
|
||||
serializer.setOutputStream(urlOutStream);
|
||||
if (this.fDOMSerializer == null)
|
||||
this.fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer();
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMSerializer.setErrorHandler(this.fDOMErrorHandler);
|
||||
if (this.fSerializerFilter != null)
|
||||
this.fDOMSerializer.setNodeFilter(this.fSerializerFilter);
|
||||
this.fDOMSerializer.setNewLine(this.fEndOfLine.toCharArray());
|
||||
this.fDOMSerializer.serializeDOM3(nodeArg);
|
||||
} catch (LSException lse) {
|
||||
throw lse;
|
||||
} catch (RuntimeException e) {
|
||||
throw (LSException)createLSException((short)82, e).fillInStackTrace();
|
||||
} catch (Exception e) {
|
||||
if (this.fDOMErrorHandler != null)
|
||||
this.fDOMErrorHandler.handleError(new DOMErrorImpl((short)3, e.getMessage(), null, e));
|
||||
throw (LSException)createLSException((short)82, e).fillInStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getXMLVersion(Node nodeArg) {
|
||||
Document doc = null;
|
||||
if (nodeArg != null) {
|
||||
if (nodeArg.getNodeType() == 9) {
|
||||
doc = (Document)nodeArg;
|
||||
} else {
|
||||
doc = nodeArg.getOwnerDocument();
|
||||
}
|
||||
if (doc != null && doc.getImplementation().hasFeature("Core", "3.0"))
|
||||
return doc.getXmlVersion();
|
||||
}
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
protected String getXMLEncoding(Node nodeArg) {
|
||||
Document doc = null;
|
||||
if (nodeArg != null) {
|
||||
if (nodeArg.getNodeType() == 9) {
|
||||
doc = (Document)nodeArg;
|
||||
} else {
|
||||
doc = nodeArg.getOwnerDocument();
|
||||
}
|
||||
if (doc != null && doc.getImplementation().hasFeature("Core", "3.0"))
|
||||
return doc.getXmlEncoding();
|
||||
}
|
||||
return "UTF-8";
|
||||
}
|
||||
|
||||
protected String getInputEncoding(Node nodeArg) {
|
||||
Document doc = null;
|
||||
if (nodeArg != null) {
|
||||
if (nodeArg.getNodeType() == 9) {
|
||||
doc = (Document)nodeArg;
|
||||
} else {
|
||||
doc = nodeArg.getOwnerDocument();
|
||||
}
|
||||
if (doc != null && doc.getImplementation().hasFeature("Core", "3.0"))
|
||||
return doc.getInputEncoding();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public DOMErrorHandler getErrorHandler() {
|
||||
return this.fDOMErrorHandler;
|
||||
}
|
||||
|
||||
private static String getPathWithoutEscapes(String origPath) {
|
||||
if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) {
|
||||
StringTokenizer tokenizer = new StringTokenizer(origPath, "%");
|
||||
StringBuffer result = new StringBuffer(origPath.length());
|
||||
int size = tokenizer.countTokens();
|
||||
result.append(tokenizer.nextToken());
|
||||
for (int i = 1; i < size; i++) {
|
||||
String token = tokenizer.nextToken();
|
||||
if (token.length() >= 2 && isHexDigit(token.charAt(0)) && isHexDigit(token.charAt(1))) {
|
||||
result.append((char)Integer.valueOf(token.substring(0, 2), 16).intValue());
|
||||
token = token.substring(2);
|
||||
}
|
||||
result.append(token);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
return origPath;
|
||||
}
|
||||
|
||||
private static boolean isHexDigit(char c) {
|
||||
return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
|
||||
}
|
||||
|
||||
private static LSException createLSException(short code, Throwable cause) {
|
||||
LSException lse = new LSException(code, (cause != null) ? cause.getMessage() : null);
|
||||
if (cause != null &&
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ThrowableMethods.fgThrowableMethodsAvailable)
|
||||
try {
|
||||
ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object[] { cause });
|
||||
} catch (Exception e) {}
|
||||
return lse;
|
||||
}
|
||||
|
||||
static class ThrowableMethods {
|
||||
private static Method fgThrowableInitCauseMethod = null;
|
||||
|
||||
private static boolean fgThrowableMethodsAvailable = false;
|
||||
|
||||
static {
|
||||
try {
|
||||
fgThrowableInitCauseMethod = Throwable.class.getMethod("initCause", new Class[] { Throwable.class });
|
||||
fgThrowableMethodsAvailable = true;
|
||||
} catch (Exception exc) {
|
||||
fgThrowableInitCauseMethod = null;
|
||||
fgThrowableMethodsAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
package org.apache.xml.serializer.dom3;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class NamespaceSupport {
|
||||
static final String PREFIX_XML = "xml".intern();
|
||||
|
||||
static final String PREFIX_XMLNS = "xmlns".intern();
|
||||
|
||||
public static final String XML_URI = "http://www.w3.org/XML/1998/namespace".intern();
|
||||
|
||||
public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/".intern();
|
||||
|
||||
protected String[] fNamespace = new String[32];
|
||||
|
||||
protected int fNamespaceSize;
|
||||
|
||||
protected int[] fContext = new int[8];
|
||||
|
||||
protected int fCurrentContext;
|
||||
|
||||
protected String[] fPrefixes = new String[16];
|
||||
|
||||
public void reset() {
|
||||
this.fNamespaceSize = 0;
|
||||
this.fCurrentContext = 0;
|
||||
this.fContext[this.fCurrentContext] = this.fNamespaceSize;
|
||||
this.fNamespace[this.fNamespaceSize++] = PREFIX_XML;
|
||||
this.fNamespace[this.fNamespaceSize++] = XML_URI;
|
||||
this.fNamespace[this.fNamespaceSize++] = PREFIX_XMLNS;
|
||||
this.fNamespace[this.fNamespaceSize++] = XMLNS_URI;
|
||||
this.fCurrentContext++;
|
||||
}
|
||||
|
||||
public void pushContext() {
|
||||
if (this.fCurrentContext + 1 == this.fContext.length) {
|
||||
int[] contextarray = new int[this.fContext.length * 2];
|
||||
System.arraycopy(this.fContext, 0, contextarray, 0, this.fContext.length);
|
||||
this.fContext = contextarray;
|
||||
}
|
||||
this.fContext[++this.fCurrentContext] = this.fNamespaceSize;
|
||||
}
|
||||
|
||||
public void popContext() {
|
||||
this.fNamespaceSize = this.fContext[this.fCurrentContext--];
|
||||
}
|
||||
|
||||
public boolean declarePrefix(String prefix, String uri) {
|
||||
if (prefix == PREFIX_XML || prefix == PREFIX_XMLNS)
|
||||
return false;
|
||||
for (int i = this.fNamespaceSize; i > this.fContext[this.fCurrentContext]; i -= 2) {
|
||||
if (this.fNamespace[i - 2].equals(prefix)) {
|
||||
this.fNamespace[i - 1] = uri;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (this.fNamespaceSize == this.fNamespace.length) {
|
||||
String[] namespacearray = new String[this.fNamespaceSize * 2];
|
||||
System.arraycopy(this.fNamespace, 0, namespacearray, 0, this.fNamespaceSize);
|
||||
this.fNamespace = namespacearray;
|
||||
}
|
||||
this.fNamespace[this.fNamespaceSize++] = prefix;
|
||||
this.fNamespace[this.fNamespaceSize++] = uri;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getURI(String prefix) {
|
||||
for (int i = this.fNamespaceSize; i > 0; i -= 2) {
|
||||
if (this.fNamespace[i - 2].equals(prefix))
|
||||
return this.fNamespace[i - 1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getPrefix(String uri) {
|
||||
for (int i = this.fNamespaceSize; i > 0; i -= 2) {
|
||||
if (this.fNamespace[i - 1].equals(uri))
|
||||
if (getURI(this.fNamespace[i - 2]).equals(uri))
|
||||
return this.fNamespace[i - 2];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getDeclaredPrefixCount() {
|
||||
return (this.fNamespaceSize - this.fContext[this.fCurrentContext]) / 2;
|
||||
}
|
||||
|
||||
public String getDeclaredPrefixAt(int index) {
|
||||
return this.fNamespace[this.fContext[this.fCurrentContext] + index * 2];
|
||||
}
|
||||
|
||||
public Enumeration getAllPrefixes() {
|
||||
int count = 0;
|
||||
if (this.fPrefixes.length < this.fNamespace.length / 2) {
|
||||
String[] prefixes = new String[this.fNamespaceSize];
|
||||
this.fPrefixes = prefixes;
|
||||
}
|
||||
String prefix = null;
|
||||
boolean unique = true;
|
||||
for (int i = 2; i < this.fNamespaceSize - 2; i += 2) {
|
||||
prefix = this.fNamespace[i + 2];
|
||||
for (int k = 0; k < count; k++) {
|
||||
if (this.fPrefixes[k] == prefix) {
|
||||
unique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique)
|
||||
this.fPrefixes[count++] = prefix;
|
||||
unique = true;
|
||||
}
|
||||
return new Prefixes(this, this.fPrefixes, count);
|
||||
}
|
||||
|
||||
protected final class Prefixes implements Enumeration {
|
||||
private String[] prefixes;
|
||||
|
||||
private int counter;
|
||||
|
||||
private int size;
|
||||
|
||||
private final NamespaceSupport this$0;
|
||||
|
||||
public Prefixes(NamespaceSupport this$0, String[] prefixes, int size) {
|
||||
this.this$0 = this$0;
|
||||
this.counter = 0;
|
||||
this.size = 0;
|
||||
this.prefixes = prefixes;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public boolean hasMoreElements() {
|
||||
return (this.counter < this.size);
|
||||
}
|
||||
|
||||
public Object nextElement() {
|
||||
if (this.counter < this.size)
|
||||
return this.this$0.fPrefixes[this.counter++];
|
||||
throw new NoSuchElementException("Illegal access to Namespace prefixes enumeration.");
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for (int i = 0; i < this.size; i++) {
|
||||
buf.append(this.prefixes[i]);
|
||||
buf.append(" ");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
##
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
##
|
||||
#
|
||||
# $Id: output_html.properties 468654 2006-10-28 07:09:23Z minchau $
|
||||
#
|
||||
# Specify defaults when method="html". These defaults use output_xml.properties
|
||||
# as a base.
|
||||
#
|
||||
|
||||
# XSLT properties do not need namespace qualification.
|
||||
method=html
|
||||
indent=yes
|
||||
media-type=text/html
|
||||
version=4.0
|
||||
|
||||
# Xalan-specific output properties. These can be overridden in the stylesheet
|
||||
# assigning a xalan namespace. For example:
|
||||
# <xsl:stylesheet version="1.0"
|
||||
# xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
# xmlns:xalan="http://xml.apache.org/xalan">
|
||||
# <xsl:output method="html" encoding="UTF-8"
|
||||
# xalan:content-handler="MyContentHandler"/>
|
||||
# ...
|
||||
# Note that the colon after the protocol needs to be escaped.
|
||||
{http\u003a//xml.apache.org/xalan}indent-amount=0
|
||||
{http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToHTMLStream
|
||||
{http\u003a//xml.apache.org/xalan}entities=org/apache/xml/serializer/HTMLEntities
|
||||
{http\u003a//xml.apache.org/xalan}use-url-escaping=yes
|
||||
{http\u003a//xml.apache.org/xalan}omit-meta-tag=no
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
##
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
##
|
||||
#
|
||||
# $Id: output_text.properties 468654 2006-10-28 07:09:23Z minchau $
|
||||
#
|
||||
# Specify defaults when method="text".
|
||||
#
|
||||
|
||||
# XSLT properties do not need namespace qualification.
|
||||
method=text
|
||||
media-type=text/plain
|
||||
|
||||
# Xalan-specific output properties. These can be overridden in the stylesheet
|
||||
# assigning a xalan namespace. For example:
|
||||
# <xsl:stylesheet version="1.0"
|
||||
# xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
# xmlns:xalan="http://xml.apache.org/xalan">
|
||||
# <xsl:output method="html" encoding="UTF-8"
|
||||
# xalan:content-handler="MyContentHandler"/>
|
||||
# ...
|
||||
# Note that the colon after the protocol needs to be escaped.
|
||||
{http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToTextStream
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
##
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
##
|
||||
#
|
||||
# $Id: output_unknown.properties 468654 2006-10-28 07:09:23Z minchau $
|
||||
#
|
||||
# Specify defaults when no method="..." is specified.
|
||||
# This type of output will quickly switch to "xml" or "html"
|
||||
# depending on the first element name.
|
||||
#
|
||||
|
||||
# XSLT properties do not need namespace qualification.
|
||||
method=xml
|
||||
version=1.0
|
||||
encoding=UTF-8
|
||||
indent=no
|
||||
omit-xml-declaration=no
|
||||
standalone=no
|
||||
media-type=text/xml
|
||||
|
||||
# Xalan-specific output properties. These can be overridden in the stylesheet
|
||||
# assigning a xalan namespace. For example:
|
||||
# <xsl:stylesheet version="1.0"
|
||||
# xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
# xmlns:xalan="http://xml.apache.org/xalan">
|
||||
# <xsl:output method="html" encoding="UTF-8"
|
||||
# xalan:content-handler="MyContentHandler"/>
|
||||
# ...
|
||||
# Note that the colon after the protocol needs to be escaped.
|
||||
{http\u003a//xml.apache.org/xalan}indent-amount=0
|
||||
{http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToUnknownStream
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
##
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# 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.
|
||||
##
|
||||
#
|
||||
# $Id: output_xml.properties 468654 2006-10-28 07:09:23Z minchau $
|
||||
#
|
||||
# Specify defaults when method="xml". These defaults serve as a base for
|
||||
# other defaults, such as output_html and output_text.
|
||||
#
|
||||
|
||||
# XSLT properties do not need namespace qualification.
|
||||
method=xml
|
||||
version=1.0
|
||||
encoding=UTF-8
|
||||
indent=no
|
||||
omit-xml-declaration=no
|
||||
standalone=no
|
||||
media-type=text/xml
|
||||
|
||||
# Xalan-specific output properties. These can be overridden in the stylesheet
|
||||
# assigning a xalan namespace. For example:
|
||||
# <xsl:stylesheet version="1.0"
|
||||
# xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
# xmlns:xalan="http://xml.apache.org/xalan">
|
||||
# <xsl:output method="html" encoding="UTF-8"
|
||||
# xalan:content-handler="MyContentHandler"/>
|
||||
# ...
|
||||
# Note that the colon after the protocol needs to be escaped.
|
||||
{http\u003a//xml.apache.org/xalan}indent-amount=0
|
||||
{http\u003a//xml.apache.org/xalan}content-handler=org.apache.xml.serializer.ToXMLStream
|
||||
{http\u003a//xml.apache.org/xalan}entities=org/apache/xml/serializer/XMLEntities
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
public final class AttList implements Attributes {
|
||||
NamedNodeMap m_attrs;
|
||||
|
||||
int m_lastIndex;
|
||||
|
||||
DOM2Helper m_dh;
|
||||
|
||||
public AttList(NamedNodeMap attrs, DOM2Helper dh) {
|
||||
this.m_attrs = attrs;
|
||||
this.m_lastIndex = this.m_attrs.getLength() - 1;
|
||||
this.m_dh = dh;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return this.m_attrs.getLength();
|
||||
}
|
||||
|
||||
public String getURI(int index) {
|
||||
String ns = this.m_dh.getNamespaceOfNode(this.m_attrs.item(index));
|
||||
if (null == ns)
|
||||
ns = "";
|
||||
return ns;
|
||||
}
|
||||
|
||||
public String getLocalName(int index) {
|
||||
return this.m_dh.getLocalNameOfNode(this.m_attrs.item(index));
|
||||
}
|
||||
|
||||
public String getQName(int i) {
|
||||
return ((Attr)this.m_attrs.item(i)).getName();
|
||||
}
|
||||
|
||||
public String getType(int i) {
|
||||
return "CDATA";
|
||||
}
|
||||
|
||||
public String getValue(int i) {
|
||||
return ((Attr)this.m_attrs.item(i)).getValue();
|
||||
}
|
||||
|
||||
public String getType(String name) {
|
||||
return "CDATA";
|
||||
}
|
||||
|
||||
public String getType(String uri, String localName) {
|
||||
return "CDATA";
|
||||
}
|
||||
|
||||
public String getValue(String name) {
|
||||
Attr attr = (Attr)this.m_attrs.getNamedItem(name);
|
||||
return (null != attr) ? attr.getValue() : null;
|
||||
}
|
||||
|
||||
public String getValue(String uri, String localName) {
|
||||
Node a = this.m_attrs.getNamedItemNS(uri, localName);
|
||||
return (a == null) ? null : a.getNodeValue();
|
||||
}
|
||||
|
||||
public int getIndex(String uri, String localPart) {
|
||||
for (int i = this.m_attrs.getLength() - 1; i >= 0; i--) {
|
||||
Node a = this.m_attrs.item(i);
|
||||
String u = a.getNamespaceURI();
|
||||
if (((u == null) ? ((uri == null)) : u.equals(uri)) && a.getLocalName().equals(localPart))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getIndex(String qName) {
|
||||
for (int i = this.m_attrs.getLength() - 1; i >= 0; i--) {
|
||||
Node a = this.m_attrs.item(i);
|
||||
if (a.getNodeName().equals(qName))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
public final class BoolStack {
|
||||
private boolean[] m_values;
|
||||
|
||||
private int m_allocatedSize;
|
||||
|
||||
private int m_index;
|
||||
|
||||
public BoolStack() {
|
||||
this(32);
|
||||
}
|
||||
|
||||
public BoolStack(int size) {
|
||||
this.m_allocatedSize = size;
|
||||
this.m_values = new boolean[size];
|
||||
this.m_index = -1;
|
||||
}
|
||||
|
||||
public final int size() {
|
||||
return this.m_index + 1;
|
||||
}
|
||||
|
||||
public final void clear() {
|
||||
this.m_index = -1;
|
||||
}
|
||||
|
||||
public final boolean push(boolean val) {
|
||||
if (this.m_index == this.m_allocatedSize - 1)
|
||||
grow();
|
||||
this.m_values[++this.m_index] = val;
|
||||
return val;
|
||||
}
|
||||
|
||||
public final boolean pop() {
|
||||
return this.m_values[this.m_index--];
|
||||
}
|
||||
|
||||
public final boolean popAndTop() {
|
||||
this.m_index--;
|
||||
return (this.m_index >= 0) ? this.m_values[this.m_index] : false;
|
||||
}
|
||||
|
||||
public final void setTop(boolean b) {
|
||||
this.m_values[this.m_index] = b;
|
||||
}
|
||||
|
||||
public final boolean peek() {
|
||||
return this.m_values[this.m_index];
|
||||
}
|
||||
|
||||
public final boolean peekOrFalse() {
|
||||
return (this.m_index > -1) ? this.m_values[this.m_index] : false;
|
||||
}
|
||||
|
||||
public final boolean peekOrTrue() {
|
||||
return (this.m_index > -1) ? this.m_values[this.m_index] : true;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return (this.m_index == -1);
|
||||
}
|
||||
|
||||
private void grow() {
|
||||
this.m_allocatedSize *= 2;
|
||||
boolean[] newVector = new boolean[this.m_allocatedSize];
|
||||
System.arraycopy(this.m_values, 0, newVector, 0, this.m_index + 1);
|
||||
this.m_values = newVector;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public final class DOM2Helper {
|
||||
public String getLocalNameOfNode(Node n) {
|
||||
String name = n.getLocalName();
|
||||
return (null == name) ? getLocalNameOfNodeFallback(n) : name;
|
||||
}
|
||||
|
||||
private String getLocalNameOfNodeFallback(Node n) {
|
||||
String qname = n.getNodeName();
|
||||
int index = qname.indexOf(':');
|
||||
return (index < 0) ? qname : qname.substring(index + 1);
|
||||
}
|
||||
|
||||
public String getNamespaceOfNode(Node n) {
|
||||
return n.getNamespaceURI();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ListResourceBundle;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public final class Messages {
|
||||
private final Locale m_locale = Locale.getDefault();
|
||||
|
||||
private ListResourceBundle m_resourceBundle;
|
||||
|
||||
private String m_resourceBundleName;
|
||||
|
||||
Messages(String resourceBundle) {
|
||||
this.m_resourceBundleName = resourceBundle;
|
||||
}
|
||||
|
||||
private Locale getLocale() {
|
||||
return this.m_locale;
|
||||
}
|
||||
|
||||
private ListResourceBundle getResourceBundle() {
|
||||
return this.m_resourceBundle;
|
||||
}
|
||||
|
||||
public final String createMessage(String msgKey, Object[] args) {
|
||||
if (this.m_resourceBundle == null)
|
||||
this.m_resourceBundle = loadResourceBundle(this.m_resourceBundleName);
|
||||
if (this.m_resourceBundle != null)
|
||||
return createMsg(this.m_resourceBundle, msgKey, args);
|
||||
return "Could not load the resource bundles: " + this.m_resourceBundleName;
|
||||
}
|
||||
|
||||
private final String createMsg(ListResourceBundle fResourceBundle, String msgKey, Object[] args) {
|
||||
String fmsg = null;
|
||||
boolean throwex = false;
|
||||
String msg = null;
|
||||
if (msgKey != null) {
|
||||
msg = fResourceBundle.getString(msgKey);
|
||||
} else {
|
||||
msgKey = "";
|
||||
}
|
||||
if (msg == null) {
|
||||
throwex = true;
|
||||
try {
|
||||
msg = MessageFormat.format("BAD_MSGKEY", new Object[] { msgKey, this.m_resourceBundleName });
|
||||
} catch (Exception e) {
|
||||
msg = "The message key '" + msgKey + "' is not in the message class '" + this.m_resourceBundleName + "'";
|
||||
}
|
||||
} else if (args != null) {
|
||||
try {
|
||||
int n = args.length;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (null == args[i])
|
||||
args[i] = "";
|
||||
}
|
||||
fmsg = MessageFormat.format(msg, args);
|
||||
} catch (Exception e) {
|
||||
throwex = true;
|
||||
try {
|
||||
fmsg = MessageFormat.format("BAD_MSGFORMAT", new Object[] { msgKey, this.m_resourceBundleName });
|
||||
fmsg = fmsg + " " + msg;
|
||||
} catch (Exception formatfailed) {
|
||||
fmsg = "The format of message '" + msgKey + "' in message class '" + this.m_resourceBundleName + "' failed.";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fmsg = msg;
|
||||
}
|
||||
if (throwex)
|
||||
throw new RuntimeException(fmsg);
|
||||
return fmsg;
|
||||
}
|
||||
|
||||
private ListResourceBundle loadResourceBundle(String resourceBundle) throws MissingResourceException {
|
||||
ListResourceBundle listResourceBundle;
|
||||
this.m_resourceBundleName = resourceBundle;
|
||||
Locale locale = getLocale();
|
||||
try {
|
||||
ResourceBundle rb = ResourceBundle.getBundle(this.m_resourceBundleName, locale);
|
||||
listResourceBundle = (ListResourceBundle)rb;
|
||||
} catch (MissingResourceException e) {
|
||||
try {
|
||||
listResourceBundle = (ListResourceBundle)ResourceBundle.getBundle(this.m_resourceBundleName, new Locale("en", "US"));
|
||||
} catch (MissingResourceException e2) {
|
||||
throw new MissingResourceException("Could not load any resource bundles." + this.m_resourceBundleName, this.m_resourceBundleName, "");
|
||||
}
|
||||
}
|
||||
this.m_resourceBundle = listResourceBundle;
|
||||
return listResourceBundle;
|
||||
}
|
||||
|
||||
private static String getResourceSuffix(Locale locale) {
|
||||
String suffix = "_" + locale.getLanguage();
|
||||
String country = locale.getCountry();
|
||||
if (country.equals("TW"))
|
||||
suffix = suffix + "_" + country;
|
||||
return suffix;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
public class MsgKey {
|
||||
public static final String BAD_MSGKEY = "BAD_MSGKEY";
|
||||
|
||||
public static final String BAD_MSGFORMAT = "BAD_MSGFORMAT";
|
||||
|
||||
public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND";
|
||||
|
||||
public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD";
|
||||
|
||||
public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO";
|
||||
|
||||
public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE";
|
||||
|
||||
public static final String ER_OIERROR = "ER_OIERROR";
|
||||
|
||||
public static final String ER_NAMESPACE_PREFIX = "ER_NAMESPACE_PREFIX";
|
||||
|
||||
public static final String ER_STRAY_ATTRIBUTE = "ER_STRAY_ATTRIBUTE";
|
||||
|
||||
public static final String ER_STRAY_NAMESPACE = "ER_STRAY_NAMESPACE";
|
||||
|
||||
public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE";
|
||||
|
||||
public static final String ER_COULD_NOT_LOAD_METHOD_PROPERTY = "ER_COULD_NOT_LOAD_METHOD_PROPERTY";
|
||||
|
||||
public static final String ER_SERIALIZER_NOT_CONTENTHANDLER = "ER_SERIALIZER_NOT_CONTENTHANDLER";
|
||||
|
||||
public static final String ER_ILLEGAL_ATTRIBUTE_POSITION = "ER_ILLEGAL_ATTRIBUTE_POSITION";
|
||||
|
||||
public static final String ER_ILLEGAL_CHARACTER = "ER_ILLEGAL_CHARACTER";
|
||||
|
||||
public static final String ER_INVALID_PORT = "ER_INVALID_PORT";
|
||||
|
||||
public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL";
|
||||
|
||||
public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED";
|
||||
|
||||
public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT";
|
||||
|
||||
public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING";
|
||||
|
||||
public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE";
|
||||
|
||||
public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR";
|
||||
|
||||
public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI";
|
||||
|
||||
public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR";
|
||||
|
||||
public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL";
|
||||
|
||||
public static final String ER_FRAG_FOR_GENERIC_URI = "ER_FRAG_FOR_GENERIC_URI";
|
||||
|
||||
public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI";
|
||||
|
||||
public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS";
|
||||
|
||||
public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH";
|
||||
|
||||
public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH";
|
||||
|
||||
public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST";
|
||||
|
||||
public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST";
|
||||
|
||||
public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED";
|
||||
|
||||
public static final String ER_XML_VERSION_NOT_SUPPORTED = "ER_XML_VERSION_NOT_SUPPORTED";
|
||||
|
||||
public static final String ER_FACTORY_PROPERTY_MISSING = "ER_FACTORY_PROPERTY_MISSING";
|
||||
|
||||
public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED";
|
||||
|
||||
public static final String ER_FEATURE_NOT_FOUND = "FEATURE_NOT_FOUND";
|
||||
|
||||
public static final String ER_FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED";
|
||||
|
||||
public static final String ER_STRING_TOO_LONG = "DOMSTRING_SIZE_ERR";
|
||||
|
||||
public static final String ER_TYPE_MISMATCH_ERR = "TYPE_MISMATCH_ERR";
|
||||
|
||||
public static final String ER_NO_OUTPUT_SPECIFIED = "no-output-specified";
|
||||
|
||||
public static final String ER_UNSUPPORTED_ENCODING = "unsupported-encoding";
|
||||
|
||||
public static final String ER_ELEM_UNBOUND_PREFIX_IN_ENTREF = "unbound-prefix-in-entity-reference";
|
||||
|
||||
public static final String ER_ATTR_UNBOUND_PREFIX_IN_ENTREF = "unbound-prefix-in-entity-reference";
|
||||
|
||||
public static final String ER_CDATA_SECTIONS_SPLIT = "cdata-sections-splitted";
|
||||
|
||||
public static final String ER_WF_INVALID_CHARACTER = "wf-invalid-character";
|
||||
|
||||
public static final String ER_WF_INVALID_CHARACTER_IN_NODE_NAME = "wf-invalid-character-in-node-name";
|
||||
|
||||
public static final String ER_UNABLE_TO_SERIALIZE_NODE = "ER_UNABLE_TO_SERIALIZE_NODE";
|
||||
|
||||
public static final String ER_WARNING_WF_NOT_CHECKED = "ER_WARNING_WF_NOT_CHECKED";
|
||||
|
||||
public static final String ER_WF_INVALID_CHARACTER_IN_COMMENT = "ER_WF_INVALID_CHARACTER_IN_COMMENT";
|
||||
|
||||
public static final String ER_WF_INVALID_CHARACTER_IN_PI = "ER_WF_INVALID_CHARACTER_IN_PI";
|
||||
|
||||
public static final String ER_WF_INVALID_CHARACTER_IN_CDATA = "ER_WF_INVALID_CHARACTER_IN_CDATA";
|
||||
|
||||
public static final String ER_WF_INVALID_CHARACTER_IN_TEXT = "ER_WF_INVALID_CHARACTER_IN_TEXT";
|
||||
|
||||
public static final String ER_WF_DASH_IN_COMMENT = "ER_WF_DASH_IN_COMMENT";
|
||||
|
||||
public static final String ER_WF_LT_IN_ATTVAL = "ER_WF_LT_IN_ATTVAL";
|
||||
|
||||
public static final String ER_WF_REF_TO_UNPARSED_ENT = "ER_WF_REF_TO_UNPARSED_ENT";
|
||||
|
||||
public static final String ER_WF_REF_TO_EXTERNAL_ENT = "ER_WF_REF_TO_EXTERNAL_ENT";
|
||||
|
||||
public static final String ER_NS_PREFIX_CANNOT_BE_BOUND = "ER_NS_PREFIX_CANNOT_BE_BOUND";
|
||||
|
||||
public static final String ER_NULL_LOCAL_ELEMENT_NAME = "ER_NULL_LOCAL_ELEMENT_NAME";
|
||||
|
||||
public static final String ER_NULL_LOCAL_ATTR_NAME = "ER_NULL_LOCAL_ATTR_NAME";
|
||||
|
||||
public static final String ER_WRITING_INTERNAL_SUBSET = "ER_WRITING_INTERNAL_SUBSET";
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "The message key ''{0}'' is not in the message class ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "The format of message ''{0}'' in message class ''{1}'' failed." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "The serializer class ''{0}'' does not implement org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "The resource [ {0} ] could not be found.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "The resource [ {0} ] could not load: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Buffer size <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Invalid UTF-16 surrogate detected: {0} ?" }, new Object[] { "ER_OIERROR", "IO error" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Cannot add attribute {0} after child nodes or before an element is produced. Attribute will be ignored." }, new Object[] { "ER_NAMESPACE_PREFIX", "Namespace for prefix ''{0}'' has not been declared." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Attribute ''{0}'' outside of element." }, new Object[] { "ER_STRAY_NAMESPACE", "Namespace declaration ''{0}''=''{1}'' outside of element." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Could not load ''{0}'' (check CLASSPATH), now using just the defaults" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Attempt to output character of integral value {0} that is not represented in specified output encoding of {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Could not load the propery file ''{0}'' for output method ''{1}'' (check CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Invalid port number" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Port cannot be set when host is null" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Host is not a well formed address" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "The scheme is not conformant." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Cannot set scheme from null string" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Path contains invalid escape sequence" }, new Object[] { "ER_PATH_INVALID_CHAR", "Path contains invalid character: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Fragment contains invalid character" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Fragment cannot be set when path is null" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Fragment can only be set for a generic URI" }, new Object[] { "ER_NO_SCHEME_IN_URI", "No scheme found in URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Cannot initialize URI with empty parameters" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Fragment cannot be specified in both the path and fragment" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Query string cannot be specified in path and query string" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Port may not be specified if host is not specified" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Userinfo may not be specified if host is not specified" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Warning: The version of the output document is requested to be ''{0}''. This version of XML is not supported. The version of the output document will be ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Scheme is required!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "The Properties object passed to the SerializerFactory does not have a ''{0}'' property." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Warning: The encoding ''{0}'' is not supported by the Java runtime." }, new Object[] { "FEATURE_NOT_FOUND", "The parameter ''{0}'' is not recognized." }, new Object[] { "FEATURE_NOT_SUPPORTED", "The parameter ''{0}'' is recognized but the requested value cannot be set." }, new Object[] { "DOMSTRING_SIZE_ERR", "The resulting string is too long to fit in a DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "The value type for this parameter name is incompatible with the expected value type." }, new Object[] { "no-output-specified", "The output destination for data to be written to was null." },
|
||||
new Object[] { "unsupported-encoding", "An unsupported encoding is encountered." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "The node could not be serialized." }, new Object[] { "cdata-sections-splitted", "The CDATA Section contains one or more termination markers ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "An instance of the Well-Formedness checker could not be created. The well-formed parameter was set to true but well-formedness checking can not be performed." }, new Object[] { "wf-invalid-character", "The node ''{0}'' contains invalid XML characters." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "An invalid XML character (Unicode: 0x{0}) was found in the comment." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "An invalid XML character (Unicode: 0x{0}) was found in the processing instructiondata." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "An invalid XML character (Unicode: 0x{0}) was found in the contents of the CDATASection." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "An invalid XML character (Unicode: 0x{0}) was found in the node''s character data content." }, new Object[] { "wf-invalid-character-in-node-name", "An invalid XML character(s) was found in the {0} node named ''{1}''." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "The string \"--\" is not permitted within comments." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "The value of attribute \"{1}\" associated with an element type \"{0}\" must not contain the ''<'' character." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "The unparsed entity reference \"&{0};\" is not permitted." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "The external entity reference \"&{0};\" is not permitted in an attribute value." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "The prefix \"{0}\" can not be bound to namespace \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "The local name of element \"{0}\" is null." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "The local name of attr \"{0}\" is null." }, new Object[] { "unbound-prefix-in-entity-reference", "The replacement text of the entity node \"{0}\" contains an element node \"{1}\" with an unbound prefix \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "The replacement text of the entity node \"{0}\" contains an attribute node \"{1}\" with an unbound prefix \"{2}\"." }, new Object[] { "ER_WRITING_INTERNAL_SUBSET", "An error occured while writing the internal subset." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_ca extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "La clau del missatge ''{0}'' no està a la classe del missatge ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "El format del missatge ''{0}'' a la classe del missatge ''{1}'' ha fallat." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "La classe de serialitzador ''{0}'' no implementa org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "No s''ha trobat el recurs [ {0} ].\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "No s''ha pogut carregar el recurs [ {0} ]: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Grandària del buffer <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "S''ha detectat un suplent UTF-16 no vàlid: {0} ?" }, new Object[] { "ER_OIERROR", "Error d'E/S" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "No es pot afegir l''atribut {0} després dels nodes subordinats o abans que es produeixi un element. Es passarà per alt l''atribut." }, new Object[] { "ER_NAMESPACE_PREFIX", "No s''ha declarat l''espai de noms pel prefix ''{0}''." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "L''atribut ''{0}'' es troba fora de l''element." }, new Object[] { "ER_STRAY_NAMESPACE", "La declaració de l''espai de noms ''{0}''=''{1}'' es troba fora de l''element." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "No s''ha pogut carregar ''{0}'' (comproveu CLASSPATH), ara s''està fent servir els valors per defecte." }, new Object[] { "ER_ILLEGAL_CHARACTER", "S''ha intentat un caràcter de sortida del valor integral {0} que no està representat a una codificació de sortida especificada de {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "No s''ha pogut carregar el fitxer de propietats ''{0}'' del mètode de sortida ''{1}'' (comproveu CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Número de port no vàlid" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "El port no es pot establir quan el sistema principal és nul" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "El format de l'adreça del sistema principal no és el correcte" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "L'esquema no té conformitat." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "No es pot establir un esquema des d'una cadena nul·la" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "La via d'accés conté una seqüència d'escapament no vàlida" }, new Object[] { "ER_PATH_INVALID_CHAR", "La via d''accés conté un caràcter no vàlid {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "El fragment conté un caràcter no vàlid" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "El fragment no es pot establir si la via d'accés és nul·la" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "El fragment només es pot establir per a un URI genèric" }, new Object[] { "ER_NO_SCHEME_IN_URI", "No s'ha trobat cap esquema a l'URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "No es pot inicialitzar l'URI amb paràmetres buits" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "No es pot especificar un fragment tant en la via d'accés com en el fragment" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "No es pot especificar una cadena de consulta en la via d'accés i la cadena de consulta" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "No es pot especificar el port si no s'especifica el sistema principal" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "No es pot especificar informació de l'usuari si no s'especifica el sistema principal" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Avís: la versió del document de sortida s''ha sol·licitat que sigui ''{0}''. Aquesta versió de XML no està suportada. La versió del document de sortida serà ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Es necessita l'esquema" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "L''objecte de propietats passat a SerializerFactory no té cap propietat ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Avís: el temps d''execució de Java no dóna suport a la codificació ''{0}''." }, new Object[] { "FEATURE_NOT_FOUND", "El paràmetre ''{0}'' no es reconeix." }, new Object[] { "FEATURE_NOT_SUPPORTED", "El paràmetre ''{0}'' es reconeix però el valor sol·licitat no es pot establir." }, new Object[] { "DOMSTRING_SIZE_ERR", "La cadena resultant és massa llarga per cabre en una DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "El tipus de valor per a aquest nom de paràmetre és incompatible amb el tipus de valor esperat." }, new Object[] { "no-output-specified", "La destinació de sortida per a les dades que s'ha d'escriure era nul·la." },
|
||||
new Object[] { "unsupported-encoding", "S'ha trobat una codificació no suportada." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "El node no s'ha pogut serialitzat." }, new Object[] { "cdata-sections-splitted", "La secció CDATA conté un o més marcadors d'acabament ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "No s'ha pogut crear cap instància per comprovar si té un format correcte o no. El paràmetre del tipus ben format es va establir en cert, però la comprovació de format no s'ha pogut realitzar." }, new Object[] { "wf-invalid-character", "El node ''{0}'' conté caràcters XML no vàlids." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "S''ha trobat un caràcter XML no vàlid (Unicode: 0x{0}) en el comentari." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "S''ha trobat un caràcter XML no vàlid (Unicode: 0x{0}) en les dades d''instrucció de procés." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "S''ha trobat un caràcter XML no vàlid (Unicode: 0x''{0})'' en els continguts de la CDATASection." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "S''ha trobat un caràcter XML no vàlid (Unicode: 0x''{0})'' en el contingut de dades de caràcter del node." }, new Object[] { "wf-invalid-character-in-node-name", "S''han trobat caràcters XML no vàlids al node {0} anomenat ''{1}''." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "La cadena \"--\" no està permesa dins dels comentaris." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "El valor d''atribut \"{1}\" associat amb un tipus d''element \"{0}\" no pot contenir el caràcter ''<''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "La referència de l''entitat no analitzada \"&{0};\" no està permesa." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "La referència externa de l''entitat \"&{0};\" no està permesa en un valor d''atribut." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "El prefix \"{0}\" no es pot vincular a l''espai de noms \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "El nom local de l''element \"{0}\" és nul." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "El nom local d''atr \"{0}\" és nul." }, new Object[] { "unbound-prefix-in-entity-reference", "El text de recanvi del node de l''entitat \"{0}\" conté un node d''element \"{1}\" amb un prefix de no enllaçat \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "El text de recanvi del node de l''entitat \"{0}\" conté un node d''atribut \"{1}\" amb un prefix de no enllaçat \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_cs extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "Klíč zprávy ''{0}'' není obsažen ve třídě zpráv ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Formát zprávy ''{0}'' ve třídě zpráv ''{1}'' selhal. " }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "Třída serializace ''{0}'' neimplementuje obslužný program org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Nelze najít zdroj [ {0} ].\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Nelze zavést zdroj [ {0} ]: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Velikost vyrovnávací paměti <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Byla zjištěna neplatná náhrada UTF-16: {0} ?" }, new Object[] { "ER_OIERROR", "Chyba vstupu/výstupu" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Nelze přidat atribut {0} po uzlech potomků ani před tím, než je vytvořen prvek. Atribut bude ignorován." }, new Object[] { "ER_NAMESPACE_PREFIX", "Obor názvů pro předponu ''{0}'' nebyl deklarován." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Atribut ''{0}'' se nachází vně prvku." }, new Object[] { "ER_STRAY_NAMESPACE", "Deklarace oboru názvů ''{0}''=''{1}'' se nachází vně prvku." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Nelze zavést prostředek ''{0}'' (zkontrolujte proměnnou CLASSPATH) - budou použity pouze výchozí prostředky" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Byl proveden pokus o výstup znaku s celočíselnou hodnotou {0}, která není reprezentována v určeném výstupním kódování {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Nelze načíst soubor vlastností ''{0}'' pro výstupní metodu ''{1}'' (zkontrolujte proměnnou CLASSPATH)." }, new Object[] { "ER_INVALID_PORT", "Neplatné číslo portu." }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Má-li hostitel hodnotu null, nelze nastavit port." }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Adresa hostitele má nesprávný formát." }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Schéma nevyhovuje." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Nelze nastavit schéma řetězce s hodnotou null." },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Cesta obsahuje neplatnou escape sekvenci" }, new Object[] { "ER_PATH_INVALID_CHAR", "Cesta obsahuje neplatný znak: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Fragment obsahuje neplatný znak." }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Má-li cesta hodnotu null, nelze nastavit fragment." }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Fragment lze nastavit jen u generického URI." }, new Object[] { "ER_NO_SCHEME_IN_URI", "V URI nebylo nalezeno žádné schéma" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "URI nelze inicializovat s prázdnými parametry." }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Fragment nelze určit zároveň v cestě i ve fragmentu." }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "V řetězci cesty a dotazu nelze zadat řetězec dotazu." }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Není-li určen hostitel, nelze zadat port." },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Není-li určen hostitel, nelze zadat údaje o uživateli." }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Varování: Je požadována verze ''{0}'' výstupního dokumentu. Tato verze formátu XML není podporována. Bude použita verze ''1.0'' výstupního dokumentu. " }, new Object[] { "ER_SCHEME_REQUIRED", "Je vyžadováno schéma!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "Objekt vlastností předaný faktorii SerializerFactory neobsahuje vlastnost ''{0}''. " }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Varování: Kódování ''{0}'' není v běhovém prostředí Java podporováno." }, new Object[] { "FEATURE_NOT_FOUND", "Parametr ''{0}'' nebyl rozpoznán." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Parametr ''{0}'' byl rozpoznán, ale nelze nastavit požadovanou hodnotu." }, new Object[] { "DOMSTRING_SIZE_ERR", "Výsledný řetězec je příliš dlouhý pro řetězec DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Typ hodnoty pro tento název parametru není kompatibilní s očekávaným typem hodnoty." }, new Object[] { "no-output-specified", "Cílové umístění výstupu pro data určená k zápisu je rovno hodnotě Null. " },
|
||||
new Object[] { "unsupported-encoding", "Bylo nalezeno nepodporované kódování." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Nelze provést serializaci uzlu. " }, new Object[] { "cdata-sections-splitted", "Sekce CDATA obsahuje jednu nebo více ukončovacích značek ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Nelze vytvořit instanci modulu pro kontrolu správného utvoření. Parametr správného utvoření byl nastaven na hodnotu true, nepodařilo se však zkontrolovat správnost utvoření. " }, new Object[] { "wf-invalid-character", "Uzel ''{0}'' obsahuje neplatné znaky XML. " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "V poznámce byl zjištěn neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "V datech instrukce zpracování byl nalezen neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "V oddílu CDATASection byl nalezen neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "V obsahu znakových dat uzlu byl nalezen neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "wf-invalid-character-in-node-name", "V objektu {0} s názvem ''{1}'' byl nalezen neplatný znak XML. " },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "V poznámkách není povolen řetězec \"--\"." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "Hodnota atributu \"{1}\" souvisejícího s typem prvku \"{0}\" nesmí obsahovat znak ''<''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Odkaz na neanalyzovanou entitu \"&{0};\" není povolen." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Externí odkaz na entitu \"&{0};\" není v hodnotě atributu povolen." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Předpona \"{0}\" nesmí být vázaná k oboru názvů \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Lokální název prvku \"{0}\" má hodnotu Null. " }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Lokální název atributu \"{0}\" má hodnotu Null. " }, new Object[] { "unbound-prefix-in-entity-reference", "Nový text uzlu entity \"{0}\" obsahuje uzel prvku \"{1}\" s nesvázanou předponou \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "Nový text uzlu entity \"{0}\" obsahuje uzel atributu \"{1}\" s nesvázanou předponou \"{2}\". " } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_de extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "Der Nachrichtenschlüssel ''{0}'' ist nicht in der Nachrichtenklasse ''{1}'' enthalten." }, new Object[] { "BAD_MSGFORMAT", "Das Format der Nachricht ''{0}'' in der Nachrichtenklasse ''{1}'' ist fehlgeschlagen." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "Die Parallel-Seriell-Umsetzerklasse ''{0}'' implementiert org.xml.sax.ContentHandler nicht." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Die Ressource [ {0} ] konnte nicht gefunden werden.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Die Ressource [ {0} ] konnte nicht geladen werden: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Puffergröße <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Ungültige UTF-16-Ersetzung festgestellt: {0} ?" }, new Object[] { "ER_OIERROR", "E/A-Fehler" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Attribut {0} kann nicht nach Kindknoten oder vor dem Erstellen eines Elements hinzugefügt werden. Das Attribut wird ignoriert." }, new Object[] { "ER_NAMESPACE_PREFIX", "Der Namensbereich für Präfix ''{0}'' wurde nicht deklariert." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Attribut ''{0}'' befindet sich nicht in einem Element." }, new Object[] { "ER_STRAY_NAMESPACE", "Namensbereichdeklaration ''{0}''=''{1}'' befindet sich nicht in einem Element." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "''{0}'' konnte nicht geladen werden (CLASSPATH prüfen). Es werden die Standardwerte verwendet." }, new Object[] { "ER_ILLEGAL_CHARACTER", "Es wurde versucht, ein Zeichen des Integralwerts {0} auszugeben, der nicht in der angegebenen Ausgabeverschlüsselung von {1} dargestellt ist." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Die Merkmaldatei ''{0}'' konnte für die Ausgabemethode ''{1}'' nicht geladen werden (CLASSPATH prüfen)" }, new Object[] { "ER_INVALID_PORT", "Ungültige Portnummer" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Der Port kann nicht festgelegt werden, wenn der Host gleich Null ist." }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Der Host ist keine syntaktisch korrekte Adresse." }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Das Schema ist nicht angepasst." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Schema kann nicht von Nullzeichenfolge festgelegt werden." },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Der Pfad enthält eine ungültige Escapezeichenfolge." }, new Object[] { "ER_PATH_INVALID_CHAR", "Pfad enthält ungültiges Zeichen: {0}." }, new Object[] { "ER_FRAG_INVALID_CHAR", "Fragment enthält ein ungültiges Zeichen." }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Fragment kann nicht festgelegt werden, wenn der Pfad gleich Null ist." }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Fragment kann nur für eine generische URI (Uniform Resource Identifier) festgelegt werden." }, new Object[] { "ER_NO_SCHEME_IN_URI", "Kein Schema gefunden in URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "URI (Uniform Resource Identifier) kann nicht mit leeren Parametern initialisiert werden." }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Fragment kann nicht im Pfad und im Fragment angegeben werden." }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Abfragezeichenfolge kann nicht im Pfad und in der Abfragezeichenfolge angegeben werden." }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Der Port kann nicht angegeben werden, wenn der Host nicht angegeben wurde." },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Benutzerinformationen können nicht angegeben werden, wenn der Host nicht angegeben wurde." }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Warnung: Die Version des Ausgabedokuments muss ''{0}'' lauten. Diese XML-Version wird nicht unterstützt. Die Version des Ausgabedokuments ist ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Schema ist erforderlich!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "Das an SerializerFactory übermittelte Merkmalobjekt weist kein Merkmal ''{0}'' auf." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Warnung: Die Codierung ''{0}'' wird von Java Runtime nicht unterstützt." }, new Object[] { "FEATURE_NOT_FOUND", "Der Parameter ''{0}'' wird nicht erkannt." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Der Parameter ''{0}'' wird erkannt, der angeforderte Wert kann jedoch nicht festgelegt werden." }, new Object[] { "DOMSTRING_SIZE_ERR", "Die Ergebniszeichenfolge ist zu lang für eine DOM-Zeichenfolge: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Der Werttyp für diesen Parameternamen ist nicht kompatibel mit dem erwarteten Werttyp." }, new Object[] { "no-output-specified", "Das Ausgabeziel für die zu schreibenden Daten war leer." },
|
||||
new Object[] { "unsupported-encoding", "Eine nicht unterstützte Codierung wurde festgestellt." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Der Knoten konnte nicht serialisiert werden." }, new Object[] { "cdata-sections-splitted", "Der Abschnitt CDATA enthält mindestens eine Beendigungsmarkierung ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Eine Instanz des Prüfprogramms für korrekte Formatierung konnte nicht erstellt werden. Für den korrekt formatierten Parameter wurde der Wert 'True' festgelegt, die Prüfung auf korrekte Formatierung kann jedoch nicht durchgeführt werden." }, new Object[] { "wf-invalid-character", "Der Knoten ''{0}'' enthält ungültige XML-Zeichen." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "Im Kommentar wurde ein ungültiges XML-Zeichen (Unicode: 0x{0}) gefunden." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "In der Verarbeitungsanweisung wurde ein ungültiges XML-Zeichen (Unicode: 0x{0}) gefunden." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "Im Inhalt von CDATASection wurde ein ungültiges XML-Zeichen (Unicode: 0x{0}) gefunden." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "Ein ungültiges XML-Zeichen (Unicode: 0x{0}) wurde im Inhalt der Zeichendaten des Knotens gefunden." }, new Object[] { "wf-invalid-character-in-node-name", "Ungültige XML-Zeichen wurden gefunden in {0} im Knoten ''{1}''." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "Die Zeichenfolge \"--\" ist innerhalb von Kommentaren nicht zulässig." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "Der Wert des Attributs \"{1}\" mit einem Elementtyp \"{0}\" darf nicht das Zeichen ''<'' enthalten." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Der syntaktisch nicht analysierte Entitätenverweis \"&{0};\" ist nicht zulässig." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Der externe Entitätenverweis \"&{0};\" ist in einem Attributwert nicht zulässig." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Das Präfix \"{0}\" kann nicht an den Namensbereich \"{1}\" gebunden werden." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Der lokale Name von Element \"{0}\" ist nicht angegeben." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Der lokale Name des Attributs \"{0}\" ist nicht angegeben." }, new Object[] { "unbound-prefix-in-entity-reference", "Der Ersatztext des Entitätenknotens \"{0}\" enthält einen Elementknoten \"{1}\" mit einem nicht gebundenen Präfix \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "Der Ersatztext des Entitätenknotens \"{0}\" enthält einen Attributknoten \"{1}\" mit einem nicht gebundenen Präfix \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
public final class SerializerMessages_en extends SerializerMessages {}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_es extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "La clave de mensaje ''{0}'' no está en la clase de mensaje ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Se ha producido un error en el formato de mensaje ''{0}'' de la clase de mensaje ''{1}''." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "La clase serializer ''{0}'' no implementa org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "No se ha podido encontrar el recurso [ {0} ].\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "No se ha podido cargar el recurso [ {0} ]: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Tamaño de almacenamiento intermedio <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "¿Se ha detectado un sustituto UTF-16 no válido: {0}?" }, new Object[] { "ER_OIERROR", "Error de ES" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "No se puede añadir el atributo {0} después de nodos hijo o antes de que se produzca un elemento. Se ignorará el atributo." }, new Object[] { "ER_NAMESPACE_PREFIX", "No se ha declarado el espacio de nombres para el prefijo ''{0}''." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Atributo ''{0}'' fuera del elemento." }, new Object[] { "ER_STRAY_NAMESPACE", "Declaración del espacio de nombres ''{0}''=''{1}'' fuera del elemento." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "No se ha podido cargar ''{0}'' (compruebe la CLASSPATH), ahora sólo se están utilizando los valores predeterminados" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Se ha intentado dar salida a un carácter del valor integral {0} que no está representado en la codificación de salida especificada de {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "No se ha podido cargar el archivo de propiedades ''{0}'' para el método de salida ''{1}'' (compruebe la CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Número de puerto no válido" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "No se puede establecer el puerto si el sistema principal es nulo" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "El sistema principal no es una dirección bien formada" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "El esquema no es compatible." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "No se puede establecer un esquema de una serie nula" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "La vía de acceso contiene una secuencia de escape no válida" }, new Object[] { "ER_PATH_INVALID_CHAR", "La vía de acceso contiene un carácter no válido: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "El fragmento contiene un carácter no válido" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "No se puede establecer el fragmento si la vía de acceso es nula" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Sólo se puede establecer el fragmento para un URI genérico" }, new Object[] { "ER_NO_SCHEME_IN_URI", "No se ha encontrado un esquema en el URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "No se puede inicializar el URI con parámetros vacíos" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "No se puede especificar el fragmento en la vía de acceso y en el fragmento" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "No se puede especificar la serie de consulta en la vía de acceso y en la serie de consulta" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "No se puede especificar el puerto si no se ha especificado el sistema principal" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "No se puede especificar la información de usuario si no se ha especificado el sistema principal" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Aviso: la versión del documento de salida tiene que ser ''{0}''. No se admite esta versión de XML. La versión del documento de salida será ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "¡Se necesita un esquema!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "El objeto Properties pasado a SerializerFactory no tiene una propiedad ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Aviso: La codificación ''{0}'' no está soportada por Java Runtime." }, new Object[] { "FEATURE_NOT_FOUND", "El parámetro ''{0}'' no se reconoce." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Se reconoce el parámetro ''{0}'' pero no puede establecerse el valor solicitado." }, new Object[] { "DOMSTRING_SIZE_ERR", "La serie producida es demasiado larga para ajustarse a DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "El tipo de valor para este nombre de parámetro es incompatible con el tipo de valor esperado." }, new Object[] { "no-output-specified", "El destino de salida de escritura de los datos es nulo." },
|
||||
new Object[] { "unsupported-encoding", "Se ha encontrado una codificación no soportada." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "No se ha podido serializar el nodo." }, new Object[] { "cdata-sections-splitted", "La sección CDATA contiene uno o más marcadores ']]>' de terminación." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "No se ha podido crear una instancia del comprobador de gramática correcta. El parámetro well-formed se ha establecido en true pero no se puede realizar la comprobación de gramática correcta." }, new Object[] { "wf-invalid-character", "El nodo ''{0}'' contiene caracteres XML no válidos." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "Se ha encontrado un carácter XML no válido (Unicode: 0x{0}) en el comentario." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "Se ha encontrado un carácter XML no válido (Unicode: 0x{0}) en los datos de la instrucción de proceso." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "Se ha encontrado un carácter XML no válido (Unicode: 0x{0}) en el contenido de CDATASection." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "Se ha encontrado un carácter XML no válido (Unicode: 0x{0}) en el contenido de datos de caracteres del nodo." }, new Object[] { "wf-invalid-character-in-node-name", "Se ha encontrado un carácter o caracteres XML no válidos en el nodo {0} denominado ''{1}''." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "No se permite la serie \"--\" dentro de los comentarios." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "El valor del atributo \"{1}\" asociado a un tipo de elemento \"{0}\" no debe contener el carácter ''''<''''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "No se permite la referencia de entidad no analizada \"&{0};\"." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "La referencia de entidad externa \"&{0};\" no está permitida en un valor de atributo." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "No se puede encontrar el prefijo \"{0}\" en el espacio de nombres \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "El nombre local del elemento \"{0}\" es null." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "El nombre local del atributo \"{0}\" es null." }, new Object[] { "unbound-prefix-in-entity-reference", "El texto de sustitución del nodo de entidad \"{0}\" contiene un nodo de elemento \"{1}\" con un prefijo no enlazado \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "El texto de sustitución del nodo de entidad \"{0}\" contiene un nodo de atributo \"{1}\" con un prefijo no enlazado \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_fr extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "La clé du message ''{0}'' ne se trouve pas dans la classe du message ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Le format du message ''{0}'' de la classe du message ''{1}'' est incorrect." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "La classe de la méthode de sérialisation ''{0}'' n''implémente pas org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "La ressource [ {0} ] est introuvable.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "La ressource [ {0} ] n''a pas pu charger : {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Taille du tampon <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Substitut UTF-16 non valide détecté : {0} ?" }, new Object[] { "ER_OIERROR", "Erreur d'E-S" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Ajout impossible de l''attribut {0} après des noeuds enfants ou avant la production d''un élément. L''attribut est ignoré." }, new Object[] { "ER_NAMESPACE_PREFIX", "L''espace de noms du préfixe ''{0}'' n''a pas été déclaré." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "L''attribut ''{0}'' est à l''extérieur de l''élément." }, new Object[] { "ER_STRAY_NAMESPACE", "La déclaration d''espace de noms ''{0}''=''{1}'' est à l''extérieur de l''élément." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Impossible de charger ''{0}'' (vérifier CLASSPATH), les valeurs par défaut sont donc employées" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Tentative de sortie d''un caractère de la valeur entière {0} non représentée dans l''encodage de sortie de {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Impossible de charger le fichier de propriétés ''{0}'' pour la méthode de sortie ''{1}'' (vérifier CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Numéro de port non valide" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Le port ne peut être défini quand l'hôte est vide" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "L'hôte n'est pas une adresse bien formée" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Le processus n'est pas conforme." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Impossible de définir le processus à partir de la chaîne vide" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Le chemin d'accès contient une séquence d'échappement non valide" }, new Object[] { "ER_PATH_INVALID_CHAR", "Le chemin contient un caractère non valide : {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Le fragment contient un caractère non valide" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Le fragment ne peut être défini quand le chemin d'accès est vide" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Le fragment ne peut être défini que pour un URI générique" }, new Object[] { "ER_NO_SCHEME_IN_URI", "Processus introuvable dans l'URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Impossible d'initialiser l'URI avec des paramètres vides" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Le fragment ne doit pas être indiqué à la fois dans le chemin et dans le fragment" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "La chaîne de requête ne doit pas figurer dans un chemin et une chaîne de requête" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Le port peut ne pas être spécifié si l'hôte n'est pas spécifié" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Userinfo ne peut être spécifié si l'hôte ne l'est pas" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Avertissement : La version du document de sortie doit être ''{0}''. Cette version XML n''est pas prise en charge. La version du document de sortie sera ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Processus requis !" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "L''objet Properties transmis à SerializerFactory ne dispose pas de propriété ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Avertissement : Le codage ''{0}'' n''est pas pris en charge par l''environnement d''exécution Java." }, new Object[] { "FEATURE_NOT_FOUND", "Le paramètre ''{0}'' n''est pas reconnu." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Le paramètre ''{0}'' est reconnu mas la valeur demandée ne peut pas être définie." }, new Object[] { "DOMSTRING_SIZE_ERR", "La chaîne obtenue est trop longue pour un DOMString : ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Le type de valeur de ce paramètre est incompatible avec le type de valeur attendu." }, new Object[] { "no-output-specified", "La sortie de destination des données à écrire était vide." },
|
||||
new Object[] { "unsupported-encoding", "Codage non pris en charge." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Le noeud ne peut pas être sérialisé." }, new Object[] { "cdata-sections-splitted", "La section CDATA contient un ou plusieurs marqueurs de fin ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Aucune instance du programme de vérification de la formation n'a pu être créée. La valeur true a été attribuée au paramètre well-formed mais la vérification de la formation n'a pas pu être effectuée." }, new Object[] { "wf-invalid-character", "Le noeud ''{0}'' contient des caractères XML non valides." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "Un caractère XML non valide (Unicode : 0x{0}) a été trouvé dans le commentaire." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "Un caractère XML non valide (Unicode : 0x{0}) a été trouvé dans les données de l''instruction de traitement." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "Un caractère XML non valide (Unicode: 0x{0}) a été trouvé dans le contenu de la CDATASection" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "Un caractère XML non valide (Unicode : 0x{0}) a été trouvé dans le contenu des données de type caractères du noeud." }, new Object[] { "wf-invalid-character-in-node-name", "Un ou plusieurs caractères non valides ont été trouvés dans le noeud {0} nommé ''{1}''." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "La chaîne \"--\" est interdite dans des commentaires." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "La valeur de l''attribut \"{1}\" associé à un type d''élément \"{0}\" ne doit pas contenir le caractère ''<''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "La référence d''entité non analysée \"&{0};\" n''est pas admise." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "La référence d''entité externe \"&{0};\" n''est pas admise dans une valeur d''attribut." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Le préfixe \"{0}\" ne peut pas être lié à l''espace de noms \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Le nom local de l''élément \"{0}\" a une valeur null." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Le nom local de l''attribut \"{0}\" a une valeur null." }, new Object[] { "unbound-prefix-in-entity-reference", "le texte de remplacement du noeud de l''entité \"{0}\" contaient un noeud d''élément \"{1}\" avec un préfixe non lié \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "Le texte de remplacement du noeud de l''entité \"{0}\" contient un noeud d''attribut \"{1}\" avec un préfixe non lié \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_hu extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "A(z) ''{0}'' üzenetkulcs nem található a(z) ''{1}'' üzenetosztályban." }, new Object[] { "BAD_MSGFORMAT", "A(z) ''{1}'' üzenetosztály ''{0}'' üzenetének formátuma hibás." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "A(z) ''{0}'' példányosító osztály nem valósítja meg az org.xml.sax.ContentHandler függvényt." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "A(z) [ {0} ] erőforrás nem található.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "A(z) [ {0} ] erőforrást nem lehet betölteni: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Pufferméret <= 0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Érvénytelen UTF-16 helyettesítés: {0} ?" }, new Object[] { "ER_OIERROR", "IO hiba" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Nem lehet {0} attribútumot hozzáadni utód csomópontok után vagy egy elem előállítása előtt. Az attribútum figyelmen kívül marad." }, new Object[] { "ER_NAMESPACE_PREFIX", "A(z) ''{0}'' előtag névtere nincs deklarálva." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "A(z) ''{0}'' attribútum kívül esik az elemen." }, new Object[] { "ER_STRAY_NAMESPACE", "A(z) ''{0}''=''{1}'' névtérdeklaráció kívül esik az elemen." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Nem lehet betölteni ''{0}'' erőforrást (ellenőrizze a CLASSPATH beállítást), a rendszer az alapértelmezéseket használja." }, new Object[] { "ER_ILLEGAL_CHARACTER", "Kísérletet tett {0} értékének karakteres kiírására, de nem jeleníthető meg a megadott {1} kimeneti kódolással." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Nem lehet betölteni a(z) ''{0}'' tulajdonságfájlt a(z) ''{1}'' metódushoz (ellenőrizze a CLASSPATH beállítást)" }, new Object[] { "ER_INVALID_PORT", "Érvénytelen portszám" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "A portot nem állíthatja be, ha a hoszt null" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "A hoszt nem jól formázott cím" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "A séma nem megfelelő." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Nem lehet beállítani a sémát null karaktersorozatból" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Az elérési út érvénytelen vezérlő jelsorozatot tartalmaz" }, new Object[] { "ER_PATH_INVALID_CHAR", "Az elérési út érvénytelen karaktert tartalmaz: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "A töredék érvénytelen karaktert tartalmaz" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "A töredéket nem állíthatja be, ha az elérési út null" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Csak általános URI-hoz állíthat be töredéket" }, new Object[] { "ER_NO_SCHEME_IN_URI", "Nem található séma az URI-ban" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Az URI nem inicializálható üres paraméterekkel" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Nem adhat meg töredéket az elérési útban és a töredékben is" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Nem adhat meg lekérdezési karaktersorozatot az elérési útban és a lekérdezési karaktersorozatban" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Nem adhatja meg a portot, ha nincs megadva hoszt" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Nem adhatja meg a felhasználói információkat, ha nincs megadva hoszt" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Figyelmeztetés: A kimeneti dokumentum kért verziója ''{0}''. Az XML ezen verziója nem támogatott. A kimeneti dokumentum verziója ''1.0'' lesz." }, new Object[] { "ER_SCHEME_REQUIRED", "Sémára van szükség!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "A SerializerFactory osztálynak átadott Properties objektumnak nincs ''{0}'' tulajdonsága." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Figyelmeztetés: A(z) ''{0}'' kódolást nem támogatja a Java futási környezet." }, new Object[] { "FEATURE_NOT_FOUND", "A(z) ''{0}'' paraméter nem ismerhető fel." }, new Object[] { "FEATURE_NOT_SUPPORTED", "A(z) ''{0}'' paraméter ismert, de a kért érték nem állítható be." }, new Object[] { "DOMSTRING_SIZE_ERR", "A létrejövő karaktersorozat túl hosszú, nem fér el egy DOMString-ben: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "A paraméternév értékének típusa nem kompatibilis a várt típussal." }, new Object[] { "no-output-specified", "Az adatkiírás céljaként megadott érték üres volt." },
|
||||
new Object[] { "unsupported-encoding", "Nem támogatott kódolás." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "A csomópont nem példányosítható." }, new Object[] { "cdata-sections-splitted", "A CDATA szakasz legalább egy ']]>' lezáró jelzőt tartalmaz." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "A szabályos formázást ellenőrző példányt nem sikerült létrehozni. A well-formed paraméter értéke true, de a szabályos formázást nem lehet ellenőrizni." }, new Object[] { "wf-invalid-character", "A(z) ''{0}'' csomópont érvénytelen XML karaktereket tartalmaz." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "Érvénytelen XML karakter (Unicode: 0x{0}) szerepelt a megjegyzésben." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "Érvénytelen XML karakter (Unicode: 0x{0}) szerepelt a feldolgozási utasításadatokban." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "Érvénytelen XML karakter (Unicode: 0x{0}) szerepelt a CDATASection tartalmában." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "Érvénytelen XML karakter (Unicode: 0x{0}) szerepelt a csomópont karakteradat tartalmában." }, new Object[] { "wf-invalid-character-in-node-name", "Érvénytelen XML karakter található a(z) ''{1}'' nevű {0} csomópontban." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "A \"--\" karaktersorozat nem megengedett a megjegyzésekben." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "A(z) \"{0}\" elemtípussal társított \"{1}\" attribútum értéke nem tartalmazhat ''<'' karaktert." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Az értelmezés nélküli \"&{0};\" entitáshivatkozás nem megengedett." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "A(z) \"&{0};\" külső entitáshivatkozás nem megengedett egy attribútumértékben." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "A(z) \"{0}\" előtag nem köthető a(z) \"{1}\" névtérhez." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "A(z) \"{0}\" elem helyi neve null." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "A(z) \"{0}\" attribútum helyi neve null." }, new Object[] { "unbound-prefix-in-entity-reference", "A(z) \"{0}\" entitáscsomópont helyettesítő szövege a(z) \"{1}\" elemcsomópontot tartalmazza, amelynek nem kötött előtagja \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "A(z) \"{0}\" entitáscsomópont helyettesítő szövege a(z) \"{1}\" attribútum-csomópontot tartalmazza, amelynek nem kötött előtagja \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_it extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "La chiave messaggio ''{0}'' non si trova nella classe del messaggio ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Il formato del messaggio ''{0}'' nella classe del messaggio ''{1}'' non è riuscito." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "La classe del serializzatore ''{0}'' non implementa org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Risorsa [ {0} ] non trovata.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Impossibile caricare la risorsa [ {0} ]: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Dimensione buffer <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Rilevato surrogato UTF-16 non valido: {0} ?" }, new Object[] { "ER_OIERROR", "Errore IO" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Impossibile aggiungere l''''attributo {0} dopo i nodi secondari o prima che sia prodotto un elemento. L''''attributo verrà ignorato." }, new Object[] { "ER_NAMESPACE_PREFIX", "Lo spazio nomi per il prefisso ''{0}'' non è stato dichiarato." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "L''''attributo ''{0}'' al di fuori dell''''elemento." }, new Object[] { "ER_STRAY_NAMESPACE", "Dichiarazione dello spazio nome ''{0}''=''{1}'' al di fuori dell''''elemento." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Impossibile caricare ''{0}'' (verificare CLASSPATH), verranno utilizzati i valori predefiniti" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Tentare di generare l''''output del carattere di valor integrale {0} che non è rappresentato nella codifica di output specificata di {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Impossibile caricare il file delle proprietà ''{0}'' per il metodo di emissione ''{1}'' (verificare CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Numero di porta non valido" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "La porta non può essere impostata se l'host è nullo" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Host non è un'indirizzo corretto" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Lo schema non è conforme." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Impossibile impostare lo schema da una stringa nulla" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Il percorso contiene sequenza di escape non valida" }, new Object[] { "ER_PATH_INVALID_CHAR", "Il percorso contiene un carattere non valido: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Il frammento contiene un carattere non valido" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Il frammento non può essere impostato se il percorso è nullo" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Il frammento può essere impostato solo per un URI generico" }, new Object[] { "ER_NO_SCHEME_IN_URI", "Non è stato trovato alcuno schema nell'URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Impossibile inizializzare l'URI con i parametri vuoti" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Il frammento non può essere specificato sia nel percorso che nel frammento" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "La stringa di interrogazione non può essere specificata nella stringa di interrogazione e percorso." }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "La porta non può essere specificata se l'host non S specificato" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Userinfo non può essere specificato se l'host non S specificato" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Attenzione: La versione del documento di emissione è obbligatorio che sia ''{0}''. Questa versione di XML non è supportata. La versione del documento di emissione sarà ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Lo schema è obbligatorio." }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "L''''oggetto Properties passato al SerializerFactory non ha una proprietà ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Avvertenza: La codifica ''{0}'' non è supportata da Java runtime." }, new Object[] { "FEATURE_NOT_FOUND", "Il parametro ''{0}'' non è riconosciuto." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Il parametro ''{0}'' è riconosciuto ma non è possibile impostare il valore richiesto." }, new Object[] { "DOMSTRING_SIZE_ERR", "La stringa risultante è troppo lunga per essere inserita in DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Il tipo di valore per questo nome di parametro non è compatibile con il tipo di valore previsto." }, new Object[] { "no-output-specified", "La destinazione di output in cui scrivere i dati era nulla." },
|
||||
new Object[] { "unsupported-encoding", "È stata rilevata una codifica non supportata." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Impossibile serializzare il nodo." }, new Object[] { "cdata-sections-splitted", "La Sezione CDATA contiene uno o più markers di termine ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Impossibile creare un'istanza del controllore Well-Formedness. Il parametro well-formed è stato impostato su true ma non è possibile eseguire i controlli well-formedness." }, new Object[] { "wf-invalid-character", "Il nodo ''{0}'' contiene caratteri XML non validi." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "Trovato un carattere XML non valido (Unicode: 0x{0}) nel commento." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "Carattere XML non valido (Unicode: 0x{0}) rilevato nell''elaborazione di instructiondata." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "Carattere XML non valido (Unicode: 0x{0}) rilevato nel contenuto di CDATASection." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "Carattere XML non valido (Unicode: 0x{0}) rilevato nel contenuto dati di caratteri del nodo. " }, new Object[] { "wf-invalid-character-in-node-name", "Carattere XML non valido rilevato nel nodo {0} denominato ''{1}''." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "La stringa \"--\" non è consentita nei commenti." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "Il valore dell''''attributo \"{1}\" associato con un tipo di elemento \"{0}\" non deve contenere il carattere ''<''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Il riferimento entità non analizzata \"&{0};\" non è permesso." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Il riferimento all''''entità esterna \"&{0};\" non è permesso in un valore attributo." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Il prefisso \"{0}\" non può essere associato allo spazio nome \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Il nome locale dell''''elemento \"{0}\" è null." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Il nome locale dell''''attributo \"{0}\" è null." }, new Object[] { "unbound-prefix-in-entity-reference", "Il testo di sostituzione del nodo di entità \"{0}\" contiene un nodo di elemento \"{1}\" con un prefisso non associato \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "Il testo di sostituzione del nodo di entità \"{0}\" contiene un nodo di attributo \"{1}\" con un prefisso non associato \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_ja extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "メッセージ・キー ''{0}'' はメッセージ・クラス ''{1}'' にありません。" }, new Object[] { "BAD_MSGFORMAT", "メッセージ・クラス ''{1}'' のメッセージ ''{0}'' のフォーマット設定が失敗しました。" }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "シリアライザー・クラス ''{0}'' は org.xml.sax.ContentHandler を実装しません。" }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "リソース [ {0} ] は見つかりませんでした。\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "リソース [ {0} ] をロードできませんでした: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "バッファー・サイズ <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "無効な UTF-16 サロゲートが検出されました: {0} ?" }, new Object[] { "ER_OIERROR", "入出力エラー" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "下位ノードの後または要素が生成される前に属性 {0} は追加できません。 属性は無視されます。" }, new Object[] { "ER_NAMESPACE_PREFIX", "接頭部 ''{0}'' の名前空間が宣言されていません。" },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "属性 ''{0}'' が要素の外側です。" }, new Object[] { "ER_STRAY_NAMESPACE", "名前空間宣言 ''{0}''=''{1}'' が要素の外側です。" }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "''{0}'' をロードできませんでした (CLASSPATH を確認してください)。現在はデフォルトのもののみを使用しています。" }, new Object[] { "ER_ILLEGAL_CHARACTER", "{1} の指定された出力エンコードで表せない整数値 {0} の文字の出力を試みました。" }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "出力メソッド ''{1}'' のプロパティー・ファイル ''{0}'' をロードできませんでした (CLASSPATH を確認してください)" }, new Object[] { "ER_INVALID_PORT", "無効なポート番号" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "ホストがヌルであるとポートを設定できません" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "ホストはうまく構成されたアドレスでありません" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "スキームは一致していません。" }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "ヌル・ストリングからはスキームを設定できません" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "パスに無効なエスケープ・シーケンスが含まれています" }, new Object[] { "ER_PATH_INVALID_CHAR", "パスに無効文字: {0} が含まれています" }, new Object[] { "ER_FRAG_INVALID_CHAR", "フラグメントに無効文字が含まれています" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "パスがヌルであるとフラグメントを設定できません" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "総称 URI のフラグメントしか設定できません" }, new Object[] { "ER_NO_SCHEME_IN_URI", "スキームは URI で見つかりません" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "URI は空のパラメーターを使用して初期化できません" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "フラグメントはパスとフラグメントの両方に指定できません" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "照会ストリングはパスおよび照会ストリング内に指定できません" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "ホストが指定されていない場合はポートを指定してはいけません" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "ホストが指定されていない場合は Userinfo を指定してはいけません" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "警告: 出力文書のバージョンとして ''{0}'' が要求されました。 このバージョンの XML はサポートされません。 出力文書のバージョンは ''1.0'' になります。" }, new Object[] { "ER_SCHEME_REQUIRED", "スキームが必要です。" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "SerializerFactory に渡された Properties オブジェクトには ''{0}'' プロパティーがありません。" }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "警告: エンコード ''{0}'' はこの Java ランタイムではサポートされていません。" }, new Object[] { "FEATURE_NOT_FOUND", "パラメーター ''{0}'' は認識されません。" }, new Object[] { "FEATURE_NOT_SUPPORTED", "パラメーター ''{0}'' は認識されますが、要求された値は設定できません。" }, new Object[] { "DOMSTRING_SIZE_ERR", "結果のストリングが長すぎるため、DOMString 内に収まりません: ''{0}''。" }, new Object[] { "TYPE_MISMATCH_ERR", "このパラメーター名の値の型は、期待される値の型と不適合です。" }, new Object[] { "no-output-specified", "書き込まれるデータの出力宛先がヌルです。" },
|
||||
new Object[] { "unsupported-encoding", "サポートされないエンコードが検出されました。" }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "ノードを直列化できませんでした。" }, new Object[] { "cdata-sections-splitted", "CDATA セクションに 1 つ以上の終了マーカー ']]>' が含まれています。" }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "整形式性チェッカーのインスタンスを作成できませんでした。 well-formed パラメーターの設定は true でしたが、整形式性の検査は実行できません。" }, new Object[] { "wf-invalid-character", "ノード ''{0}'' に無効な XML 文字があります。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "コメントの中に無効な XML 文字 (Unicode: 0x{0}) が見つかりました。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "処理命令データの中に無効な XML 文字 (Unicode: 0x{0}) が見つかりました。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "CDATA セクションの中に無効な XML 文字 (Unicode: 0x{0}) が見つかりました。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "ノードの文字データの内容に無効な XML 文字 (Unicode: 0x{0}) が見つかりました。" }, new Object[] { "wf-invalid-character-in-node-name", "''{1}'' という名前の {0} ノードの中に無効な XML 文字が見つかりました。" },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "ストリング \"--\" はコメント内では使用できません。" }, new Object[] { "ER_WF_LT_IN_ATTVAL", "要素型 \"{0}\" に関連した属性 \"{1}\" の値には ''<'' 文字を含めてはいけません。" }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "解析対象外実体参照 \"&{0};\" は許可されません。" }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "属性値での外部実体参照 \"&{0};\" は許可されません。" }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "接頭部 \"{0}\" は名前空間 \"{1}\" に結合できません。" }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "要素 \"{0}\" のローカル名がヌルです。" }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "属性 \"{0}\" のローカル名がヌルです。" }, new Object[] { "unbound-prefix-in-entity-reference", "実体ノード \"{0}\" の置換テキストに、未結合の接頭部 \"{2}\" を持つ要素ノード \"{1}\" が含まれています。" }, new Object[] { "unbound-prefix-in-entity-reference", "実体ノード \"{0}\" の置換テキストに、未結合の接頭部 \"{2}\" を持つ属性ノード \"{1}\" が含まれています。" } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_ko extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "''{0}'' 메시지 키가 ''{1}'' 메시지 클래스에 없습니다." }, new Object[] { "BAD_MSGFORMAT", "''{1}'' 메시지 클래스에 있는 ''{0}'' 메시지의 형식이 잘못 되었습니다." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "''{0}'' 직렬 프로그램 클래스가 org.xml.sax.ContentHandler를 구현하지 않습니다." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "[ {0} ] 자원을 찾을 수 없습니다.\n{1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "[ {0} ] 자원이 {1} \n {2} \t {3}을(를) 로드할 수 없습니다." }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "버퍼 크기 <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "잘못된 UTF-16 대리자(surrogate)가 발견되었습니다: {0} ?" }, new Object[] { "ER_OIERROR", "IO 오류" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "하위 노드가 생성된 이후 또는 요소가 작성되기 이전에 {0} 속성을 추가할 수 없습니다. 속성이 무시됩니다." }, new Object[] { "ER_NAMESPACE_PREFIX", "''{0}'' 접두부에 대한 이름 공간이 선언되지 않았습니다." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "''{0}'' 속성이 요소의 외부에 있습니다." }, new Object[] { "ER_STRAY_NAMESPACE", "''{0}''=''{1}'' 이름 공간 선언이 요소의 외부에 있습니다." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "''{0}''(CLASSPATH 확인)을(를) 로드할 수 없으므로, 현재 기본값만을 사용하는 중입니다." }, new Object[] { "ER_ILLEGAL_CHARACTER", "{1}의 지정된 출력 인코딩에 표시되지 않은 무결성 값 {0}의 문자를 출력하십시오. " }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "''{1}'' 출력 메소드(CLASSPATH 확인)에 대한 ''{0}'' 특성 파일을 로드할 수 없습니다." }, new Object[] { "ER_INVALID_PORT", "잘못된 포트 번호" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "호스트가 널(null)이면 포트를 설정할 수 없습니다." }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "호스트가 완전한 주소가 아닙니다." }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "스키마가 일치하지 않습니다." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "널(null) 문자열에서 스키마를 설정할 수 없습니다." },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "경로에 잘못된 이스케이프 순서가 있습니다." }, new Object[] { "ER_PATH_INVALID_CHAR", "경로에 잘못된 문자가 있습니다: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "단편에 잘못된 문자가 있습니다." }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "경로가 널(null)이면 단편을 설정할 수 없습니다." }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "일반 URI에 대해서만 단편을 설정할 수 있습니다." }, new Object[] { "ER_NO_SCHEME_IN_URI", "URI에 스키마가 없습니다." }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "빈 매개변수로 URI를 초기화할 수 없습니다." }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "경로 및 단편 둘 다에 단편을 지정할 수 없습니다." }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "경로 및 조회 문자열에 조회 문자열을 지정할 수 없습니다." }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "호스트를 지정하지 않은 경우에는 포트를 지정할 수 없습니다." },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "호스트를 지정하지 않은 경우에는 Userinfo를 지정할 수 없습니다." }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "경고: 요청된 출력 문서의 버전은 ''{0}''입니다. 하지만 이 XML 버전은 지원되지 않습니다. 출력 문서의 버전은 ''1.0''이 됩니다." }, new Object[] { "ER_SCHEME_REQUIRED", "스키마가 필요합니다." }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "SerializerFactory에 전달된 특성 오브젝트에 ''{0}'' 특성이 없습니다." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "경고: ''{0}'' 인코딩은 Java Runtime을 지원하지 않습니다." }, new Object[] { "FEATURE_NOT_FOUND", "''{0}'' 매개변수를 인식할 수 없습니다." }, new Object[] { "FEATURE_NOT_SUPPORTED", "''{0}'' 매개변수는 인식할 수 있으나 요청된 값을 설정할 수 없습니다." }, new Object[] { "DOMSTRING_SIZE_ERR", "결과 문자열이 너무 길어 DOMString에 맞지 않습니다: ''{0}'' " }, new Object[] { "TYPE_MISMATCH_ERR", "이 매개변수 이름에 대한 값 유형이 예상 값 유형과 호환되지 않습니다." }, new Object[] { "no-output-specified", "데이터를 기록할 출력 대상이 널(null)입니다." },
|
||||
new Object[] { "unsupported-encoding", "지원되지 않는 인코딩이 발견되었습니다." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "노드를 직렬화할 수 없습니다." }, new Object[] { "cdata-sections-splitted", "CDATA 섹션에 종료 표시 문자인 ']]>'가 하나 이상 포함되어 있습니다." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Well-Formedness 검사기의 인스턴스를 작성할 수 없습니다. Well-Formed 매개변수가 true로 설정되었지만 Well-Formedness 검사를 수행할 수 없습니다." }, new Object[] { "wf-invalid-character", "''{0}'' 노드에 유효하지 않은 XML 문자가 있습니다." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "설명에 유효하지 않은 XML 문자(Unicode: 0x{0})가 있습니다. " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "처리 명령어 데이터에 유효하지 않은 XML 문자(Unicode: 0x{0})가 있습니다 " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "CDATASection의 내용에 유효하지 않은 XML 문자(Unicode: 0x{0})가 있습니다. " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "노드의 문자 데이터 내용에 유효하지 않은 XML 문자(Unicode: 0x{0})가 있습니다. " }, new Object[] { "wf-invalid-character-in-node-name", "이름이 ''{1}''인 {0} 노드에 유효하지 않은 XML 문자가 있습니다. " },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "설명 내에서는 \"--\" 문자열이 허용되지 않습니다." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "\"{0}\" 요소 유형과 연관된 \"{1}\" 속성값에 ''<'' 문자가 포함되면 안됩니다." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "\"&{0};\"의 구분 분석되지 않은 엔티티 참조는 허용되지 않습니다. " }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "속성값에는 \"&{0};\" 외부 엔티티 참조가 허용되지 않습니다. " }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "\"{0}\" 접두부를 \"{1}\" 이름 공간에 바인드할 수 없습니다." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "\"{0}\" 요소의 로컬 이름이 널(null)입니다." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "\"{0}\" 속성의 로컬 이름이 널(null)입니다." }, new Object[] { "unbound-prefix-in-entity-reference", "\"{0}\" 엔티티 노드의 대체 텍스트에 바인드되지 않은 접두부 \"{2}\"을(를) 갖는 \"{1}\" 요소 노드가 있습니다." }, new Object[] { "unbound-prefix-in-entity-reference", "\"{0}\" 엔티티 노드의 대체 텍스트에 바인드되지 않은 접두부 \"{2}\"을(를) 갖는 \"{1}\" 속성 노드가 있습니다." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_pl extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "Klucz komunikatu ''{0}'' nie znajduje się w klasie komunikatów ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Nie powiodło się sformatowanie komunikatu ''{0}'' w klasie komunikatów ''{1}''." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "Klasa szeregująca ''{0}'' nie implementuje org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Nie można znaleźć zasobu [ {0} ].\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Zasób [ {0} ] nie mógł załadować: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Wielkość buforu <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Wykryto niepoprawny odpowiednik UTF-16: {0} ?" }, new Object[] { "ER_OIERROR", "Błąd we/wy" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Nie można dodać atrybutu {0} po bezpośrednich węzłach potomnych ani przed wyprodukowaniem elementu. Atrybut zostanie zignorowany." }, new Object[] { "ER_NAMESPACE_PREFIX", "Nie zadeklarowano przestrzeni nazw dla przedrostka ''{0}''." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Atrybut ''{0}'' znajduje się poza elementem." }, new Object[] { "ER_STRAY_NAMESPACE", "Deklaracja przestrzeni nazw ''{0}''=''{1}'' znajduje się poza elementem." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Nie można załadować ''{0}'' (sprawdź CLASSPATH) - używane są teraz wartości domyślne" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Próba wyprowadzenia znaku wartości całkowitej {0}, który nie jest reprezentowany w podanym kodowaniu wyjściowym {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Nie można załadować pliku właściwości ''{0}'' dla metody wyjściowej ''{1}'' (sprawdź CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Niepoprawny numer portu" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Nie można ustawić portu, kiedy host jest pusty" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Host nie jest poprawnie skonstruowanym adresem" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Schemat nie jest zgodny." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Nie można ustawić schematu z pustego ciągu znaków" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Ścieżka zawiera nieznaną sekwencję o zmienionym znaczeniu" }, new Object[] { "ER_PATH_INVALID_CHAR", "Ścieżka zawiera niepoprawny znak {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Fragment zawiera niepoprawny znak" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Nie można ustawić fragmentu, kiedy ścieżka jest pusta" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Fragment można ustawić tylko dla ogólnego URI" }, new Object[] { "ER_NO_SCHEME_IN_URI", "Nie znaleziono schematu w URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Nie można zainicjować URI z pustymi parametrami" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Nie można podać fragmentu jednocześnie w ścieżce i fragmencie" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Tekstu zapytania nie można podać w tekście ścieżki i zapytania" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Nie można podać portu, jeśli nie podano hosta" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Nie można podać informacji o użytkowniku, jeśli nie podano hosta" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Ostrzeżenie: Wymaganą wersją dokumentu wyjściowego jest ''{0}''. Ta wersja XML nie jest obsługiwana. Wersją dokumentu wyjściowego będzie ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Schemat jest wymagany!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "Obiekt klasy Properties przekazany do klasy SerializerFactory nie ma właściwości ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Ostrzeżenie: dekodowany ''{0}'' nie jest obsługiwany przez środowisko wykonawcze Java." }, new Object[] { "FEATURE_NOT_FOUND", "Parametr ''{0}'' nie został rozpoznany." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Parametr ''{0}'' został rozpoznany, ale nie można ustawić żądanej wartości." }, new Object[] { "DOMSTRING_SIZE_ERR", "Wynikowy łańcuch jest zbyt długi, aby się zmieścić w obiekcie DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Typ wartości parametru o tej nazwie jest niezgodny z oczekiwanym typem wartości. " }, new Object[] { "no-output-specified", "Docelowe miejsce zapisu danych wyjściowych było puste (null)." },
|
||||
new Object[] { "unsupported-encoding", "Napotkano nieobsługiwane kodowanie." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Nie można przekształcić węzła do postaci szeregowej." }, new Object[] { "cdata-sections-splitted", "Sekcja CDATA zawiera jeden lub kilka znaczników zakończenia ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Nie można utworzyć instancji obiektu sprawdzającego Well-Formedness. Parametr well-formed ustawiono na wartość true, ale nie można było dokonać sprawdzenia poprawności konstrukcji." }, new Object[] { "wf-invalid-character", "Węzeł ''{0}'' zawiera niepoprawne znaki XML." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "W komentarzu znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "W danych instrukcji przetwarzania znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "W sekcji CDATA znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "W treści danych znakowych węzła znaleziono niepoprawny znak XML (Unicode: 0x{0})." }, new Object[] { "wf-invalid-character-in-node-name", "W {0} o nazwie ''{1}'' znaleziono niepoprawne znaki XML." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "Ciąg znaków \"--\" jest niedozwolony w komentarzu." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "Wartość atrybutu \"{1}\" związanego z typem elementu \"{0}\" nie może zawierać znaku ''<''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Odwołanie do encji nieprzetwarzanej \"&{0};\" jest niedozwolone." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Odwołanie do zewnętrznej encji \"&{0};\" jest niedozwolone w wartości atrybutu." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Nie można związać przedrostka \"{0}\" z przestrzenią nazw \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Nazwa lokalna elementu \"{0}\" jest pusta (null)." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Nazwa lokalna atrybutu \"{0}\" jest pusta (null)." }, new Object[] { "unbound-prefix-in-entity-reference", "Tekst zastępujący węzła encji \"{0}\" zawiera węzeł elementu \"{1}\" o niezwiązanym przedrostku \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "Tekst zastępujący węzła encji \"{0}\" zawiera węzeł atrybutu \"{1}\" o niezwiązanym przedrostku \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_pt_BR extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "A chave de mensagem ''{0}'' não está na classe de mensagem ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "O formato da mensagem ''{0}'' na classe de mensagem ''{1}'' falhou." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "A classe de serializador ''{0}'' não implementa org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "O recurso [ {0} ] não pôde ser encontrado.\n{1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "O recurso [ {0} ] não pôde carregar: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Tamanho do buffer <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Detectado substituto UTF-16 inválido: {0} ?" }, new Object[] { "ER_OIERROR", "Erro de E/S" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Impossível incluir atributo {0} depois de nós filhos ou antes da geração de um elemento. O atributo será ignorado." }, new Object[] { "ER_NAMESPACE_PREFIX", "O espaço de nomes do prefixo ''{0}'' não foi declarado. " },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Atributo ''{0}'' fora do elemento. " }, new Object[] { "ER_STRAY_NAMESPACE", "Declaração de espaço de nomes ''{0}''=''{1}'' fora do elemento. " }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Não foi possível carregar ''{0}'' (verifique CLASSPATH) agora , utilizando somente os padrões" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Tentativa de processar o caractere de um valor integral {0} que não é representado na codificação de saída especificada de {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Não foi possível carregar o arquivo de propriedade ''{0}'' para o método de saída ''{1}'' (verifique CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Número de porta inválido" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "A porta não pode ser definida quando o host é nulo" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "O host não é um endereço formado corretamente" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "O esquema não está em conformidade." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Impossível definir esquema a partir da cadeia nula" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "O caminho contém seqüência de escape inválida" }, new Object[] { "ER_PATH_INVALID_CHAR", "O caminho contém caractere inválido: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "O fragmento contém caractere inválido" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "O fragmento não pode ser definido quando o caminho é nulo" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "O fragmento só pode ser definido para um URI genérico" }, new Object[] { "ER_NO_SCHEME_IN_URI", "Nenhum esquema encontrado no URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Impossível inicializar URI com parâmetros vazios" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "O fragmento não pode ser especificado no caminho e fragmento" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "A cadeia de consulta não pode ser especificada na cadeia de consulta e caminho" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Port não pode ser especificado se host não for especificado" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Userinfo não pode ser especificado se host não for especificado" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Aviso: A versão do documento de saída precisa ser ''{0}''. Essa versão do XML não é suportada. A versão do documento de saída será ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "O esquema é obrigatório!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "O objeto Properties transmitido para SerializerFactory não tem uma propriedade ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Aviso: A codificação ''{0}'' não é suportada pelo Java Runtime." }, new Object[] { "FEATURE_NOT_FOUND", "O parâmetro ''{0}'' não é reconhecido." }, new Object[] { "FEATURE_NOT_SUPPORTED", "O parâmetro ''{0}'' é reconhecido, mas o valor pedido não pode ser definido. " }, new Object[] { "DOMSTRING_SIZE_ERR", "A cadeia resultante é muito longa para caber em uma DOMString: ''{0}''. " }, new Object[] { "TYPE_MISMATCH_ERR", "O tipo de valor para este nome de parâmetro é incompatível com o tipo de valor esperado. " }, new Object[] { "no-output-specified", "O destino de saída para os dados a serem gravados era nulo. " },
|
||||
new Object[] { "unsupported-encoding", "Uma codificação não suportada foi encontrada. " }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "O nó não pôde ser serializado." }, new Object[] { "cdata-sections-splitted", "A Seção CDATA contém um ou mais marcadores de término ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Uma instância do verificador Well-Formedness não pôde ser criada. O parâmetro well-formed foi definido como true, mas a verificação well-formedness não pode ser executada." }, new Object[] { "wf-invalid-character", "O nó ''{0}'' contém caracteres XML inválidos. " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "Um caractere XML inválido (Unicode: 0x{0}) foi encontrado no comentário. " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "Um caractere XML inválido (Unicode: 0x{0}) foi encontrado no processo instructiondata." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "Um caractere XML inválido (Unicode: 0x{0}) foi encontrado nos conteúdos do CDATASection. " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "Um caractere XML inválido (Unicode: 0x{0}) foi encontrado no conteúdo dos dados de caractere dos nós. " }, new Object[] { "wf-invalid-character-in-node-name", "Um caractere inválido foi encontrado no {0} do nó denominado ''{1}''." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "A cadeia \"--\" não é permitida dentro dos comentários. " }, new Object[] { "ER_WF_LT_IN_ATTVAL", "O valor do atributo \"{1}\" associado a um tipo de elemento \"{0}\" não deve conter o caractere ''<''. " }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "A referência de entidade não analisada \"&{0};\" não é permitida. " }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "A referência de entidade externa \"&{0};\" não é permitida em um valor de atributo. " }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "O prefixo \"{0}\" não pode ser vinculado ao espaço de nomes \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "O nome local do elemento \"{0}\" é nulo." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "O nome local do atributo \"{0}\" é nulo." }, new Object[] { "unbound-prefix-in-entity-reference", "O texto de substituição do nó de entidade \"{0}\" contém um nó de elemento \"{1}\" com um prefixo não vinculado \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "O texto de substituição do nó de entidade \"{0}\" contém um nó de atributo \"{1}\" com um prefixo não vinculado \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_ru extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "Ключ сообщения ''{0}'' не относится к классу сообщения ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Формат сообщения ''{0}'' в классе сообщения ''{1}'' вызвал ошибку. " }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "Класс сериализатора ''{0}'' не применяет org.xml.sax.ContentHandler. " }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Ресурс [ {0} ] не найден.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Не удалось загрузить ресурс [ {0} ]: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Размер буфера <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Обнаружено недопустимое значение UTF-16: {0} ?" }, new Object[] { "ER_OIERROR", "Ошибка ввода-вывода" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Атрибут {0} нельзя добавлять после дочерних узлов и до создания элемента. Атрибут будет проигнорирован. " }, new Object[] { "ER_NAMESPACE_PREFIX", "Пространство имен для префикса ''{0}'' не объявлено. " },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Атрибут ''{0}'' вне элемента. " }, new Object[] { "ER_STRAY_NAMESPACE", "Объявление пространства имен ''{0}''=''{1}'' вне элемента. " }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Не удалось загрузить ''{0}'' (проверьте CLASSPATH), применяются значения по умолчанию" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Попытка вывода символа, интегральное значение {0} которого не представлено в указанной кодировке вывода {1}. " }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Невозможно загрузить файл свойств ''{0}'' для метода вывода ''{1}'' (проверьте CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Недопустимый номер порта" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Невозможно задать порт для пустого адреса хоста" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Неправильно сформирован адрес хоста" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Схема не конформативна." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Невозможно задать схему для пустой строки" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "В имени пути встречается недопустимая Esc-последовательность" }, new Object[] { "ER_PATH_INVALID_CHAR", "В имени пути обнаружен недопустимый символ: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Фрагмент содержит недопустимый символ" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Невозможно задать фрагмент для пустого пути" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Фрагмент можно задать только для шаблона URI" }, new Object[] { "ER_NO_SCHEME_IN_URI", "В URI не найдена схема" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Невозможно инициализировать URI с пустыми параметрами" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Невозможно задать фрагмент одновременно для пути и фрагмента" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Нельзя указывать строку запроса в строке пути и запроса" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Нельзя указывать порт, если не задан хост" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Нельзя указывать информацию о пользователе, если не задан хост" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Предупреждение: Необходима версия документа вывода ''{0}''. Эта версия XML не поддерживается. Версией документа вывода будет ''1.0''. " }, new Object[] { "ER_SCHEME_REQUIRED", "Необходима схема!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "Объект свойств, переданный в SerializerFactory, не обладает свойством ''{0}''. " }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Предупреждение: Кодировка ''{0}'' не поддерживается средой выполнения Java." }, new Object[] { "FEATURE_NOT_FOUND", "Параметр ''{0}'' не распознан. " }, new Object[] { "FEATURE_NOT_SUPPORTED", "Параметр ''{0}'' распознан, но запрошенное значение задать не удалось. " }, new Object[] { "DOMSTRING_SIZE_ERR", "Строка результата слишком длинная для размещения в DOMString: ''{0}''. " }, new Object[] { "TYPE_MISMATCH_ERR", "Тип значения для параметра с эти именем несовместим с ожидаемым типом значения. " }, new Object[] { "no-output-specified", "Не указан целевой каталог для вывода данных. " },
|
||||
new Object[] { "unsupported-encoding", "Обнаружена неподдерживаемая кодировка. " }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Невозможно сериализовать узел. " }, new Object[] { "cdata-sections-splitted", "Раздел CDATA содержит один или несколько маркеров разделителей ']]>'. " }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Невозможно создать экземпляр проверки допустимости. Допустимый параметр имеет значение true, но проверку допустимости выполнить не удалось. " }, new Object[] { "wf-invalid-character", "Узел ''{0}'' содержит недопустимые символы XML. " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "В комментарии обнаружен недопустимый символ XML (Юникод: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "При обработке instructiondata был обнаружен недопустимый символ XML (Юникод: 0x{0}). " }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "В содержимом CDATASection обнаружен недопустимый символ XML (Юникод: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "В содержимом символьных данных узла обнаружен недопустимый символ XML (Юникод: 0x{0})." }, new Object[] { "wf-invalid-character-in-node-name", "Недопустимые символы XML обнаружены в узле {0} с именем ''{1}''. " },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "Строка \"--\" недопустима в комментарии. " }, new Object[] { "ER_WF_LT_IN_ATTVAL", "Значение атрибута \"{1}\", связанного с типом элемента \"{0}\", не должно содержать символ ''<''. " }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Необработанная ссылка на элемент \"&{0};\" недопустима. " }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Внешняя ссылка на элемент \"&{0};\" недопустима в значении атрибута. " }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Префикс \"{0}\" не может находиться в пространстве имен \"{1}\". " }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Локальное имя элемента \"{0}\" пусто. " }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Локальное имя атрибута \"{0}\" пусто. " }, new Object[] { "unbound-prefix-in-entity-reference", "Текст замены для узла записи \"{0}\" содержит узел элементов \"{1}\" с несвязанным префиксом \"{2}\". " }, new Object[] { "unbound-prefix-in-entity-reference", "Текст замены для узла записи \"{0}\" содержит узел атрибутов \"{1}\" с несвязанным префиксом \"{2}\". " } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_sk extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "Kľúč správy ''{0}'' sa nenachádza v triede správ ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Zlyhal formát správy ''{0}'' v triede správ ''{1}''." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "Trieda serializátora ''{0}'' neimplementuje org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Prostriedok [ {0} ] nemohol byť nájdený.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Prostriedok [ {0} ] sa nedal načítať: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Veľkosť vyrovnávacej pamäte <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Bolo zistené neplatné nahradenie UTF-16: {0} ?" }, new Object[] { "ER_OIERROR", "chyba IO" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Nie je možné pridať atribút {0} po uzloch potomka alebo pred vytvorením elementu. Atribút bude ignorovaný." }, new Object[] { "ER_NAMESPACE_PREFIX", "Názvový priestor pre predponu ''{0}'' nebol deklarovaný." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Atribút ''{0}'' je mimo prvku." }, new Object[] { "ER_STRAY_NAMESPACE", "Deklarácia názvového priestoru ''{0}''=''{1}'' je mimo prvku." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Nebolo možné zaviesť ''{0}'' (skontrolujte CLASSPATH), teraz sa používajú iba štandardné nastavenia" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Pokus o výstup znaku integrálnej hodnoty {0}, ktorá nie je reprezentovaná v zadanom výstupnom kódovaní {1}." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Nebolo možné zaviesť súbor vlastností ''{0}'' pre výstupnú metódu ''{1}'' (skontrolujte CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Neplatné číslo portu" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Nemôže byť stanovený port, ak je hostiteľ nulový" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Hostiteľ nie je správne formátovaná adresa" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Nezhodná schéma." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Nie je možné stanoviť schému z nulového reťazca" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Cesta obsahuje neplatnú únikovú sekvenciu" }, new Object[] { "ER_PATH_INVALID_CHAR", "Cesta obsahuje neplatný znak: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Fragment obsahuje neplatný znak" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Ak je cesta nulová, nemôže byť stanovený fragment" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Fragment môže byť stanovený len pre všeobecné URI" }, new Object[] { "ER_NO_SCHEME_IN_URI", "V URI nebola nájdená žiadna schéma" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Nie je možné inicializovať URI s prázdnymi parametrami" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Fragment nemôže byť zadaný v ceste, ani vo fragmente" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Reťazec dotazu nemôže byť zadaný v ceste a reťazci dotazu" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Ak nebol zadaný hostiteľ, možno nebol zadaný port" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Ak nebol zadaný hostiteľ, možno nebolo zadané userinfo" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Varovanie: Verzia výstupného dokumentu musí byť povinne ''{0}''. Táto verzia XML nie je podporovaná. Verzia výstupného dokumentu bude ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Je požadovaná schéma!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "Objekt Properties, ktorý prešiel do SerializerFactory, nemá vlastnosť ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Varovanie: Java runtime nepodporuje kódovanie ''{0}''." }, new Object[] { "FEATURE_NOT_FOUND", "Parameter ''{0}'' nebol rozpoznaný." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Parameter ''{0}'' bol rozpoznaný, ale vyžadovaná hodnota sa nedá nastaviť." }, new Object[] { "DOMSTRING_SIZE_ERR", "Výsledný reťazec je príliš dlhý a nezmestí sa do DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Typ hodnoty pre tento názov parametra je nekompatibilný s očakávaným typom hodnoty." }, new Object[] { "no-output-specified", "Cieľ výstupu pre zapísanie údajov bol null." },
|
||||
new Object[] { "unsupported-encoding", "Bolo zaznamenané nepodporované kódovanie." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Uzol nebolo možné serializovať." }, new Object[] { "cdata-sections-splitted", "Časť CDATA obsahuje jeden alebo viaceré označovače konca ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Nebolo možné vytvoriť inštanciu kontrolóra Well-Formedness. Parameter well-formed bol nastavený na hodnotu true, ale kontrola well-formedness sa nedá vykonať." }, new Object[] { "wf-invalid-character", "Uzol ''{0}'' obsahuje neplatné znaky XML." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "V komentári bol nájdený neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "Pri spracovaní dát inštrukcií sa našiel neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "V obsahu CDATASection sa našiel neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "V obsahu znakových dát uzla sa našiel neplatný znak XML (Unicode: 0x{0})." }, new Object[] { "wf-invalid-character-in-node-name", "V uzle {0} s názvom ''{1}'' sa našiel neplatný znak XML." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "Reťazec \"--\" nie je povolený v rámci komentárov." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "Hodnota atribútu \"{1}\", ktorá je priradená k prvku typu \"{0}\", nesmie obsahovať znak ''<''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Neanalyzovaný odkaz na entitu \"&{0};\" nie je povolený." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Odkaz na externú entitu \"&{0};\" nie je povolený v hodnote atribútu." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Predpona \"{0}\" nemôže byť naviazaná na názvový priestor \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Lokálny názov prvku \"{0}\" je null." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Lokálny názov atribútu \"{0}\" je null." }, new Object[] { "unbound-prefix-in-entity-reference", "Náhradný text pre uzol entity \"{0}\" obsahuje uzol prvku \"{1}\" s nenaviazanou predponou \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "Náhradný text uzla entity \"{0}\" obsahuje uzol atribútu \"{1}\" s nenaviazanou predponou \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_sl extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "Ključ sporočila ''{0}'' ni v rezredu sporočila ''{1}''" }, new Object[] { "BAD_MSGFORMAT", "Format sporočila ''{0}'' v razredu sporočila ''{1}'' je spodletel." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "Razred serializerja ''{0}'' ne izvede org.xml.sax.ContentHandler." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Vira [ {0} ] ni mogoče najti.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Sredstva [ {0} ] ni bilo mogoče naložiti: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Velikost medpomnilnika <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "Zaznan neveljaven nadomestek UTF-16: {0} ?" }, new Object[] { "ER_OIERROR", "Napaka V/I" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Atributa {0} ne morem dodati za podrejenimi vozlišči ali pred izdelavo elementa. Atribut bo prezrt." }, new Object[] { "ER_NAMESPACE_PREFIX", "Imenski prostor za predpono ''{0}'' ni bil naveden." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "Atribut ''{0}'' je zunaj elementa." }, new Object[] { "ER_STRAY_NAMESPACE", "Deklaracija imenskega prostora ''{0}''=''{1}'' je zunaj elementa." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "Ni bilo mogoče naložiti ''{0}'' (preverite CLASSPATH), trenutno se uporabljajo samo privzete vrednosti" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Poskus izpisa znaka integralne vrednosti {0}, ki v navedenem izhodnem kodiranju {1} ni zastopan." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "Datoteke z lastnostmi ''{0}'' ni bilo mogoče naložiti za izhodno metodo ''{1}'' (preverite CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "Neveljavna številka vrat" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Ko je gostitelj NULL, nastavitev vrat ni mogoča" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Naslov gostitelja ni pravilno oblikovan" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Shema ni skladna." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Ni mogoče nastaviti sheme iz niza NULL" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Pot vsebuje neveljavno zaporedje za izhod" }, new Object[] { "ER_PATH_INVALID_CHAR", "Pot vsebuje neveljaven znak: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Fragment vsebuje neveljaven znak" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Ko je pot NULL, nastavitev fragmenta ni mogoča" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Fragment je lahko nastavljen samo za splošni URI" }, new Object[] { "ER_NO_SCHEME_IN_URI", "Ne najdem sheme v URI" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Ni mogoče inicializirati URI-ja s praznimi parametri" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Fragment ne more biti hkrati naveden v poti in v fragmentu" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Poizvedbeni niz ne more biti naveden v nizu poti in poizvedbenem nizu" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Vrata ne morejo biti navedena, če ni naveden gostitelj" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Informacije o uporabniku ne morejo biti navedene, če ni naveden gostitelj" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Opozorilo: Zahtevana različica izhodnega dokumenta je ''{0}''. Ta različica XML ni podprta. Različica izhodnega dokumenta bo ''1.0''." }, new Object[] { "ER_SCHEME_REQUIRED", "Zahtevana je shema!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "Predmet Properties (lastnosti), ki je prenešen v SerializerFactory, nima lastnosti ''{0}''." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Opozorilo: Izvajalno okolje Java ne podpira kodiranja ''{0}''." }, new Object[] { "FEATURE_NOT_FOUND", "Parameter ''{0}'' ni prepoznan." }, new Object[] { "FEATURE_NOT_SUPPORTED", "Parameter ''{0}'' je prepoznan, vendar pa zahtevane vrednosti ni mogoče nastaviti." }, new Object[] { "DOMSTRING_SIZE_ERR", "Nastali niz je predolg za DOMString: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Tip vrednosti za to ime parametra je nezdružljiv s pričakovanim tipom vrednosti." }, new Object[] { "no-output-specified", "Izhodno mesto za vpisovanje podatkov je bilo nič." },
|
||||
new Object[] { "unsupported-encoding", "Odkrito je nepodprto kodiranje." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Vozlišča ni mogoče serializirati." }, new Object[] { "cdata-sections-splitted", "Odsek CDATA vsebuje enega ali več označevalnikov prekinitve ']]>'." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Primerka preverjevalnika Well-Formedness ni bilo mogoče ustvariti. Parameter well-formed je bil nastavljen na True, ampak ni mogoče preveriti well-formedness." }, new Object[] { "wf-invalid-character", "Vozlišče ''{0}'' vsebuje neveljavne znake XML." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "V komentarju je bil najden neveljaven XML znak (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "V podatkih navodila za obdelavo je bil najden neveljaven znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "V vsebini odseka CDATASection je bil najden neveljaven znak XML (Unicode: 0x{0})." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "V podatkovni vsebini znaka vozlišča je bil najden neveljaven znak XML (Unicode: 0x{0})." }, new Object[] { "wf-invalid-character-in-node-name", "V vozlišču {0} z imenom ''{1}'' je bil najden neveljaven znak XML." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "Niz \"--\" ni dovoljen v komentarjih." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "Vrednost atributa \"{1}\", ki je povezan s tipom elementa \"{0}\", ne sme vsebovati znaka ''<''." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "Nerazčlenjeni sklic entitete \"&{0};\" ni dovoljen." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Zunanji sklic entitete \"&{0};\" ni dovoljen v vrednosti atributa." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "Predpona \"{0}\" ne more biti povezana z imenskim prostorom \"{1}\"." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "Lokalno ime elementa \"{0}\" je nič." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "Lokalno ime atributa \"{0}\" je nič." }, new Object[] { "unbound-prefix-in-entity-reference", "Besedilo za zamenjavo za vozlišče entitete \"{0}\" vsebuje vozlišče elementa \"{1}\" z nevezano predpono \"{2}\"." }, new Object[] { "unbound-prefix-in-entity-reference", "Besedilo za zamenjavo za vozlišče entitete \"{0}\" vsebuje vozlišče atributa \"{1}\" z nevezano predpono \"{2}\"." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_sv extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "ER_INVALID_PORT", "Ogiltigt portnummer" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Port kan inte sättas när värd är null" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Värd är inte en välformulerad adress" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Schemat är inte likformigt." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Kan inte sätta schema från null-sträng" }, new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Väg innehåller ogiltig flyktsekvens" }, new Object[] { "ER_PATH_INVALID_CHAR", "Väg innehåller ogiltigt tecken: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Fragment innehåller ogiltigt tecken" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Fragment kan inte sättas när väg är null" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Fragment kan bara sättas för en allmän URI" },
|
||||
new Object[] { "ER_NO_SCHEME_IN_URI", "Schema saknas i URI: {0}" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Kan inte initialisera URI med tomma parametrar" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Fragment kan inte anges i både vägen och fragmentet" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Förfrågan-sträng kan inte anges i väg och förfrågan-sträng" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Port får inte anges om värden inte är angiven" }, new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Userinfo får inte anges om värden inte är angiven" }, new Object[] { "ER_SCHEME_REQUIRED", "Schema krävs!" } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_tr extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "''{0}'' ileti anahtarı ''{1}'' ileti sınıfında yok" }, new Object[] { "BAD_MSGFORMAT", "''{1}'' ileti sınıfındaki ''{0}'' iletisinin biçimi başarısız." }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "''{0}'' diziselleştirme sınıfı org.xml.sax.ContentHandler sınıfını gerçekleştirmiyor." }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "Kaynak [ {0} ] bulunamadı.\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "Kaynak [ {0} ] yükleyemedi: {1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "Arabellek büyüklüğü <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "UTF-16 yerine kullanılan değer geçersiz: {0} ?" }, new Object[] { "ER_OIERROR", "GÇ hatası" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "Alt düğümlerden sonra ya da bir öğe üretilmeden önce {0} özniteliği eklenemez. Öznitelik yoksayılacak." }, new Object[] { "ER_NAMESPACE_PREFIX", "''{0}'' önekine ilişkin ad alanı bildirilmedi." },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "''{0}'' özniteliği öğenin dışında." }, new Object[] { "ER_STRAY_NAMESPACE", "''{0}''=''{1}'' ad alanı bildirimi öğenin dışında." }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "''{0}'' yüklenemedi (CLASSPATH değişkeninizi inceleyin), yalnızca varsayılanlar kullanılıyor" }, new Object[] { "ER_ILLEGAL_CHARACTER", "Belirtilen {1} çıkış kodlamasında gösterilmeyen {0} tümlev değeri karakteri çıkış girişimi." }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "''{1}'' çıkış yöntemi için ''{0}'' özellik dosyası yüklenemedi (CLASSPATH değişkenini inceleyin)" }, new Object[] { "ER_INVALID_PORT", "Kapı numarası geçersiz" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "Anasistem boş değerliyken kapı tanımlanamaz" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "Anasistem doğru biçimli bir adres değil" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "Şema uyumlu değil." }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "Boş değerli dizgiden şema tanımlanamaz" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "Yol geçersiz kaçış dizisi içeriyor" }, new Object[] { "ER_PATH_INVALID_CHAR", "Yol geçersiz karakter içeriyor: {0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "Parça geçersiz karakter içeriyor" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "Yol boş değerliyken parça tanımlanamaz" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "Parça yalnızca soysal URI için tanımlanabilir" }, new Object[] { "ER_NO_SCHEME_IN_URI", "URI içinde şema bulunamadı" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "Boş değiştirgelerle URI kullanıma hazırlanamaz" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "Parça hem yolda, hem de parçada belirtilemez" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "Yol ve sorgu dizgisinde sorgu dizgisi belirtilemez" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "Anasistem belirtilmediyse kapı belirtilemez" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "Anasistem belirtilmediyse kullanıcı bilgisi belirtilemez" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "Uyarı: Çıkış belgesinin sürümünün ''{0}'' olması isteniyor. Bu XML sürümü desteklenmez. Çıkış dosyasının sürümü ''1.0'' olacak." }, new Object[] { "ER_SCHEME_REQUIRED", "Şema gerekli!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "SerializerFactory''ye geçirilen Properties nesnesinin bir ''{0}'' özelliği yok." }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "Uyarı: ''{0}'' kodlaması Java Runtime tarafından desteklenmiyor." }, new Object[] { "FEATURE_NOT_FOUND", "''{0}'' değiştirgesi tanınmıyor." }, new Object[] { "FEATURE_NOT_SUPPORTED", "''{0}'' değiştirgesi tanınıyor, ancak istenen değer tanımlanamıyor." }, new Object[] { "DOMSTRING_SIZE_ERR", "Sonuç dizgisi DOMString için çok uzun: ''{0}''." }, new Object[] { "TYPE_MISMATCH_ERR", "Bu değiştirge adına ilişkin değer tipi, beklenen değer tipiyle uyumlu değil." }, new Object[] { "no-output-specified", "Yazılacak verilerin çıkış hedefi boş değerli." },
|
||||
new Object[] { "unsupported-encoding", "Desteklenmeyen bir kodlama saptandı." }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "Düğüm diziselleştirilemedi." }, new Object[] { "cdata-sections-splitted", "CDATA kısmında bir ya da daha çok ']]>' sonlandırma imleyicisi var." }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "Well-Formedness denetşeyicisinin somut örneği yaratılamadı. well-formed değiştirgesi true değerine ayarlandı, ancak doğru biçim denetimi gerçekleştirilemiyor." }, new Object[] { "wf-invalid-character", "''{0}'' düğümü geçersiz XML karakterleri içeriyor." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "Açıklamada geçersiz bir XML karakteri (Unicode: 0x{0}) saptandı." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "İşleme yönergesi verilerinde geçersiz bir XML karakteri (Unicode: 0x{0}) saptandı." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "CDATASection içeriğinde geçersiz bir XML karakteri (Unicode: 0x{0}) saptandı." }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "Düğümün karakter verileri içeriğinde geçersiz bir XML karakteri (Unicode: 0x{0}) saptandı." }, new Object[] { "wf-invalid-character-in-node-name", "''{1}'' adlı {0} düğümünde geçersiz XML karakteri saptandı." },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "Açıklamalar içinde \"--\" dizgisine izin verilmez." }, new Object[] { "ER_WF_LT_IN_ATTVAL", "\"{0}\" öğe tipiyle ilişkilendirilen \"{1}\" özniteliğinin değeri ''<'' karakteri içermemelidir." }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "\"&{0};\" ayrıştırılmamış varlık başvurusuna izin verilmez." }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "Öznitelik değerinde \"&{0};\" dış varlık başvurusuna izin verilmez." }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "\"{0}\" öneki \"{1}\" ad alanına bağlanamıyor." }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "\"{0}\" öğesinin yerel adı boş değerli." }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "\"{0}\" özniteliğinin yerel adı boş değerli." }, new Object[] { "unbound-prefix-in-entity-reference", "\"{0}\" varlık düğümünün yerine koyma metninde, bağlanmamış \"{2}\" öneki bulunan bir öğe düğümü (\"{1}\") var." }, new Object[] { "unbound-prefix-in-entity-reference", "\"{0}\" varlık düğümünün yerine koyma metninde, bağlanmamış \"{2}\" öneki bulunan bir öznitelik düğümü (\"{1}\") var." } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_zh extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "消息密钥“{0}”不在消息类“{1}”中" }, new Object[] { "BAD_MSGFORMAT", "消息类“{1}”中的消息“{0}”的格式无效。" }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "串行器类“{0}”不能实现 org.xml.sax.ContentHandler。" }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "找不到资源 [ {0} ]。\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "资源 [ {0} ] 无法装入:{1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "缓冲区大小 <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "检测到无效的 UTF-16 超大字符集:{0}?" }, new Object[] { "ER_OIERROR", "IO 错误" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "在生成子节点之后或在生成元素之前无法添加属性 {0}。将忽略属性。" }, new Object[] { "ER_NAMESPACE_PREFIX", "尚未声明前缀“{0}”的名称空间。" },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "属性“{0}”在元素外。" }, new Object[] { "ER_STRAY_NAMESPACE", "名称空间声明“{0}”=“{1}”在元素外。" }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "无法装入“{0}”(检查 CLASSPATH),现在只使用缺省值" }, new Object[] { "ER_ILLEGAL_CHARACTER", "尝试输出整数值 {0}(它不是以指定的 {1} 输出编码表示)的字符。" }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "无法为输出方法“{1}”装入属性文件“{0}”(检查 CLASSPATH)" }, new Object[] { "ER_INVALID_PORT", "端口号无效" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "主机为空时,无法设置端口" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "主机不是格式正确的地址" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "模式不一致。" }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "无法从空字符串设置模式" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "路径包含无效的转义序列" }, new Object[] { "ER_PATH_INVALID_CHAR", "路径包含无效的字符:{0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "片段包含无效的字符" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "路径为空时,无法设置片段" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "只能为类属 URI 设置片段" }, new Object[] { "ER_NO_SCHEME_IN_URI", "URI 中找不到任何模式" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "不能以空参数初始化 URI" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "路径和片段中都不能指定片段" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "路径和查询字符串中不能指定查询字符串" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "如果没有指定主机,则不可以指定端口" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "如果没有指定主机,则不可以指定用户信息" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "警告:要求输出文档的版本是“{0}”。不支持此 XML 版本。输出文档的版本将会是“1.0”。" }, new Object[] { "ER_SCHEME_REQUIRED", "模式是必需的!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "传递给 SerializerFactory 的 Properties 对象不具有属性“{0}”。" }, new Object[] { "FEATURE_NOT_FOUND", "未识别出参数“{0}”。" }, new Object[] { "FEATURE_NOT_SUPPORTED", "已识别出参数“{0}”,但无法设置请求的值。" }, new Object[] { "DOMSTRING_SIZE_ERR", "产生的字符串过长不能装入 DOMString:“{0}”。" }, new Object[] { "TYPE_MISMATCH_ERR", "此参数名称的值类型与期望的值类型不兼容。" }, new Object[] { "no-output-specified", "将要写入数据的输出目标为空。" }, new Object[] { "unsupported-encoding", "遇到不受支持的编码。" },
|
||||
new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "无法将节点序列化。 " }, new Object[] { "cdata-sections-splitted", "CDATA 部分包含一个或多个终止标记“]]>”。" }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "无法创建格式正确性检查器的实例。“格式正确”参数已设置为 true,但无法执行格式正确性检查。" }, new Object[] { "wf-invalid-character", "节点“{0}”包含无效的 XML 字符。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "在注释中找到无效的 XML 字符 (Unicode: 0x''{0})''。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "在处理指令数据中找到无效的 XML 字符 (Unicode: 0x''{0})''。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "在 CDATA 部分的内容中找到无效的 XML 字符 (Unicode: 0x''{0})''。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "在节点的字符数据内容中找到无效的 XML 字符 (Unicode: 0x''{0})''。" }, new Object[] { "wf-invalid-character-in-node-name", "名称为“{1})”的“{0})”中找到无效的 XML 字符。" }, new Object[] { "ER_WF_DASH_IN_COMMENT", "注释中不允许有字符串“--”。" },
|
||||
new Object[] { "ER_WF_LT_IN_ATTVAL", "与元素类型“{0}”关联的属性“{1}”的值不得包含“<”字符。" }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "不允许有未解析的实体引用“&{0};”。" }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "属性值中不允许有外部实体引用“&{0};”。" }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "前缀“{0}”不能绑定到名称空间“{1}”。" }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "元素“{0}”的局部名为空。" }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "属性“{0}”的局部名为空。" }, new Object[] { "unbound-prefix-in-entity-reference", "实体节点“{0}”的替代文本中包含元素节点“{1}”,该节点具有未绑定的前缀“{2}”。" }, new Object[] { "unbound-prefix-in-entity-reference", "实体节点“{0}”的替代文本中包含属性节点“{1}”,该节点具有未绑定的前缀“{2}”。" } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
public class SerializerMessages_zh_CN extends SerializerMessages_zh {}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.ListResourceBundle;
|
||||
|
||||
public class SerializerMessages_zh_TW extends ListResourceBundle {
|
||||
public Object[][] getContents() {
|
||||
Object[][] contents = {
|
||||
new Object[] { "BAD_MSGKEY", "訊息鍵 ''{0}'' 不在訊息類別 ''{1}'' 中" }, new Object[] { "BAD_MSGFORMAT", "訊息類別 ''{1}'' 中的訊息 ''{0}'' 格式化失敗。" }, new Object[] { "ER_SERIALIZER_NOT_CONTENTHANDLER", "Serializer 類別 ''{0}'' 不實作 org.xml.sax.ContentHandler。" }, new Object[] { "ER_RESOURCE_COULD_NOT_FIND", "找不到資源 [ {0} ]。\n {1}" }, new Object[] { "ER_RESOURCE_COULD_NOT_LOAD", "無法載入資源 [ {0} ]:{1} \n {2} \t {3}" }, new Object[] { "ER_BUFFER_SIZE_LESSTHAN_ZERO", "緩衝區大小 <=0" }, new Object[] { "ER_INVALID_UTF16_SURROGATE", "偵測到無效的 UTF-16 代理:{0}?" }, new Object[] { "ER_OIERROR", "IO 錯誤" }, new Object[] { "ER_ILLEGAL_ATTRIBUTE_POSITION", "在產生子項節點之後,或在產生元素之前,不可新增屬性 {0}。屬性會被忽略。" }, new Object[] { "ER_NAMESPACE_PREFIX", "字首 ''{0}'' 的名稱空間尚未宣告。" },
|
||||
new Object[] { "ER_STRAY_ATTRIBUTE", "屬性 ''{0}'' 超出元素外。" }, new Object[] { "ER_STRAY_NAMESPACE", "名稱空間宣告 ''{0}''=''{1}'' 超出元素外。" }, new Object[] { "ER_COULD_NOT_LOAD_RESOURCE", "無法載入 ''{0}''(檢查 CLASSPATH),目前只使用預設值" }, new Object[] { "ER_ILLEGAL_CHARACTER", "試圖輸出不是以指定的輸出編碼 {1} 呈現的整數值 {0} 的字元。" }, new Object[] { "ER_COULD_NOT_LOAD_METHOD_PROPERTY", "無法載入輸出方法 ''{1}''(檢查 CLASSPATH)的內容檔 ''{0}''" }, new Object[] { "ER_INVALID_PORT", "無效的埠編號" }, new Object[] { "ER_PORT_WHEN_HOST_NULL", "主機為空值時,無法設定埠" }, new Object[] { "ER_HOST_ADDRESS_NOT_WELLFORMED", "主機沒有完整的位址" }, new Object[] { "ER_SCHEME_NOT_CONFORMANT", "綱要不是 conformant。" }, new Object[] { "ER_SCHEME_FROM_NULL_STRING", "無法從空字串設定綱要" },
|
||||
new Object[] { "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", "路徑包含無效的跳脫字元" }, new Object[] { "ER_PATH_INVALID_CHAR", "路徑包含無效的字元:{0}" }, new Object[] { "ER_FRAG_INVALID_CHAR", "片段包含無效的字元" }, new Object[] { "ER_FRAG_WHEN_PATH_NULL", "路徑為空值時,無法設定片段" }, new Object[] { "ER_FRAG_FOR_GENERIC_URI", "只能對通用的 URI 設定片段" }, new Object[] { "ER_NO_SCHEME_IN_URI", "在 URI 找不到綱要" }, new Object[] { "ER_CANNOT_INIT_URI_EMPTY_PARMS", "無法以空白參數起始設定 URI" }, new Object[] { "ER_NO_FRAGMENT_STRING_IN_PATH", "片段無法同時在路徑和片段中指定" }, new Object[] { "ER_NO_QUERY_STRING_IN_PATH", "在路徑及查詢字串中不可指定查詢字串" }, new Object[] { "ER_NO_PORT_IF_NO_HOST", "如果沒有指定主機,不可指定埠" },
|
||||
new Object[] { "ER_NO_USERINFO_IF_NO_HOST", "如果沒有指定主機,不可指定 Userinfo" }, new Object[] { "ER_XML_VERSION_NOT_SUPPORTED", "警告:輸出文件的版本要求是 ''{0}''。未支援這個版本的 XML。輸出文件的版本會是 ''1.0''。" }, new Object[] { "ER_SCHEME_REQUIRED", "綱要是必需的!" }, new Object[] { "ER_FACTORY_PROPERTY_MISSING", "傳遞到 SerializerFactory 的 Properties 物件沒有 ''{0}'' 內容。" }, new Object[] { "ER_ENCODING_NOT_SUPPORTED", "警告:Java 執行時期不支援編碼 ''{0}''。" }, new Object[] { "FEATURE_NOT_FOUND", "無法辨識參數 ''{0}''。" }, new Object[] { "FEATURE_NOT_SUPPORTED", "可辨識 ''{0}'' 參數,但所要求的值無法設定。" }, new Object[] { "DOMSTRING_SIZE_ERR", "結果字串過長,無法置入 DOMString: ''{0}'' 中。" }, new Object[] { "TYPE_MISMATCH_ERR", "這個參數名稱的值類型與期望值類型不相容。" }, new Object[] { "no-output-specified", "資料要寫入的輸出目的地為空值。" },
|
||||
new Object[] { "unsupported-encoding", "發現不支援的編碼。" }, new Object[] { "ER_UNABLE_TO_SERIALIZE_NODE", "節點無法序列化。" }, new Object[] { "cdata-sections-splitted", "CDATA 區段包含一或多個終止標記 ']]>'。" }, new Object[] { "ER_WARNING_WF_NOT_CHECKED", "無法建立「形式完整」檢查程式的實例。Well-formed 參數雖設為 true,但無法執行形式完整檢查。" }, new Object[] { "wf-invalid-character", "節點 ''{0}'' 包含無效的 XML 字元。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_COMMENT", "在註解中發現無效的 XML 字元 (Unicode: 0x{0})。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_PI", "在處理程序 instructiondata 中發現無效的 XML 字元 (Unicode: 0x{0})。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_CDATA", "在 CDATASection 的內容中發現無效的 XML 字元 (Unicode: 0x{0})。" }, new Object[] { "ER_WF_INVALID_CHARACTER_IN_TEXT", "在節點的字元資料內容中發現無效的 XML 字元 (Unicode: 0x{0})。" }, new Object[] { "wf-invalid-character-in-node-name", "在名為 ''{1}'' 的 ''{0}'' 中發現無效的 XML 字元。" },
|
||||
new Object[] { "ER_WF_DASH_IN_COMMENT", "註解中不允許使用字串 \"--\"。" }, new Object[] { "ER_WF_LT_IN_ATTVAL", "與元素類型 \"{0}\" 相關聯的屬性 \"{1}\" 值不可包含 ''<'' 字元。" }, new Object[] { "ER_WF_REF_TO_UNPARSED_ENT", "不允許使用未剖析的實體參照 \"&{0};\"。" }, new Object[] { "ER_WF_REF_TO_EXTERNAL_ENT", "屬性值中不允許使用外部實體參照 \"&{0};\"。" }, new Object[] { "ER_NS_PREFIX_CANNOT_BE_BOUND", "字首 \"{0}\" 無法連結到名稱空間 \"{1}\"。" }, new Object[] { "ER_NULL_LOCAL_ELEMENT_NAME", "元素 \"{0}\" 的本端名稱是空值。" }, new Object[] { "ER_NULL_LOCAL_ATTR_NAME", "屬性 \"{0}\" 的本端名稱是空值。" }, new Object[] { "unbound-prefix-in-entity-reference", "實體節點 \"{0}\" 的取代文字包含附有已切斷連結字首 \"{2}\" 的元素節點 \"{1}\"。" }, new Object[] { "unbound-prefix-in-entity-reference", "實體節點 \"{0}\" 的取代文字包含附有已切斷連結字首 \"{2}\" 的屬性節點 \"{1}\"。" } };
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
public final class StringToIntTable {
|
||||
public static final int INVALID_KEY = -10000;
|
||||
|
||||
private int m_blocksize;
|
||||
|
||||
private String[] m_map;
|
||||
|
||||
private int[] m_values;
|
||||
|
||||
private int m_firstFree = 0;
|
||||
|
||||
private int m_mapSize;
|
||||
|
||||
public StringToIntTable() {
|
||||
this.m_blocksize = 8;
|
||||
this.m_mapSize = this.m_blocksize;
|
||||
this.m_map = new String[this.m_blocksize];
|
||||
this.m_values = new int[this.m_blocksize];
|
||||
}
|
||||
|
||||
public StringToIntTable(int blocksize) {
|
||||
this.m_blocksize = blocksize;
|
||||
this.m_mapSize = blocksize;
|
||||
this.m_map = new String[blocksize];
|
||||
this.m_values = new int[this.m_blocksize];
|
||||
}
|
||||
|
||||
public final int getLength() {
|
||||
return this.m_firstFree;
|
||||
}
|
||||
|
||||
public final void put(String key, int value) {
|
||||
if (this.m_firstFree + 1 >= this.m_mapSize) {
|
||||
this.m_mapSize += this.m_blocksize;
|
||||
String[] newMap = new String[this.m_mapSize];
|
||||
System.arraycopy(this.m_map, 0, newMap, 0, this.m_firstFree + 1);
|
||||
this.m_map = newMap;
|
||||
int[] newValues = new int[this.m_mapSize];
|
||||
System.arraycopy(this.m_values, 0, newValues, 0, this.m_firstFree + 1);
|
||||
this.m_values = newValues;
|
||||
}
|
||||
this.m_map[this.m_firstFree] = key;
|
||||
this.m_values[this.m_firstFree] = value;
|
||||
this.m_firstFree++;
|
||||
}
|
||||
|
||||
public final int get(String key) {
|
||||
for (int i = 0; i < this.m_firstFree; i++) {
|
||||
if (this.m_map[i].equals(key))
|
||||
return this.m_values[i];
|
||||
}
|
||||
return -10000;
|
||||
}
|
||||
|
||||
public final int getIgnoreCase(String key) {
|
||||
if (null == key)
|
||||
return -10000;
|
||||
for (int i = 0; i < this.m_firstFree; i++) {
|
||||
if (this.m_map[i].equalsIgnoreCase(key))
|
||||
return this.m_values[i];
|
||||
}
|
||||
return -10000;
|
||||
}
|
||||
|
||||
public final boolean contains(String key) {
|
||||
for (int i = 0; i < this.m_firstFree; i++) {
|
||||
if (this.m_map[i].equals(key))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final String[] keys() {
|
||||
String[] keysArr = new String[this.m_firstFree];
|
||||
for (int i = 0; i < this.m_firstFree; i++)
|
||||
keysArr[i] = this.m_map[i];
|
||||
return keysArr;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.io.File;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
public final class SystemIDResolver {
|
||||
public static String getAbsoluteURIFromRelative(String localPath) {
|
||||
String str1;
|
||||
if (localPath == null || localPath.length() == 0)
|
||||
return "";
|
||||
String absolutePath = localPath;
|
||||
if (!isAbsolutePath(localPath))
|
||||
try {
|
||||
absolutePath = getAbsolutePathFromRelativePath(localPath);
|
||||
} catch (SecurityException se) {
|
||||
return "file:" + localPath;
|
||||
}
|
||||
if (null != absolutePath) {
|
||||
if (absolutePath.startsWith(File.separator)) {
|
||||
str1 = "file://" + absolutePath;
|
||||
} else {
|
||||
str1 = "file:///" + absolutePath;
|
||||
}
|
||||
} else {
|
||||
str1 = "file:" + localPath;
|
||||
}
|
||||
return replaceChars(str1);
|
||||
}
|
||||
|
||||
private static String getAbsolutePathFromRelativePath(String relativePath) {
|
||||
return new File(relativePath).getAbsolutePath();
|
||||
}
|
||||
|
||||
public static boolean isAbsoluteURI(String systemId) {
|
||||
if (isWindowsAbsolutePath(systemId))
|
||||
return false;
|
||||
int fragmentIndex = systemId.indexOf('#');
|
||||
int queryIndex = systemId.indexOf('?');
|
||||
int slashIndex = systemId.indexOf('/');
|
||||
int colonIndex = systemId.indexOf(':');
|
||||
int index = systemId.length() - 1;
|
||||
if (fragmentIndex > 0)
|
||||
index = fragmentIndex;
|
||||
if (queryIndex > 0 && queryIndex < index)
|
||||
index = queryIndex;
|
||||
if (slashIndex > 0 && slashIndex < index)
|
||||
index = slashIndex;
|
||||
return (colonIndex > 0 && colonIndex < index);
|
||||
}
|
||||
|
||||
public static boolean isAbsolutePath(String systemId) {
|
||||
if (systemId == null)
|
||||
return false;
|
||||
File file = new File(systemId);
|
||||
return file.isAbsolute();
|
||||
}
|
||||
|
||||
private static boolean isWindowsAbsolutePath(String systemId) {
|
||||
if (!isAbsolutePath(systemId))
|
||||
return false;
|
||||
if (systemId.length() > 2 && systemId.charAt(1) == ':' && Character.isLetter(systemId.charAt(0)) && (systemId.charAt(2) == '\\' || systemId.charAt(2) == '/'))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String replaceChars(String str) {
|
||||
StringBuffer buf = new StringBuffer(str);
|
||||
int length = buf.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char currentChar = buf.charAt(i);
|
||||
if (currentChar == ' ') {
|
||||
buf.setCharAt(i, '%');
|
||||
buf.insert(i + 1, "20");
|
||||
length += 2;
|
||||
i += 2;
|
||||
} else if (currentChar == '\\') {
|
||||
buf.setCharAt(i, '/');
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String getAbsoluteURI(String systemId) {
|
||||
String absoluteURI = systemId;
|
||||
if (isAbsoluteURI(systemId)) {
|
||||
if (systemId.startsWith("file:")) {
|
||||
String str = systemId.substring(5);
|
||||
if (str != null && str.startsWith("/")) {
|
||||
if (str.startsWith("///") || !str.startsWith("//")) {
|
||||
int secondColonIndex = systemId.indexOf(':', 5);
|
||||
if (secondColonIndex > 0) {
|
||||
String localPath = systemId.substring(secondColonIndex - 1);
|
||||
try {
|
||||
if (!isAbsolutePath(localPath))
|
||||
absoluteURI = systemId.substring(0, secondColonIndex - 1) + getAbsolutePathFromRelativePath(localPath);
|
||||
} catch (SecurityException se) {
|
||||
return systemId;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return getAbsoluteURIFromRelative(systemId.substring(5));
|
||||
}
|
||||
return replaceChars(absoluteURI);
|
||||
}
|
||||
return systemId;
|
||||
}
|
||||
return getAbsoluteURIFromRelative(systemId);
|
||||
}
|
||||
|
||||
public static String getAbsoluteURI(String urlString, String base) throws TransformerException {
|
||||
if (base == null)
|
||||
return getAbsoluteURI(urlString);
|
||||
String absoluteBase = getAbsoluteURI(base);
|
||||
URI uri = null;
|
||||
try {
|
||||
URI baseURI = new URI(absoluteBase);
|
||||
uri = new URI(baseURI, urlString);
|
||||
} catch (URI.MalformedURIException mue) {
|
||||
throw new TransformerException(mue);
|
||||
}
|
||||
return replaceChars(uri.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,608 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
final class URI {
|
||||
private static final String RESERVED_CHARACTERS = ";/?:@&=+$,";
|
||||
|
||||
private static final String MARK_CHARACTERS = "-_.!~*'() ";
|
||||
|
||||
private static final String SCHEME_CHARACTERS = "+-.";
|
||||
|
||||
private static final String USERINFO_CHARACTERS = ";:&=+$,";
|
||||
|
||||
public static class MalformedURIException extends IOException {
|
||||
public MalformedURIException() {}
|
||||
|
||||
public MalformedURIException(String p_msg) {
|
||||
super(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
private String m_scheme = null;
|
||||
|
||||
private String m_userinfo = null;
|
||||
|
||||
private String m_host = null;
|
||||
|
||||
private int m_port = -1;
|
||||
|
||||
private String m_path = null;
|
||||
|
||||
private String m_queryString = null;
|
||||
|
||||
private String m_fragment = null;
|
||||
|
||||
private static boolean DEBUG = false;
|
||||
|
||||
public URI() {}
|
||||
|
||||
public URI(URI p_other) {
|
||||
initialize(p_other);
|
||||
}
|
||||
|
||||
public URI(String p_uriSpec) throws MalformedURIException {
|
||||
this((URI)null, p_uriSpec);
|
||||
}
|
||||
|
||||
public URI(URI p_base, String p_uriSpec) throws MalformedURIException {
|
||||
initialize(p_base, p_uriSpec);
|
||||
}
|
||||
|
||||
public URI(String p_scheme, String p_schemeSpecificPart) throws MalformedURIException {
|
||||
if (p_scheme == null || p_scheme.trim().length() == 0)
|
||||
throw new MalformedURIException("Cannot construct URI with null/empty scheme!");
|
||||
if (p_schemeSpecificPart == null || p_schemeSpecificPart.trim().length() == 0)
|
||||
throw new MalformedURIException("Cannot construct URI with null/empty scheme-specific part!");
|
||||
setScheme(p_scheme);
|
||||
setPath(p_schemeSpecificPart);
|
||||
}
|
||||
|
||||
public URI(String p_scheme, String p_host, String p_path, String p_queryString, String p_fragment) throws MalformedURIException {
|
||||
this(p_scheme, null, p_host, -1, p_path, p_queryString, p_fragment);
|
||||
}
|
||||
|
||||
public URI(String p_scheme, String p_userinfo, String p_host, int p_port, String p_path, String p_queryString, String p_fragment) throws MalformedURIException {
|
||||
if (p_scheme == null || p_scheme.trim().length() == 0)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_SCHEME_REQUIRED", null));
|
||||
if (p_host == null) {
|
||||
if (p_userinfo != null)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_NO_USERINFO_IF_NO_HOST", null));
|
||||
if (p_port != -1)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_NO_PORT_IF_NO_HOST", null));
|
||||
}
|
||||
if (p_path != null) {
|
||||
if (p_path.indexOf('?') != -1 && p_queryString != null)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_NO_QUERY_STRING_IN_PATH", null));
|
||||
if (p_path.indexOf('#') != -1 && p_fragment != null)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_NO_FRAGMENT_STRING_IN_PATH", null));
|
||||
}
|
||||
setScheme(p_scheme);
|
||||
setHost(p_host);
|
||||
setPort(p_port);
|
||||
setUserinfo(p_userinfo);
|
||||
setPath(p_path);
|
||||
setQueryString(p_queryString);
|
||||
setFragment(p_fragment);
|
||||
}
|
||||
|
||||
private void initialize(URI p_other) {
|
||||
this.m_scheme = p_other.getScheme();
|
||||
this.m_userinfo = p_other.getUserinfo();
|
||||
this.m_host = p_other.getHost();
|
||||
this.m_port = p_other.getPort();
|
||||
this.m_path = p_other.getPath();
|
||||
this.m_queryString = p_other.getQueryString();
|
||||
this.m_fragment = p_other.getFragment();
|
||||
}
|
||||
|
||||
private void initialize(URI p_base, String p_uriSpec) throws MalformedURIException {
|
||||
if (p_base == null && (p_uriSpec == null || p_uriSpec.trim().length() == 0))
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_CANNOT_INIT_URI_EMPTY_PARMS", null));
|
||||
if (p_uriSpec == null || p_uriSpec.trim().length() == 0) {
|
||||
initialize(p_base);
|
||||
return;
|
||||
}
|
||||
String uriSpec = p_uriSpec.trim();
|
||||
int uriSpecLen = uriSpec.length();
|
||||
int index = 0;
|
||||
int colonIndex = uriSpec.indexOf(':');
|
||||
if (colonIndex < 0) {
|
||||
if (p_base == null)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_NO_SCHEME_IN_URI", new Object[] { uriSpec }));
|
||||
} else {
|
||||
initializeScheme(uriSpec);
|
||||
uriSpec = uriSpec.substring(colonIndex + 1);
|
||||
uriSpecLen = uriSpec.length();
|
||||
}
|
||||
if (uriSpec.startsWith("//")) {
|
||||
index += 2;
|
||||
int startPos = index;
|
||||
char testChar = '\000';
|
||||
while (index < uriSpecLen) {
|
||||
testChar = uriSpec.charAt(index);
|
||||
if (testChar == '/' || testChar == '?' || testChar == '#')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
if (index > startPos) {
|
||||
initializeAuthority(uriSpec.substring(startPos, index));
|
||||
} else {
|
||||
this.m_host = "";
|
||||
}
|
||||
}
|
||||
initializePath(uriSpec.substring(index));
|
||||
if (p_base != null) {
|
||||
if (this.m_path.length() == 0 && this.m_scheme == null && this.m_host == null) {
|
||||
this.m_scheme = p_base.getScheme();
|
||||
this.m_userinfo = p_base.getUserinfo();
|
||||
this.m_host = p_base.getHost();
|
||||
this.m_port = p_base.getPort();
|
||||
this.m_path = p_base.getPath();
|
||||
if (this.m_queryString == null)
|
||||
this.m_queryString = p_base.getQueryString();
|
||||
return;
|
||||
}
|
||||
if (this.m_scheme == null)
|
||||
this.m_scheme = p_base.getScheme();
|
||||
if (this.m_host == null) {
|
||||
this.m_userinfo = p_base.getUserinfo();
|
||||
this.m_host = p_base.getHost();
|
||||
this.m_port = p_base.getPort();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (this.m_path.length() > 0 && this.m_path.startsWith("/"))
|
||||
return;
|
||||
String path = new String();
|
||||
String basePath = p_base.getPath();
|
||||
if (basePath != null) {
|
||||
int lastSlash = basePath.lastIndexOf('/');
|
||||
if (lastSlash != -1)
|
||||
path = basePath.substring(0, lastSlash + 1);
|
||||
}
|
||||
path = path.concat(this.m_path);
|
||||
index = -1;
|
||||
while ((index = path.indexOf("/./")) != -1)
|
||||
path = path.substring(0, index + 1).concat(path.substring(index + 3));
|
||||
if (path.endsWith("/."))
|
||||
path = path.substring(0, path.length() - 1);
|
||||
index = -1;
|
||||
int segIndex = -1;
|
||||
String tempString = null;
|
||||
while ((index = path.indexOf("/../")) > 0) {
|
||||
tempString = path.substring(0, path.indexOf("/../"));
|
||||
segIndex = tempString.lastIndexOf('/');
|
||||
if (segIndex != -1)
|
||||
if (!tempString.substring(segIndex++).equals(".."))
|
||||
path = path.substring(0, segIndex).concat(path.substring(index + 4));
|
||||
}
|
||||
if (path.endsWith("/..")) {
|
||||
tempString = path.substring(0, path.length() - 3);
|
||||
segIndex = tempString.lastIndexOf('/');
|
||||
if (segIndex != -1)
|
||||
path = path.substring(0, segIndex + 1);
|
||||
}
|
||||
this.m_path = path;
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeScheme(String p_uriSpec) throws MalformedURIException {
|
||||
int uriSpecLen = p_uriSpec.length();
|
||||
int index = 0;
|
||||
String scheme = null;
|
||||
char testChar = '\000';
|
||||
while (index < uriSpecLen) {
|
||||
testChar = p_uriSpec.charAt(index);
|
||||
if (testChar == ':' || testChar == '/' || testChar == '?' || testChar == '#')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
scheme = p_uriSpec.substring(0, index);
|
||||
if (scheme.length() == 0)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_NO_SCHEME_INURI", null));
|
||||
setScheme(scheme);
|
||||
}
|
||||
|
||||
private void initializeAuthority(String p_uriSpec) throws MalformedURIException {
|
||||
int index = 0;
|
||||
int start = 0;
|
||||
int end = p_uriSpec.length();
|
||||
char testChar = '\000';
|
||||
String userinfo = null;
|
||||
if (p_uriSpec.indexOf('@', start) != -1) {
|
||||
while (index < end) {
|
||||
testChar = p_uriSpec.charAt(index);
|
||||
if (testChar == '@')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
userinfo = p_uriSpec.substring(start, index);
|
||||
index++;
|
||||
}
|
||||
String host = null;
|
||||
start = index;
|
||||
while (index < end) {
|
||||
testChar = p_uriSpec.charAt(index);
|
||||
if (testChar == ':')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
host = p_uriSpec.substring(start, index);
|
||||
int port = -1;
|
||||
if (host.length() > 0)
|
||||
if (testChar == ':') {
|
||||
start = ++index;
|
||||
while (index < end)
|
||||
index++;
|
||||
String portStr = p_uriSpec.substring(start, index);
|
||||
if (portStr.length() > 0) {
|
||||
for (int i = 0; i < portStr.length(); i++) {
|
||||
if (!isDigit(portStr.charAt(i)))
|
||||
throw new MalformedURIException(portStr + " is invalid. Port should only contain digits!");
|
||||
}
|
||||
try {
|
||||
port = Integer.parseInt(portStr);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
}
|
||||
setHost(host);
|
||||
setPort(port);
|
||||
setUserinfo(userinfo);
|
||||
}
|
||||
|
||||
private void initializePath(String p_uriSpec) throws MalformedURIException {
|
||||
if (p_uriSpec == null)
|
||||
throw new MalformedURIException("Cannot initialize path from null string!");
|
||||
int index = 0;
|
||||
int start = 0;
|
||||
int end = p_uriSpec.length();
|
||||
char testChar = '\000';
|
||||
while (index < end) {
|
||||
testChar = p_uriSpec.charAt(index);
|
||||
if (testChar == '?' || testChar == '#')
|
||||
break;
|
||||
if (testChar == '%') {
|
||||
if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2)))
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE", null));
|
||||
} else if (!isReservedCharacter(testChar) && !isUnreservedCharacter(testChar)) {
|
||||
if ('\\' != testChar)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_PATH_INVALID_CHAR", new Object[] { String.valueOf(testChar) }));
|
||||
}
|
||||
index++;
|
||||
}
|
||||
this.m_path = p_uriSpec.substring(start, index);
|
||||
if (testChar == '?') {
|
||||
start = ++index;
|
||||
while (index < end) {
|
||||
testChar = p_uriSpec.charAt(index);
|
||||
if (testChar == '#')
|
||||
break;
|
||||
if (testChar == '%') {
|
||||
if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2)))
|
||||
throw new MalformedURIException("Query string contains invalid escape sequence!");
|
||||
} else if (!isReservedCharacter(testChar) && !isUnreservedCharacter(testChar)) {
|
||||
throw new MalformedURIException("Query string contains invalid character:" + testChar);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
this.m_queryString = p_uriSpec.substring(start, index);
|
||||
}
|
||||
if (testChar == '#') {
|
||||
start = ++index;
|
||||
while (index < end) {
|
||||
testChar = p_uriSpec.charAt(index);
|
||||
if (testChar == '%') {
|
||||
if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2)))
|
||||
throw new MalformedURIException("Fragment contains invalid escape sequence!");
|
||||
} else if (!isReservedCharacter(testChar) && !isUnreservedCharacter(testChar)) {
|
||||
throw new MalformedURIException("Fragment contains invalid character:" + testChar);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
this.m_fragment = p_uriSpec.substring(start, index);
|
||||
}
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return this.m_scheme;
|
||||
}
|
||||
|
||||
public String getSchemeSpecificPart() {
|
||||
StringBuffer schemespec = new StringBuffer();
|
||||
if (this.m_userinfo != null || this.m_host != null || this.m_port != -1)
|
||||
schemespec.append("//");
|
||||
if (this.m_userinfo != null) {
|
||||
schemespec.append(this.m_userinfo);
|
||||
schemespec.append('@');
|
||||
}
|
||||
if (this.m_host != null)
|
||||
schemespec.append(this.m_host);
|
||||
if (this.m_port != -1) {
|
||||
schemespec.append(':');
|
||||
schemespec.append(this.m_port);
|
||||
}
|
||||
if (this.m_path != null)
|
||||
schemespec.append(this.m_path);
|
||||
if (this.m_queryString != null) {
|
||||
schemespec.append('?');
|
||||
schemespec.append(this.m_queryString);
|
||||
}
|
||||
if (this.m_fragment != null) {
|
||||
schemespec.append('#');
|
||||
schemespec.append(this.m_fragment);
|
||||
}
|
||||
return schemespec.toString();
|
||||
}
|
||||
|
||||
public String getUserinfo() {
|
||||
return this.m_userinfo;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return this.m_host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.m_port;
|
||||
}
|
||||
|
||||
public String getPath(boolean p_includeQueryString, boolean p_includeFragment) {
|
||||
StringBuffer pathString = new StringBuffer(this.m_path);
|
||||
if (p_includeQueryString && this.m_queryString != null) {
|
||||
pathString.append('?');
|
||||
pathString.append(this.m_queryString);
|
||||
}
|
||||
if (p_includeFragment && this.m_fragment != null) {
|
||||
pathString.append('#');
|
||||
pathString.append(this.m_fragment);
|
||||
}
|
||||
return pathString.toString();
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.m_path;
|
||||
}
|
||||
|
||||
public String getQueryString() {
|
||||
return this.m_queryString;
|
||||
}
|
||||
|
||||
public String getFragment() {
|
||||
return this.m_fragment;
|
||||
}
|
||||
|
||||
public void setScheme(String p_scheme) throws MalformedURIException {
|
||||
if (p_scheme == null)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_SCHEME_FROM_NULL_STRING", null));
|
||||
if (!isConformantSchemeName(p_scheme))
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_SCHEME_NOT_CONFORMANT", null));
|
||||
this.m_scheme = p_scheme.toLowerCase();
|
||||
}
|
||||
|
||||
public void setUserinfo(String p_userinfo) throws MalformedURIException {
|
||||
if (p_userinfo == null) {
|
||||
this.m_userinfo = null;
|
||||
} else {
|
||||
if (this.m_host == null)
|
||||
throw new MalformedURIException("Userinfo cannot be set when host is null!");
|
||||
int index = 0;
|
||||
int end = p_userinfo.length();
|
||||
char testChar = '\000';
|
||||
while (index < end) {
|
||||
testChar = p_userinfo.charAt(index);
|
||||
if (testChar == '%') {
|
||||
if (index + 2 >= end || !isHex(p_userinfo.charAt(index + 1)) || !isHex(p_userinfo.charAt(index + 2)))
|
||||
throw new MalformedURIException("Userinfo contains invalid escape sequence!");
|
||||
} else if (!isUnreservedCharacter(testChar) && ";:&=+$,".indexOf(testChar) == -1) {
|
||||
throw new MalformedURIException("Userinfo contains invalid character:" + testChar);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
this.m_userinfo = p_userinfo;
|
||||
}
|
||||
|
||||
public void setHost(String p_host) throws MalformedURIException {
|
||||
if (p_host == null || p_host.trim().length() == 0) {
|
||||
this.m_host = p_host;
|
||||
this.m_userinfo = null;
|
||||
this.m_port = -1;
|
||||
} else if (!isWellFormedAddress(p_host)) {
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_HOST_ADDRESS_NOT_WELLFORMED", null));
|
||||
}
|
||||
this.m_host = p_host;
|
||||
}
|
||||
|
||||
public void setPort(int p_port) throws MalformedURIException {
|
||||
if (p_port >= 0 && p_port <= 65535) {
|
||||
if (this.m_host == null)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_PORT_WHEN_HOST_NULL", null));
|
||||
} else if (p_port != -1) {
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_INVALID_PORT", null));
|
||||
}
|
||||
this.m_port = p_port;
|
||||
}
|
||||
|
||||
public void setPath(String p_path) throws MalformedURIException {
|
||||
if (p_path == null) {
|
||||
this.m_path = null;
|
||||
this.m_queryString = null;
|
||||
this.m_fragment = null;
|
||||
} else {
|
||||
initializePath(p_path);
|
||||
}
|
||||
}
|
||||
|
||||
public void appendPath(String p_addToPath) throws MalformedURIException {
|
||||
if (p_addToPath == null || p_addToPath.trim().length() == 0)
|
||||
return;
|
||||
if (!isURIString(p_addToPath))
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_PATH_INVALID_CHAR", new Object[] { p_addToPath }));
|
||||
if (this.m_path == null || this.m_path.trim().length() == 0) {
|
||||
if (p_addToPath.startsWith("/")) {
|
||||
this.m_path = p_addToPath;
|
||||
} else {
|
||||
this.m_path = "/" + p_addToPath;
|
||||
}
|
||||
} else if (this.m_path.endsWith("/")) {
|
||||
if (p_addToPath.startsWith("/")) {
|
||||
this.m_path = this.m_path.concat(p_addToPath.substring(1));
|
||||
} else {
|
||||
this.m_path = this.m_path.concat(p_addToPath);
|
||||
}
|
||||
} else if (p_addToPath.startsWith("/")) {
|
||||
this.m_path = this.m_path.concat(p_addToPath);
|
||||
} else {
|
||||
this.m_path = this.m_path.concat("/" + p_addToPath);
|
||||
}
|
||||
}
|
||||
|
||||
public void setQueryString(String p_queryString) throws MalformedURIException {
|
||||
if (p_queryString == null) {
|
||||
this.m_queryString = null;
|
||||
} else {
|
||||
if (!isGenericURI())
|
||||
throw new MalformedURIException("Query string can only be set for a generic URI!");
|
||||
if (getPath() == null)
|
||||
throw new MalformedURIException("Query string cannot be set when path is null!");
|
||||
if (!isURIString(p_queryString))
|
||||
throw new MalformedURIException("Query string contains invalid character!");
|
||||
this.m_queryString = p_queryString;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFragment(String p_fragment) throws MalformedURIException {
|
||||
if (p_fragment == null) {
|
||||
this.m_fragment = null;
|
||||
} else {
|
||||
if (!isGenericURI())
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_FRAG_FOR_GENERIC_URI", null));
|
||||
if (getPath() == null)
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_FRAG_WHEN_PATH_NULL", null));
|
||||
if (!isURIString(p_fragment))
|
||||
throw new MalformedURIException(Utils.messages.createMessage("ER_FRAG_INVALID_CHAR", null));
|
||||
this.m_fragment = p_fragment;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object p_test) {
|
||||
if (p_test instanceof URI) {
|
||||
URI testURI = (URI)p_test;
|
||||
if (((this.m_scheme == null && testURI.m_scheme == null) || (this.m_scheme != null && testURI.m_scheme != null && this.m_scheme.equals(testURI.m_scheme))) && ((this.m_userinfo == null && testURI.m_userinfo == null) || (this.m_userinfo != null && testURI.m_userinfo != null && this.m_userinfo.equals(testURI.m_userinfo))) && ((this.m_host == null && testURI.m_host == null) || (this.m_host != null && testURI.m_host != null && this.m_host.equals(testURI.m_host))) && this.m_port == testURI.m_port && ((this.m_path == null && testURI.m_path == null) || (this.m_path != null && testURI.m_path != null && this.m_path.equals(testURI.m_path))) && ((this.m_queryString == null && testURI.m_queryString == null) || (this.m_queryString != null && testURI.m_queryString != null && this.m_queryString.equals(testURI.m_queryString))) && ((this.m_fragment == null && testURI.m_fragment == null) || (this.m_fragment != null && testURI.m_fragment != null && this.m_fragment.equals(testURI.m_fragment))))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer uriSpecString = new StringBuffer();
|
||||
if (this.m_scheme != null) {
|
||||
uriSpecString.append(this.m_scheme);
|
||||
uriSpecString.append(':');
|
||||
}
|
||||
uriSpecString.append(getSchemeSpecificPart());
|
||||
return uriSpecString.toString();
|
||||
}
|
||||
|
||||
public boolean isGenericURI() {
|
||||
return (this.m_host != null);
|
||||
}
|
||||
|
||||
public static boolean isConformantSchemeName(String p_scheme) {
|
||||
if (p_scheme == null || p_scheme.trim().length() == 0)
|
||||
return false;
|
||||
if (!isAlpha(p_scheme.charAt(0)))
|
||||
return false;
|
||||
for (int i = 1; i < p_scheme.length(); i++) {
|
||||
char testChar = p_scheme.charAt(i);
|
||||
if (!isAlphanum(testChar) && "+-.".indexOf(testChar) == -1)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isWellFormedAddress(String p_address) {
|
||||
if (p_address == null)
|
||||
return false;
|
||||
String address = p_address.trim();
|
||||
int addrLength = address.length();
|
||||
if (addrLength == 0 || addrLength > 255)
|
||||
return false;
|
||||
if (address.startsWith(".") || address.startsWith("-"))
|
||||
return false;
|
||||
int index = address.lastIndexOf('.');
|
||||
if (address.endsWith("."))
|
||||
index = address.substring(0, index).lastIndexOf('.');
|
||||
if (index + 1 < addrLength && isDigit(p_address.charAt(index + 1))) {
|
||||
int numDots = 0;
|
||||
for (int i = 0; i < addrLength; i++) {
|
||||
char testChar = address.charAt(i);
|
||||
if (testChar == '.') {
|
||||
if (!isDigit(address.charAt(i - 1)) || (i + 1 < addrLength && !isDigit(address.charAt(i + 1))))
|
||||
return false;
|
||||
numDots++;
|
||||
} else if (!isDigit(testChar)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (numDots != 3)
|
||||
return false;
|
||||
} else {
|
||||
for (int i = 0; i < addrLength; i++) {
|
||||
char testChar = address.charAt(i);
|
||||
if (testChar == '.') {
|
||||
if (!isAlphanum(address.charAt(i - 1)))
|
||||
return false;
|
||||
if (i + 1 < addrLength && !isAlphanum(address.charAt(i + 1)))
|
||||
return false;
|
||||
} else if (!isAlphanum(testChar) && testChar != '-') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isDigit(char p_char) {
|
||||
return (p_char >= '0' && p_char <= '9');
|
||||
}
|
||||
|
||||
private static boolean isHex(char p_char) {
|
||||
return (isDigit(p_char) || (p_char >= 'a' && p_char <= 'f') || (p_char >= 'A' && p_char <= 'F'));
|
||||
}
|
||||
|
||||
private static boolean isAlpha(char p_char) {
|
||||
return ((p_char >= 'a' && p_char <= 'z') || (p_char >= 'A' && p_char <= 'Z'));
|
||||
}
|
||||
|
||||
private static boolean isAlphanum(char p_char) {
|
||||
return (isAlpha(p_char) || isDigit(p_char));
|
||||
}
|
||||
|
||||
private static boolean isReservedCharacter(char p_char) {
|
||||
return (";/?:@&=+$,".indexOf(p_char) != -1);
|
||||
}
|
||||
|
||||
private static boolean isUnreservedCharacter(char p_char) {
|
||||
return (isAlphanum(p_char) || "-_.!~*'() ".indexOf(p_char) != -1);
|
||||
}
|
||||
|
||||
private static boolean isURIString(String p_uric) {
|
||||
if (p_uric == null)
|
||||
return false;
|
||||
int end = p_uric.length();
|
||||
char testChar = '\000';
|
||||
for (int i = 0; i < end; i++) {
|
||||
testChar = p_uric.charAt(i);
|
||||
if (testChar == '%') {
|
||||
if (i + 2 >= end || !isHex(p_uric.charAt(i + 1)) || !isHex(p_uric.charAt(i + 2)))
|
||||
return false;
|
||||
i += 2;
|
||||
} else if (!isReservedCharacter(testChar) && !isUnreservedCharacter(testChar)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
public final class Utils {
|
||||
public static final Messages messages = new Messages(SerializerMessages.class.getName());
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
public final class WrappedRuntimeException extends RuntimeException {
|
||||
static final long serialVersionUID = 7140414456714658073L;
|
||||
|
||||
private Exception m_exception;
|
||||
|
||||
public WrappedRuntimeException(Exception e) {
|
||||
super(e.getMessage());
|
||||
this.m_exception = e;
|
||||
}
|
||||
|
||||
public WrappedRuntimeException(String msg, Exception e) {
|
||||
super(msg);
|
||||
this.m_exception = e;
|
||||
}
|
||||
|
||||
public Exception getException() {
|
||||
return this.m_exception;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class XML11Char {
|
||||
private static final byte[] XML11CHARS = new byte[65536];
|
||||
|
||||
public static final int MASK_XML11_VALID = 1;
|
||||
|
||||
public static final int MASK_XML11_SPACE = 2;
|
||||
|
||||
public static final int MASK_XML11_NAME_START = 4;
|
||||
|
||||
public static final int MASK_XML11_NAME = 8;
|
||||
|
||||
public static final int MASK_XML11_CONTROL = 16;
|
||||
|
||||
public static final int MASK_XML11_CONTENT = 32;
|
||||
|
||||
public static final int MASK_XML11_NCNAME_START = 64;
|
||||
|
||||
public static final int MASK_XML11_NCNAME = 128;
|
||||
|
||||
public static final int MASK_XML11_CONTENT_INTERNAL = 48;
|
||||
|
||||
static {
|
||||
Arrays.fill(XML11CHARS, 1, 9, (byte)17);
|
||||
XML11CHARS[9] = 35;
|
||||
XML11CHARS[10] = 3;
|
||||
Arrays.fill(XML11CHARS, 11, 13, (byte)17);
|
||||
XML11CHARS[13] = 3;
|
||||
Arrays.fill(XML11CHARS, 14, 32, (byte)17);
|
||||
XML11CHARS[32] = 35;
|
||||
Arrays.fill(XML11CHARS, 33, 38, (byte)33);
|
||||
XML11CHARS[38] = 1;
|
||||
Arrays.fill(XML11CHARS, 39, 45, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 45, 47, (byte)-87);
|
||||
XML11CHARS[47] = 33;
|
||||
Arrays.fill(XML11CHARS, 48, 58, (byte)-87);
|
||||
XML11CHARS[58] = 45;
|
||||
XML11CHARS[59] = 33;
|
||||
XML11CHARS[60] = 1;
|
||||
Arrays.fill(XML11CHARS, 61, 65, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 65, 91, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 91, 93, (byte)33);
|
||||
XML11CHARS[93] = 1;
|
||||
XML11CHARS[94] = 33;
|
||||
XML11CHARS[95] = -19;
|
||||
XML11CHARS[96] = 33;
|
||||
Arrays.fill(XML11CHARS, 97, 123, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 123, 127, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 127, 133, (byte)17);
|
||||
XML11CHARS[133] = 35;
|
||||
Arrays.fill(XML11CHARS, 134, 160, (byte)17);
|
||||
Arrays.fill(XML11CHARS, 160, 183, (byte)33);
|
||||
XML11CHARS[183] = -87;
|
||||
Arrays.fill(XML11CHARS, 184, 192, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 192, 215, (byte)-19);
|
||||
XML11CHARS[215] = 33;
|
||||
Arrays.fill(XML11CHARS, 216, 247, (byte)-19);
|
||||
XML11CHARS[247] = 33;
|
||||
Arrays.fill(XML11CHARS, 248, 768, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 768, 880, (byte)-87);
|
||||
Arrays.fill(XML11CHARS, 880, 894, (byte)-19);
|
||||
XML11CHARS[894] = 33;
|
||||
Arrays.fill(XML11CHARS, 895, 8192, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 8192, 8204, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 8204, 8206, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 8206, 8232, (byte)33);
|
||||
XML11CHARS[8232] = 35;
|
||||
Arrays.fill(XML11CHARS, 8233, 8255, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 8255, 8257, (byte)-87);
|
||||
Arrays.fill(XML11CHARS, 8257, 8304, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 8304, 8592, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 8592, 11264, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 11264, 12272, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 12272, 12289, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 12289, 55296, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 57344, 63744, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 63744, 64976, (byte)-19);
|
||||
Arrays.fill(XML11CHARS, 64976, 65008, (byte)33);
|
||||
Arrays.fill(XML11CHARS, 65008, 65534, (byte)-19);
|
||||
}
|
||||
|
||||
public static boolean isXML11Space(int c) {
|
||||
return (c < 65536 && (XML11CHARS[c] & 0x2) != 0);
|
||||
}
|
||||
|
||||
public static boolean isXML11Valid(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x1) != 0) || (65536 <= c && c <= 1114111));
|
||||
}
|
||||
|
||||
public static boolean isXML11Invalid(int c) {
|
||||
return !isXML11Valid(c);
|
||||
}
|
||||
|
||||
public static boolean isXML11ValidLiteral(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x1) != 0 && (XML11CHARS[c] & 0x10) == 0) || (65536 <= c && c <= 1114111));
|
||||
}
|
||||
|
||||
public static boolean isXML11Content(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x20) != 0) || (65536 <= c && c <= 1114111));
|
||||
}
|
||||
|
||||
public static boolean isXML11InternalEntityContent(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x30) != 0) || (65536 <= c && c <= 1114111));
|
||||
}
|
||||
|
||||
public static boolean isXML11NameStart(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x4) != 0) || (65536 <= c && c < 983040));
|
||||
}
|
||||
|
||||
public static boolean isXML11Name(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x8) != 0) || (c >= 65536 && c < 983040));
|
||||
}
|
||||
|
||||
public static boolean isXML11NCNameStart(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x40) != 0) || (65536 <= c && c < 983040));
|
||||
}
|
||||
|
||||
public static boolean isXML11NCName(int c) {
|
||||
return ((c < 65536 && (XML11CHARS[c] & 0x80) != 0) || (65536 <= c && c < 983040));
|
||||
}
|
||||
|
||||
public static boolean isXML11NameHighSurrogate(int c) {
|
||||
return (55296 <= c && c <= 56191);
|
||||
}
|
||||
|
||||
public static boolean isXML11ValidName(String name) {
|
||||
int length = name.length();
|
||||
if (length == 0)
|
||||
return false;
|
||||
int i = 1;
|
||||
char ch = name.charAt(0);
|
||||
if (!isXML11NameStart(ch))
|
||||
if (length > 1 && isXML11NameHighSurrogate(ch)) {
|
||||
char ch2 = name.charAt(1);
|
||||
if (!XMLChar.isLowSurrogate(ch2) || !isXML11NameStart(XMLChar.supplemental(ch, ch2)))
|
||||
return false;
|
||||
i = 2;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
while (i < length) {
|
||||
ch = name.charAt(i);
|
||||
if (!isXML11Name(ch))
|
||||
if (++i < length && isXML11NameHighSurrogate(ch)) {
|
||||
char ch2 = name.charAt(i);
|
||||
if (!XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)))
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isXML11ValidNCName(String ncName) {
|
||||
int length = ncName.length();
|
||||
if (length == 0)
|
||||
return false;
|
||||
int i = 1;
|
||||
char ch = ncName.charAt(0);
|
||||
if (!isXML11NCNameStart(ch))
|
||||
if (length > 1 && isXML11NameHighSurrogate(ch)) {
|
||||
char ch2 = ncName.charAt(1);
|
||||
if (!XMLChar.isLowSurrogate(ch2) || !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)))
|
||||
return false;
|
||||
i = 2;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
while (i < length) {
|
||||
ch = ncName.charAt(i);
|
||||
if (!isXML11NCName(ch))
|
||||
if (++i < length && isXML11NameHighSurrogate(ch)) {
|
||||
char ch2 = ncName.charAt(i);
|
||||
if (!XMLChar.isLowSurrogate(ch2) || !isXML11NCName(XMLChar.supplemental(ch, ch2)))
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isXML11ValidNmtoken(String nmtoken) {
|
||||
int length = nmtoken.length();
|
||||
if (length == 0)
|
||||
return false;
|
||||
for (int i = 0; i < length; i++) {
|
||||
char ch = nmtoken.charAt(i);
|
||||
if (!isXML11Name(ch))
|
||||
if (++i < length && isXML11NameHighSurrogate(ch)) {
|
||||
char ch2 = nmtoken.charAt(i);
|
||||
if (!XMLChar.isLowSurrogate(ch2) || !isXML11Name(XMLChar.supplemental(ch, ch2)))
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,781 @@
|
|||
package org.apache.xml.serializer.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class XMLChar {
|
||||
private static final byte[] CHARS = new byte[65536];
|
||||
|
||||
public static final int MASK_VALID = 1;
|
||||
|
||||
public static final int MASK_SPACE = 2;
|
||||
|
||||
public static final int MASK_NAME_START = 4;
|
||||
|
||||
public static final int MASK_NAME = 8;
|
||||
|
||||
public static final int MASK_PUBID = 16;
|
||||
|
||||
public static final int MASK_CONTENT = 32;
|
||||
|
||||
public static final int MASK_NCNAME_START = 64;
|
||||
|
||||
public static final int MASK_NCNAME = 128;
|
||||
|
||||
static {
|
||||
CHARS[9] = 35;
|
||||
CHARS[10] = 19;
|
||||
CHARS[13] = 19;
|
||||
CHARS[32] = 51;
|
||||
CHARS[33] = 49;
|
||||
CHARS[34] = 33;
|
||||
Arrays.fill(CHARS, 35, 38, (byte)49);
|
||||
CHARS[38] = 1;
|
||||
Arrays.fill(CHARS, 39, 45, (byte)49);
|
||||
Arrays.fill(CHARS, 45, 47, (byte)-71);
|
||||
CHARS[47] = 49;
|
||||
Arrays.fill(CHARS, 48, 58, (byte)-71);
|
||||
CHARS[58] = 61;
|
||||
CHARS[59] = 49;
|
||||
CHARS[60] = 1;
|
||||
CHARS[61] = 49;
|
||||
CHARS[62] = 33;
|
||||
Arrays.fill(CHARS, 63, 65, (byte)49);
|
||||
Arrays.fill(CHARS, 65, 91, (byte)-3);
|
||||
Arrays.fill(CHARS, 91, 93, (byte)33);
|
||||
CHARS[93] = 1;
|
||||
CHARS[94] = 33;
|
||||
CHARS[95] = -3;
|
||||
CHARS[96] = 33;
|
||||
Arrays.fill(CHARS, 97, 123, (byte)-3);
|
||||
Arrays.fill(CHARS, 123, 183, (byte)33);
|
||||
CHARS[183] = -87;
|
||||
Arrays.fill(CHARS, 184, 192, (byte)33);
|
||||
Arrays.fill(CHARS, 192, 215, (byte)-19);
|
||||
CHARS[215] = 33;
|
||||
Arrays.fill(CHARS, 216, 247, (byte)-19);
|
||||
CHARS[247] = 33;
|
||||
Arrays.fill(CHARS, 248, 306, (byte)-19);
|
||||
Arrays.fill(CHARS, 306, 308, (byte)33);
|
||||
Arrays.fill(CHARS, 308, 319, (byte)-19);
|
||||
Arrays.fill(CHARS, 319, 321, (byte)33);
|
||||
Arrays.fill(CHARS, 321, 329, (byte)-19);
|
||||
CHARS[329] = 33;
|
||||
Arrays.fill(CHARS, 330, 383, (byte)-19);
|
||||
CHARS[383] = 33;
|
||||
Arrays.fill(CHARS, 384, 452, (byte)-19);
|
||||
Arrays.fill(CHARS, 452, 461, (byte)33);
|
||||
Arrays.fill(CHARS, 461, 497, (byte)-19);
|
||||
Arrays.fill(CHARS, 497, 500, (byte)33);
|
||||
Arrays.fill(CHARS, 500, 502, (byte)-19);
|
||||
Arrays.fill(CHARS, 502, 506, (byte)33);
|
||||
Arrays.fill(CHARS, 506, 536, (byte)-19);
|
||||
Arrays.fill(CHARS, 536, 592, (byte)33);
|
||||
Arrays.fill(CHARS, 592, 681, (byte)-19);
|
||||
Arrays.fill(CHARS, 681, 699, (byte)33);
|
||||
Arrays.fill(CHARS, 699, 706, (byte)-19);
|
||||
Arrays.fill(CHARS, 706, 720, (byte)33);
|
||||
Arrays.fill(CHARS, 720, 722, (byte)-87);
|
||||
Arrays.fill(CHARS, 722, 768, (byte)33);
|
||||
Arrays.fill(CHARS, 768, 838, (byte)-87);
|
||||
Arrays.fill(CHARS, 838, 864, (byte)33);
|
||||
Arrays.fill(CHARS, 864, 866, (byte)-87);
|
||||
Arrays.fill(CHARS, 866, 902, (byte)33);
|
||||
CHARS[902] = -19;
|
||||
CHARS[903] = -87;
|
||||
Arrays.fill(CHARS, 904, 907, (byte)-19);
|
||||
CHARS[907] = 33;
|
||||
CHARS[908] = -19;
|
||||
CHARS[909] = 33;
|
||||
Arrays.fill(CHARS, 910, 930, (byte)-19);
|
||||
CHARS[930] = 33;
|
||||
Arrays.fill(CHARS, 931, 975, (byte)-19);
|
||||
CHARS[975] = 33;
|
||||
Arrays.fill(CHARS, 976, 983, (byte)-19);
|
||||
Arrays.fill(CHARS, 983, 986, (byte)33);
|
||||
CHARS[986] = -19;
|
||||
CHARS[987] = 33;
|
||||
CHARS[988] = -19;
|
||||
CHARS[989] = 33;
|
||||
CHARS[990] = -19;
|
||||
CHARS[991] = 33;
|
||||
CHARS[992] = -19;
|
||||
CHARS[993] = 33;
|
||||
Arrays.fill(CHARS, 994, 1012, (byte)-19);
|
||||
Arrays.fill(CHARS, 1012, 1025, (byte)33);
|
||||
Arrays.fill(CHARS, 1025, 1037, (byte)-19);
|
||||
CHARS[1037] = 33;
|
||||
Arrays.fill(CHARS, 1038, 1104, (byte)-19);
|
||||
CHARS[1104] = 33;
|
||||
Arrays.fill(CHARS, 1105, 1117, (byte)-19);
|
||||
CHARS[1117] = 33;
|
||||
Arrays.fill(CHARS, 1118, 1154, (byte)-19);
|
||||
CHARS[1154] = 33;
|
||||
Arrays.fill(CHARS, 1155, 1159, (byte)-87);
|
||||
Arrays.fill(CHARS, 1159, 1168, (byte)33);
|
||||
Arrays.fill(CHARS, 1168, 1221, (byte)-19);
|
||||
Arrays.fill(CHARS, 1221, 1223, (byte)33);
|
||||
Arrays.fill(CHARS, 1223, 1225, (byte)-19);
|
||||
Arrays.fill(CHARS, 1225, 1227, (byte)33);
|
||||
Arrays.fill(CHARS, 1227, 1229, (byte)-19);
|
||||
Arrays.fill(CHARS, 1229, 1232, (byte)33);
|
||||
Arrays.fill(CHARS, 1232, 1260, (byte)-19);
|
||||
Arrays.fill(CHARS, 1260, 1262, (byte)33);
|
||||
Arrays.fill(CHARS, 1262, 1270, (byte)-19);
|
||||
Arrays.fill(CHARS, 1270, 1272, (byte)33);
|
||||
Arrays.fill(CHARS, 1272, 1274, (byte)-19);
|
||||
Arrays.fill(CHARS, 1274, 1329, (byte)33);
|
||||
Arrays.fill(CHARS, 1329, 1367, (byte)-19);
|
||||
Arrays.fill(CHARS, 1367, 1369, (byte)33);
|
||||
CHARS[1369] = -19;
|
||||
Arrays.fill(CHARS, 1370, 1377, (byte)33);
|
||||
Arrays.fill(CHARS, 1377, 1415, (byte)-19);
|
||||
Arrays.fill(CHARS, 1415, 1425, (byte)33);
|
||||
Arrays.fill(CHARS, 1425, 1442, (byte)-87);
|
||||
CHARS[1442] = 33;
|
||||
Arrays.fill(CHARS, 1443, 1466, (byte)-87);
|
||||
CHARS[1466] = 33;
|
||||
Arrays.fill(CHARS, 1467, 1470, (byte)-87);
|
||||
CHARS[1470] = 33;
|
||||
CHARS[1471] = -87;
|
||||
CHARS[1472] = 33;
|
||||
Arrays.fill(CHARS, 1473, 1475, (byte)-87);
|
||||
CHARS[1475] = 33;
|
||||
CHARS[1476] = -87;
|
||||
Arrays.fill(CHARS, 1477, 1488, (byte)33);
|
||||
Arrays.fill(CHARS, 1488, 1515, (byte)-19);
|
||||
Arrays.fill(CHARS, 1515, 1520, (byte)33);
|
||||
Arrays.fill(CHARS, 1520, 1523, (byte)-19);
|
||||
Arrays.fill(CHARS, 1523, 1569, (byte)33);
|
||||
Arrays.fill(CHARS, 1569, 1595, (byte)-19);
|
||||
Arrays.fill(CHARS, 1595, 1600, (byte)33);
|
||||
CHARS[1600] = -87;
|
||||
Arrays.fill(CHARS, 1601, 1611, (byte)-19);
|
||||
Arrays.fill(CHARS, 1611, 1619, (byte)-87);
|
||||
Arrays.fill(CHARS, 1619, 1632, (byte)33);
|
||||
Arrays.fill(CHARS, 1632, 1642, (byte)-87);
|
||||
Arrays.fill(CHARS, 1642, 1648, (byte)33);
|
||||
CHARS[1648] = -87;
|
||||
Arrays.fill(CHARS, 1649, 1720, (byte)-19);
|
||||
Arrays.fill(CHARS, 1720, 1722, (byte)33);
|
||||
Arrays.fill(CHARS, 1722, 1727, (byte)-19);
|
||||
CHARS[1727] = 33;
|
||||
Arrays.fill(CHARS, 1728, 1743, (byte)-19);
|
||||
CHARS[1743] = 33;
|
||||
Arrays.fill(CHARS, 1744, 1748, (byte)-19);
|
||||
CHARS[1748] = 33;
|
||||
CHARS[1749] = -19;
|
||||
Arrays.fill(CHARS, 1750, 1765, (byte)-87);
|
||||
Arrays.fill(CHARS, 1765, 1767, (byte)-19);
|
||||
Arrays.fill(CHARS, 1767, 1769, (byte)-87);
|
||||
CHARS[1769] = 33;
|
||||
Arrays.fill(CHARS, 1770, 1774, (byte)-87);
|
||||
Arrays.fill(CHARS, 1774, 1776, (byte)33);
|
||||
Arrays.fill(CHARS, 1776, 1786, (byte)-87);
|
||||
Arrays.fill(CHARS, 1786, 2305, (byte)33);
|
||||
Arrays.fill(CHARS, 2305, 2308, (byte)-87);
|
||||
CHARS[2308] = 33;
|
||||
Arrays.fill(CHARS, 2309, 2362, (byte)-19);
|
||||
Arrays.fill(CHARS, 2362, 2364, (byte)33);
|
||||
CHARS[2364] = -87;
|
||||
CHARS[2365] = -19;
|
||||
Arrays.fill(CHARS, 2366, 2382, (byte)-87);
|
||||
Arrays.fill(CHARS, 2382, 2385, (byte)33);
|
||||
Arrays.fill(CHARS, 2385, 2389, (byte)-87);
|
||||
Arrays.fill(CHARS, 2389, 2392, (byte)33);
|
||||
Arrays.fill(CHARS, 2392, 2402, (byte)-19);
|
||||
Arrays.fill(CHARS, 2402, 2404, (byte)-87);
|
||||
Arrays.fill(CHARS, 2404, 2406, (byte)33);
|
||||
Arrays.fill(CHARS, 2406, 2416, (byte)-87);
|
||||
Arrays.fill(CHARS, 2416, 2433, (byte)33);
|
||||
Arrays.fill(CHARS, 2433, 2436, (byte)-87);
|
||||
CHARS[2436] = 33;
|
||||
Arrays.fill(CHARS, 2437, 2445, (byte)-19);
|
||||
Arrays.fill(CHARS, 2445, 2447, (byte)33);
|
||||
Arrays.fill(CHARS, 2447, 2449, (byte)-19);
|
||||
Arrays.fill(CHARS, 2449, 2451, (byte)33);
|
||||
Arrays.fill(CHARS, 2451, 2473, (byte)-19);
|
||||
CHARS[2473] = 33;
|
||||
Arrays.fill(CHARS, 2474, 2481, (byte)-19);
|
||||
CHARS[2481] = 33;
|
||||
CHARS[2482] = -19;
|
||||
Arrays.fill(CHARS, 2483, 2486, (byte)33);
|
||||
Arrays.fill(CHARS, 2486, 2490, (byte)-19);
|
||||
Arrays.fill(CHARS, 2490, 2492, (byte)33);
|
||||
CHARS[2492] = -87;
|
||||
CHARS[2493] = 33;
|
||||
Arrays.fill(CHARS, 2494, 2501, (byte)-87);
|
||||
Arrays.fill(CHARS, 2501, 2503, (byte)33);
|
||||
Arrays.fill(CHARS, 2503, 2505, (byte)-87);
|
||||
Arrays.fill(CHARS, 2505, 2507, (byte)33);
|
||||
Arrays.fill(CHARS, 2507, 2510, (byte)-87);
|
||||
Arrays.fill(CHARS, 2510, 2519, (byte)33);
|
||||
CHARS[2519] = -87;
|
||||
Arrays.fill(CHARS, 2520, 2524, (byte)33);
|
||||
Arrays.fill(CHARS, 2524, 2526, (byte)-19);
|
||||
CHARS[2526] = 33;
|
||||
Arrays.fill(CHARS, 2527, 2530, (byte)-19);
|
||||
Arrays.fill(CHARS, 2530, 2532, (byte)-87);
|
||||
Arrays.fill(CHARS, 2532, 2534, (byte)33);
|
||||
Arrays.fill(CHARS, 2534, 2544, (byte)-87);
|
||||
Arrays.fill(CHARS, 2544, 2546, (byte)-19);
|
||||
Arrays.fill(CHARS, 2546, 2562, (byte)33);
|
||||
CHARS[2562] = -87;
|
||||
Arrays.fill(CHARS, 2563, 2565, (byte)33);
|
||||
Arrays.fill(CHARS, 2565, 2571, (byte)-19);
|
||||
Arrays.fill(CHARS, 2571, 2575, (byte)33);
|
||||
Arrays.fill(CHARS, 2575, 2577, (byte)-19);
|
||||
Arrays.fill(CHARS, 2577, 2579, (byte)33);
|
||||
Arrays.fill(CHARS, 2579, 2601, (byte)-19);
|
||||
CHARS[2601] = 33;
|
||||
Arrays.fill(CHARS, 2602, 2609, (byte)-19);
|
||||
CHARS[2609] = 33;
|
||||
Arrays.fill(CHARS, 2610, 2612, (byte)-19);
|
||||
CHARS[2612] = 33;
|
||||
Arrays.fill(CHARS, 2613, 2615, (byte)-19);
|
||||
CHARS[2615] = 33;
|
||||
Arrays.fill(CHARS, 2616, 2618, (byte)-19);
|
||||
Arrays.fill(CHARS, 2618, 2620, (byte)33);
|
||||
CHARS[2620] = -87;
|
||||
CHARS[2621] = 33;
|
||||
Arrays.fill(CHARS, 2622, 2627, (byte)-87);
|
||||
Arrays.fill(CHARS, 2627, 2631, (byte)33);
|
||||
Arrays.fill(CHARS, 2631, 2633, (byte)-87);
|
||||
Arrays.fill(CHARS, 2633, 2635, (byte)33);
|
||||
Arrays.fill(CHARS, 2635, 2638, (byte)-87);
|
||||
Arrays.fill(CHARS, 2638, 2649, (byte)33);
|
||||
Arrays.fill(CHARS, 2649, 2653, (byte)-19);
|
||||
CHARS[2653] = 33;
|
||||
CHARS[2654] = -19;
|
||||
Arrays.fill(CHARS, 2655, 2662, (byte)33);
|
||||
Arrays.fill(CHARS, 2662, 2674, (byte)-87);
|
||||
Arrays.fill(CHARS, 2674, 2677, (byte)-19);
|
||||
Arrays.fill(CHARS, 2677, 2689, (byte)33);
|
||||
Arrays.fill(CHARS, 2689, 2692, (byte)-87);
|
||||
CHARS[2692] = 33;
|
||||
Arrays.fill(CHARS, 2693, 2700, (byte)-19);
|
||||
CHARS[2700] = 33;
|
||||
CHARS[2701] = -19;
|
||||
CHARS[2702] = 33;
|
||||
Arrays.fill(CHARS, 2703, 2706, (byte)-19);
|
||||
CHARS[2706] = 33;
|
||||
Arrays.fill(CHARS, 2707, 2729, (byte)-19);
|
||||
CHARS[2729] = 33;
|
||||
Arrays.fill(CHARS, 2730, 2737, (byte)-19);
|
||||
CHARS[2737] = 33;
|
||||
Arrays.fill(CHARS, 2738, 2740, (byte)-19);
|
||||
CHARS[2740] = 33;
|
||||
Arrays.fill(CHARS, 2741, 2746, (byte)-19);
|
||||
Arrays.fill(CHARS, 2746, 2748, (byte)33);
|
||||
CHARS[2748] = -87;
|
||||
CHARS[2749] = -19;
|
||||
Arrays.fill(CHARS, 2750, 2758, (byte)-87);
|
||||
CHARS[2758] = 33;
|
||||
Arrays.fill(CHARS, 2759, 2762, (byte)-87);
|
||||
CHARS[2762] = 33;
|
||||
Arrays.fill(CHARS, 2763, 2766, (byte)-87);
|
||||
Arrays.fill(CHARS, 2766, 2784, (byte)33);
|
||||
CHARS[2784] = -19;
|
||||
Arrays.fill(CHARS, 2785, 2790, (byte)33);
|
||||
Arrays.fill(CHARS, 2790, 2800, (byte)-87);
|
||||
Arrays.fill(CHARS, 2800, 2817, (byte)33);
|
||||
Arrays.fill(CHARS, 2817, 2820, (byte)-87);
|
||||
CHARS[2820] = 33;
|
||||
Arrays.fill(CHARS, 2821, 2829, (byte)-19);
|
||||
Arrays.fill(CHARS, 2829, 2831, (byte)33);
|
||||
Arrays.fill(CHARS, 2831, 2833, (byte)-19);
|
||||
Arrays.fill(CHARS, 2833, 2835, (byte)33);
|
||||
Arrays.fill(CHARS, 2835, 2857, (byte)-19);
|
||||
CHARS[2857] = 33;
|
||||
Arrays.fill(CHARS, 2858, 2865, (byte)-19);
|
||||
CHARS[2865] = 33;
|
||||
Arrays.fill(CHARS, 2866, 2868, (byte)-19);
|
||||
Arrays.fill(CHARS, 2868, 2870, (byte)33);
|
||||
Arrays.fill(CHARS, 2870, 2874, (byte)-19);
|
||||
Arrays.fill(CHARS, 2874, 2876, (byte)33);
|
||||
CHARS[2876] = -87;
|
||||
CHARS[2877] = -19;
|
||||
Arrays.fill(CHARS, 2878, 2884, (byte)-87);
|
||||
Arrays.fill(CHARS, 2884, 2887, (byte)33);
|
||||
Arrays.fill(CHARS, 2887, 2889, (byte)-87);
|
||||
Arrays.fill(CHARS, 2889, 2891, (byte)33);
|
||||
Arrays.fill(CHARS, 2891, 2894, (byte)-87);
|
||||
Arrays.fill(CHARS, 2894, 2902, (byte)33);
|
||||
Arrays.fill(CHARS, 2902, 2904, (byte)-87);
|
||||
Arrays.fill(CHARS, 2904, 2908, (byte)33);
|
||||
Arrays.fill(CHARS, 2908, 2910, (byte)-19);
|
||||
CHARS[2910] = 33;
|
||||
Arrays.fill(CHARS, 2911, 2914, (byte)-19);
|
||||
Arrays.fill(CHARS, 2914, 2918, (byte)33);
|
||||
Arrays.fill(CHARS, 2918, 2928, (byte)-87);
|
||||
Arrays.fill(CHARS, 2928, 2946, (byte)33);
|
||||
Arrays.fill(CHARS, 2946, 2948, (byte)-87);
|
||||
CHARS[2948] = 33;
|
||||
Arrays.fill(CHARS, 2949, 2955, (byte)-19);
|
||||
Arrays.fill(CHARS, 2955, 2958, (byte)33);
|
||||
Arrays.fill(CHARS, 2958, 2961, (byte)-19);
|
||||
CHARS[2961] = 33;
|
||||
Arrays.fill(CHARS, 2962, 2966, (byte)-19);
|
||||
Arrays.fill(CHARS, 2966, 2969, (byte)33);
|
||||
Arrays.fill(CHARS, 2969, 2971, (byte)-19);
|
||||
CHARS[2971] = 33;
|
||||
CHARS[2972] = -19;
|
||||
CHARS[2973] = 33;
|
||||
Arrays.fill(CHARS, 2974, 2976, (byte)-19);
|
||||
Arrays.fill(CHARS, 2976, 2979, (byte)33);
|
||||
Arrays.fill(CHARS, 2979, 2981, (byte)-19);
|
||||
Arrays.fill(CHARS, 2981, 2984, (byte)33);
|
||||
Arrays.fill(CHARS, 2984, 2987, (byte)-19);
|
||||
Arrays.fill(CHARS, 2987, 2990, (byte)33);
|
||||
Arrays.fill(CHARS, 2990, 2998, (byte)-19);
|
||||
CHARS[2998] = 33;
|
||||
Arrays.fill(CHARS, 2999, 3002, (byte)-19);
|
||||
Arrays.fill(CHARS, 3002, 3006, (byte)33);
|
||||
Arrays.fill(CHARS, 3006, 3011, (byte)-87);
|
||||
Arrays.fill(CHARS, 3011, 3014, (byte)33);
|
||||
Arrays.fill(CHARS, 3014, 3017, (byte)-87);
|
||||
CHARS[3017] = 33;
|
||||
Arrays.fill(CHARS, 3018, 3022, (byte)-87);
|
||||
Arrays.fill(CHARS, 3022, 3031, (byte)33);
|
||||
CHARS[3031] = -87;
|
||||
Arrays.fill(CHARS, 3032, 3047, (byte)33);
|
||||
Arrays.fill(CHARS, 3047, 3056, (byte)-87);
|
||||
Arrays.fill(CHARS, 3056, 3073, (byte)33);
|
||||
Arrays.fill(CHARS, 3073, 3076, (byte)-87);
|
||||
CHARS[3076] = 33;
|
||||
Arrays.fill(CHARS, 3077, 3085, (byte)-19);
|
||||
CHARS[3085] = 33;
|
||||
Arrays.fill(CHARS, 3086, 3089, (byte)-19);
|
||||
CHARS[3089] = 33;
|
||||
Arrays.fill(CHARS, 3090, 3113, (byte)-19);
|
||||
CHARS[3113] = 33;
|
||||
Arrays.fill(CHARS, 3114, 3124, (byte)-19);
|
||||
CHARS[3124] = 33;
|
||||
Arrays.fill(CHARS, 3125, 3130, (byte)-19);
|
||||
Arrays.fill(CHARS, 3130, 3134, (byte)33);
|
||||
Arrays.fill(CHARS, 3134, 3141, (byte)-87);
|
||||
CHARS[3141] = 33;
|
||||
Arrays.fill(CHARS, 3142, 3145, (byte)-87);
|
||||
CHARS[3145] = 33;
|
||||
Arrays.fill(CHARS, 3146, 3150, (byte)-87);
|
||||
Arrays.fill(CHARS, 3150, 3157, (byte)33);
|
||||
Arrays.fill(CHARS, 3157, 3159, (byte)-87);
|
||||
Arrays.fill(CHARS, 3159, 3168, (byte)33);
|
||||
Arrays.fill(CHARS, 3168, 3170, (byte)-19);
|
||||
Arrays.fill(CHARS, 3170, 3174, (byte)33);
|
||||
Arrays.fill(CHARS, 3174, 3184, (byte)-87);
|
||||
Arrays.fill(CHARS, 3184, 3202, (byte)33);
|
||||
Arrays.fill(CHARS, 3202, 3204, (byte)-87);
|
||||
CHARS[3204] = 33;
|
||||
Arrays.fill(CHARS, 3205, 3213, (byte)-19);
|
||||
CHARS[3213] = 33;
|
||||
Arrays.fill(CHARS, 3214, 3217, (byte)-19);
|
||||
CHARS[3217] = 33;
|
||||
Arrays.fill(CHARS, 3218, 3241, (byte)-19);
|
||||
CHARS[3241] = 33;
|
||||
Arrays.fill(CHARS, 3242, 3252, (byte)-19);
|
||||
CHARS[3252] = 33;
|
||||
Arrays.fill(CHARS, 3253, 3258, (byte)-19);
|
||||
Arrays.fill(CHARS, 3258, 3262, (byte)33);
|
||||
Arrays.fill(CHARS, 3262, 3269, (byte)-87);
|
||||
CHARS[3269] = 33;
|
||||
Arrays.fill(CHARS, 3270, 3273, (byte)-87);
|
||||
CHARS[3273] = 33;
|
||||
Arrays.fill(CHARS, 3274, 3278, (byte)-87);
|
||||
Arrays.fill(CHARS, 3278, 3285, (byte)33);
|
||||
Arrays.fill(CHARS, 3285, 3287, (byte)-87);
|
||||
Arrays.fill(CHARS, 3287, 3294, (byte)33);
|
||||
CHARS[3294] = -19;
|
||||
CHARS[3295] = 33;
|
||||
Arrays.fill(CHARS, 3296, 3298, (byte)-19);
|
||||
Arrays.fill(CHARS, 3298, 3302, (byte)33);
|
||||
Arrays.fill(CHARS, 3302, 3312, (byte)-87);
|
||||
Arrays.fill(CHARS, 3312, 3330, (byte)33);
|
||||
Arrays.fill(CHARS, 3330, 3332, (byte)-87);
|
||||
CHARS[3332] = 33;
|
||||
Arrays.fill(CHARS, 3333, 3341, (byte)-19);
|
||||
CHARS[3341] = 33;
|
||||
Arrays.fill(CHARS, 3342, 3345, (byte)-19);
|
||||
CHARS[3345] = 33;
|
||||
Arrays.fill(CHARS, 3346, 3369, (byte)-19);
|
||||
CHARS[3369] = 33;
|
||||
Arrays.fill(CHARS, 3370, 3386, (byte)-19);
|
||||
Arrays.fill(CHARS, 3386, 3390, (byte)33);
|
||||
Arrays.fill(CHARS, 3390, 3396, (byte)-87);
|
||||
Arrays.fill(CHARS, 3396, 3398, (byte)33);
|
||||
Arrays.fill(CHARS, 3398, 3401, (byte)-87);
|
||||
CHARS[3401] = 33;
|
||||
Arrays.fill(CHARS, 3402, 3406, (byte)-87);
|
||||
Arrays.fill(CHARS, 3406, 3415, (byte)33);
|
||||
CHARS[3415] = -87;
|
||||
Arrays.fill(CHARS, 3416, 3424, (byte)33);
|
||||
Arrays.fill(CHARS, 3424, 3426, (byte)-19);
|
||||
Arrays.fill(CHARS, 3426, 3430, (byte)33);
|
||||
Arrays.fill(CHARS, 3430, 3440, (byte)-87);
|
||||
Arrays.fill(CHARS, 3440, 3585, (byte)33);
|
||||
Arrays.fill(CHARS, 3585, 3631, (byte)-19);
|
||||
CHARS[3631] = 33;
|
||||
CHARS[3632] = -19;
|
||||
CHARS[3633] = -87;
|
||||
Arrays.fill(CHARS, 3634, 3636, (byte)-19);
|
||||
Arrays.fill(CHARS, 3636, 3643, (byte)-87);
|
||||
Arrays.fill(CHARS, 3643, 3648, (byte)33);
|
||||
Arrays.fill(CHARS, 3648, 3654, (byte)-19);
|
||||
Arrays.fill(CHARS, 3654, 3663, (byte)-87);
|
||||
CHARS[3663] = 33;
|
||||
Arrays.fill(CHARS, 3664, 3674, (byte)-87);
|
||||
Arrays.fill(CHARS, 3674, 3713, (byte)33);
|
||||
Arrays.fill(CHARS, 3713, 3715, (byte)-19);
|
||||
CHARS[3715] = 33;
|
||||
CHARS[3716] = -19;
|
||||
Arrays.fill(CHARS, 3717, 3719, (byte)33);
|
||||
Arrays.fill(CHARS, 3719, 3721, (byte)-19);
|
||||
CHARS[3721] = 33;
|
||||
CHARS[3722] = -19;
|
||||
Arrays.fill(CHARS, 3723, 3725, (byte)33);
|
||||
CHARS[3725] = -19;
|
||||
Arrays.fill(CHARS, 3726, 3732, (byte)33);
|
||||
Arrays.fill(CHARS, 3732, 3736, (byte)-19);
|
||||
CHARS[3736] = 33;
|
||||
Arrays.fill(CHARS, 3737, 3744, (byte)-19);
|
||||
CHARS[3744] = 33;
|
||||
Arrays.fill(CHARS, 3745, 3748, (byte)-19);
|
||||
CHARS[3748] = 33;
|
||||
CHARS[3749] = -19;
|
||||
CHARS[3750] = 33;
|
||||
CHARS[3751] = -19;
|
||||
Arrays.fill(CHARS, 3752, 3754, (byte)33);
|
||||
Arrays.fill(CHARS, 3754, 3756, (byte)-19);
|
||||
CHARS[3756] = 33;
|
||||
Arrays.fill(CHARS, 3757, 3759, (byte)-19);
|
||||
CHARS[3759] = 33;
|
||||
CHARS[3760] = -19;
|
||||
CHARS[3761] = -87;
|
||||
Arrays.fill(CHARS, 3762, 3764, (byte)-19);
|
||||
Arrays.fill(CHARS, 3764, 3770, (byte)-87);
|
||||
CHARS[3770] = 33;
|
||||
Arrays.fill(CHARS, 3771, 3773, (byte)-87);
|
||||
CHARS[3773] = -19;
|
||||
Arrays.fill(CHARS, 3774, 3776, (byte)33);
|
||||
Arrays.fill(CHARS, 3776, 3781, (byte)-19);
|
||||
CHARS[3781] = 33;
|
||||
CHARS[3782] = -87;
|
||||
CHARS[3783] = 33;
|
||||
Arrays.fill(CHARS, 3784, 3790, (byte)-87);
|
||||
Arrays.fill(CHARS, 3790, 3792, (byte)33);
|
||||
Arrays.fill(CHARS, 3792, 3802, (byte)-87);
|
||||
Arrays.fill(CHARS, 3802, 3864, (byte)33);
|
||||
Arrays.fill(CHARS, 3864, 3866, (byte)-87);
|
||||
Arrays.fill(CHARS, 3866, 3872, (byte)33);
|
||||
Arrays.fill(CHARS, 3872, 3882, (byte)-87);
|
||||
Arrays.fill(CHARS, 3882, 3893, (byte)33);
|
||||
CHARS[3893] = -87;
|
||||
CHARS[3894] = 33;
|
||||
CHARS[3895] = -87;
|
||||
CHARS[3896] = 33;
|
||||
CHARS[3897] = -87;
|
||||
Arrays.fill(CHARS, 3898, 3902, (byte)33);
|
||||
Arrays.fill(CHARS, 3902, 3904, (byte)-87);
|
||||
Arrays.fill(CHARS, 3904, 3912, (byte)-19);
|
||||
CHARS[3912] = 33;
|
||||
Arrays.fill(CHARS, 3913, 3946, (byte)-19);
|
||||
Arrays.fill(CHARS, 3946, 3953, (byte)33);
|
||||
Arrays.fill(CHARS, 3953, 3973, (byte)-87);
|
||||
CHARS[3973] = 33;
|
||||
Arrays.fill(CHARS, 3974, 3980, (byte)-87);
|
||||
Arrays.fill(CHARS, 3980, 3984, (byte)33);
|
||||
Arrays.fill(CHARS, 3984, 3990, (byte)-87);
|
||||
CHARS[3990] = 33;
|
||||
CHARS[3991] = -87;
|
||||
CHARS[3992] = 33;
|
||||
Arrays.fill(CHARS, 3993, 4014, (byte)-87);
|
||||
Arrays.fill(CHARS, 4014, 4017, (byte)33);
|
||||
Arrays.fill(CHARS, 4017, 4024, (byte)-87);
|
||||
CHARS[4024] = 33;
|
||||
CHARS[4025] = -87;
|
||||
Arrays.fill(CHARS, 4026, 4256, (byte)33);
|
||||
Arrays.fill(CHARS, 4256, 4294, (byte)-19);
|
||||
Arrays.fill(CHARS, 4294, 4304, (byte)33);
|
||||
Arrays.fill(CHARS, 4304, 4343, (byte)-19);
|
||||
Arrays.fill(CHARS, 4343, 4352, (byte)33);
|
||||
CHARS[4352] = -19;
|
||||
CHARS[4353] = 33;
|
||||
Arrays.fill(CHARS, 4354, 4356, (byte)-19);
|
||||
CHARS[4356] = 33;
|
||||
Arrays.fill(CHARS, 4357, 4360, (byte)-19);
|
||||
CHARS[4360] = 33;
|
||||
CHARS[4361] = -19;
|
||||
CHARS[4362] = 33;
|
||||
Arrays.fill(CHARS, 4363, 4365, (byte)-19);
|
||||
CHARS[4365] = 33;
|
||||
Arrays.fill(CHARS, 4366, 4371, (byte)-19);
|
||||
Arrays.fill(CHARS, 4371, 4412, (byte)33);
|
||||
CHARS[4412] = -19;
|
||||
CHARS[4413] = 33;
|
||||
CHARS[4414] = -19;
|
||||
CHARS[4415] = 33;
|
||||
CHARS[4416] = -19;
|
||||
Arrays.fill(CHARS, 4417, 4428, (byte)33);
|
||||
CHARS[4428] = -19;
|
||||
CHARS[4429] = 33;
|
||||
CHARS[4430] = -19;
|
||||
CHARS[4431] = 33;
|
||||
CHARS[4432] = -19;
|
||||
Arrays.fill(CHARS, 4433, 4436, (byte)33);
|
||||
Arrays.fill(CHARS, 4436, 4438, (byte)-19);
|
||||
Arrays.fill(CHARS, 4438, 4441, (byte)33);
|
||||
CHARS[4441] = -19;
|
||||
Arrays.fill(CHARS, 4442, 4447, (byte)33);
|
||||
Arrays.fill(CHARS, 4447, 4450, (byte)-19);
|
||||
CHARS[4450] = 33;
|
||||
CHARS[4451] = -19;
|
||||
CHARS[4452] = 33;
|
||||
CHARS[4453] = -19;
|
||||
CHARS[4454] = 33;
|
||||
CHARS[4455] = -19;
|
||||
CHARS[4456] = 33;
|
||||
CHARS[4457] = -19;
|
||||
Arrays.fill(CHARS, 4458, 4461, (byte)33);
|
||||
Arrays.fill(CHARS, 4461, 4463, (byte)-19);
|
||||
Arrays.fill(CHARS, 4463, 4466, (byte)33);
|
||||
Arrays.fill(CHARS, 4466, 4468, (byte)-19);
|
||||
CHARS[4468] = 33;
|
||||
CHARS[4469] = -19;
|
||||
Arrays.fill(CHARS, 4470, 4510, (byte)33);
|
||||
CHARS[4510] = -19;
|
||||
Arrays.fill(CHARS, 4511, 4520, (byte)33);
|
||||
CHARS[4520] = -19;
|
||||
Arrays.fill(CHARS, 4521, 4523, (byte)33);
|
||||
CHARS[4523] = -19;
|
||||
Arrays.fill(CHARS, 4524, 4526, (byte)33);
|
||||
Arrays.fill(CHARS, 4526, 4528, (byte)-19);
|
||||
Arrays.fill(CHARS, 4528, 4535, (byte)33);
|
||||
Arrays.fill(CHARS, 4535, 4537, (byte)-19);
|
||||
CHARS[4537] = 33;
|
||||
CHARS[4538] = -19;
|
||||
CHARS[4539] = 33;
|
||||
Arrays.fill(CHARS, 4540, 4547, (byte)-19);
|
||||
Arrays.fill(CHARS, 4547, 4587, (byte)33);
|
||||
CHARS[4587] = -19;
|
||||
Arrays.fill(CHARS, 4588, 4592, (byte)33);
|
||||
CHARS[4592] = -19;
|
||||
Arrays.fill(CHARS, 4593, 4601, (byte)33);
|
||||
CHARS[4601] = -19;
|
||||
Arrays.fill(CHARS, 4602, 7680, (byte)33);
|
||||
Arrays.fill(CHARS, 7680, 7836, (byte)-19);
|
||||
Arrays.fill(CHARS, 7836, 7840, (byte)33);
|
||||
Arrays.fill(CHARS, 7840, 7930, (byte)-19);
|
||||
Arrays.fill(CHARS, 7930, 7936, (byte)33);
|
||||
Arrays.fill(CHARS, 7936, 7958, (byte)-19);
|
||||
Arrays.fill(CHARS, 7958, 7960, (byte)33);
|
||||
Arrays.fill(CHARS, 7960, 7966, (byte)-19);
|
||||
Arrays.fill(CHARS, 7966, 7968, (byte)33);
|
||||
Arrays.fill(CHARS, 7968, 8006, (byte)-19);
|
||||
Arrays.fill(CHARS, 8006, 8008, (byte)33);
|
||||
Arrays.fill(CHARS, 8008, 8014, (byte)-19);
|
||||
Arrays.fill(CHARS, 8014, 8016, (byte)33);
|
||||
Arrays.fill(CHARS, 8016, 8024, (byte)-19);
|
||||
CHARS[8024] = 33;
|
||||
CHARS[8025] = -19;
|
||||
CHARS[8026] = 33;
|
||||
CHARS[8027] = -19;
|
||||
CHARS[8028] = 33;
|
||||
CHARS[8029] = -19;
|
||||
CHARS[8030] = 33;
|
||||
Arrays.fill(CHARS, 8031, 8062, (byte)-19);
|
||||
Arrays.fill(CHARS, 8062, 8064, (byte)33);
|
||||
Arrays.fill(CHARS, 8064, 8117, (byte)-19);
|
||||
CHARS[8117] = 33;
|
||||
Arrays.fill(CHARS, 8118, 8125, (byte)-19);
|
||||
CHARS[8125] = 33;
|
||||
CHARS[8126] = -19;
|
||||
Arrays.fill(CHARS, 8127, 8130, (byte)33);
|
||||
Arrays.fill(CHARS, 8130, 8133, (byte)-19);
|
||||
CHARS[8133] = 33;
|
||||
Arrays.fill(CHARS, 8134, 8141, (byte)-19);
|
||||
Arrays.fill(CHARS, 8141, 8144, (byte)33);
|
||||
Arrays.fill(CHARS, 8144, 8148, (byte)-19);
|
||||
Arrays.fill(CHARS, 8148, 8150, (byte)33);
|
||||
Arrays.fill(CHARS, 8150, 8156, (byte)-19);
|
||||
Arrays.fill(CHARS, 8156, 8160, (byte)33);
|
||||
Arrays.fill(CHARS, 8160, 8173, (byte)-19);
|
||||
Arrays.fill(CHARS, 8173, 8178, (byte)33);
|
||||
Arrays.fill(CHARS, 8178, 8181, (byte)-19);
|
||||
CHARS[8181] = 33;
|
||||
Arrays.fill(CHARS, 8182, 8189, (byte)-19);
|
||||
Arrays.fill(CHARS, 8189, 8400, (byte)33);
|
||||
Arrays.fill(CHARS, 8400, 8413, (byte)-87);
|
||||
Arrays.fill(CHARS, 8413, 8417, (byte)33);
|
||||
CHARS[8417] = -87;
|
||||
Arrays.fill(CHARS, 8418, 8486, (byte)33);
|
||||
CHARS[8486] = -19;
|
||||
Arrays.fill(CHARS, 8487, 8490, (byte)33);
|
||||
Arrays.fill(CHARS, 8490, 8492, (byte)-19);
|
||||
Arrays.fill(CHARS, 8492, 8494, (byte)33);
|
||||
CHARS[8494] = -19;
|
||||
Arrays.fill(CHARS, 8495, 8576, (byte)33);
|
||||
Arrays.fill(CHARS, 8576, 8579, (byte)-19);
|
||||
Arrays.fill(CHARS, 8579, 12293, (byte)33);
|
||||
CHARS[12293] = -87;
|
||||
CHARS[12294] = 33;
|
||||
CHARS[12295] = -19;
|
||||
Arrays.fill(CHARS, 12296, 12321, (byte)33);
|
||||
Arrays.fill(CHARS, 12321, 12330, (byte)-19);
|
||||
Arrays.fill(CHARS, 12330, 12336, (byte)-87);
|
||||
CHARS[12336] = 33;
|
||||
Arrays.fill(CHARS, 12337, 12342, (byte)-87);
|
||||
Arrays.fill(CHARS, 12342, 12353, (byte)33);
|
||||
Arrays.fill(CHARS, 12353, 12437, (byte)-19);
|
||||
Arrays.fill(CHARS, 12437, 12441, (byte)33);
|
||||
Arrays.fill(CHARS, 12441, 12443, (byte)-87);
|
||||
Arrays.fill(CHARS, 12443, 12445, (byte)33);
|
||||
Arrays.fill(CHARS, 12445, 12447, (byte)-87);
|
||||
Arrays.fill(CHARS, 12447, 12449, (byte)33);
|
||||
Arrays.fill(CHARS, 12449, 12539, (byte)-19);
|
||||
CHARS[12539] = 33;
|
||||
Arrays.fill(CHARS, 12540, 12543, (byte)-87);
|
||||
Arrays.fill(CHARS, 12543, 12549, (byte)33);
|
||||
Arrays.fill(CHARS, 12549, 12589, (byte)-19);
|
||||
Arrays.fill(CHARS, 12589, 19968, (byte)33);
|
||||
Arrays.fill(CHARS, 19968, 40870, (byte)-19);
|
||||
Arrays.fill(CHARS, 40870, 44032, (byte)33);
|
||||
Arrays.fill(CHARS, 44032, 55204, (byte)-19);
|
||||
Arrays.fill(CHARS, 55204, 55296, (byte)33);
|
||||
Arrays.fill(CHARS, 57344, 65534, (byte)33);
|
||||
}
|
||||
|
||||
public static boolean isSupplemental(int c) {
|
||||
return (c >= 65536 && c <= 1114111);
|
||||
}
|
||||
|
||||
public static int supplemental(char h, char l) {
|
||||
return (h - 55296) * 1024 + l - 56320 + 65536;
|
||||
}
|
||||
|
||||
public static char highSurrogate(int c) {
|
||||
return (char)((c - 65536 >> 10) + 55296);
|
||||
}
|
||||
|
||||
public static char lowSurrogate(int c) {
|
||||
return (char)((c - 65536 & 0x3FF) + 56320);
|
||||
}
|
||||
|
||||
public static boolean isHighSurrogate(int c) {
|
||||
return (55296 <= c && c <= 56319);
|
||||
}
|
||||
|
||||
public static boolean isLowSurrogate(int c) {
|
||||
return (56320 <= c && c <= 57343);
|
||||
}
|
||||
|
||||
public static boolean isValid(int c) {
|
||||
return ((c < 65536 && (CHARS[c] & 0x1) != 0) || (65536 <= c && c <= 1114111));
|
||||
}
|
||||
|
||||
public static boolean isInvalid(int c) {
|
||||
return !isValid(c);
|
||||
}
|
||||
|
||||
public static boolean isContent(int c) {
|
||||
return ((c < 65536 && (CHARS[c] & 0x20) != 0) || (65536 <= c && c <= 1114111));
|
||||
}
|
||||
|
||||
public static boolean isMarkup(int c) {
|
||||
return (c == 60 || c == 38 || c == 37);
|
||||
}
|
||||
|
||||
public static boolean isSpace(int c) {
|
||||
return (c <= 32 && (CHARS[c] & 0x2) != 0);
|
||||
}
|
||||
|
||||
public static boolean isNameStart(int c) {
|
||||
return (c < 65536 && (CHARS[c] & 0x4) != 0);
|
||||
}
|
||||
|
||||
public static boolean isName(int c) {
|
||||
return (c < 65536 && (CHARS[c] & 0x8) != 0);
|
||||
}
|
||||
|
||||
public static boolean isNCNameStart(int c) {
|
||||
return (c < 65536 && (CHARS[c] & 0x40) != 0);
|
||||
}
|
||||
|
||||
public static boolean isNCName(int c) {
|
||||
return (c < 65536 && (CHARS[c] & 0x80) != 0);
|
||||
}
|
||||
|
||||
public static boolean isPubid(int c) {
|
||||
return (c < 65536 && (CHARS[c] & 0x10) != 0);
|
||||
}
|
||||
|
||||
public static boolean isValidName(String name) {
|
||||
if (name.length() == 0)
|
||||
return false;
|
||||
char ch = name.charAt(0);
|
||||
if (!isNameStart(ch))
|
||||
return false;
|
||||
for (int i = 1; i < name.length(); i++) {
|
||||
ch = name.charAt(i);
|
||||
if (!isName(ch))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isValidNCName(String ncName) {
|
||||
if (ncName.length() == 0)
|
||||
return false;
|
||||
char ch = ncName.charAt(0);
|
||||
if (!isNCNameStart(ch))
|
||||
return false;
|
||||
for (int i = 1; i < ncName.length(); i++) {
|
||||
ch = ncName.charAt(i);
|
||||
if (!isNCName(ch))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isValidNmtoken(String nmtoken) {
|
||||
if (nmtoken.length() == 0)
|
||||
return false;
|
||||
for (int i = 0; i < nmtoken.length(); i++) {
|
||||
char ch = nmtoken.charAt(i);
|
||||
if (!isName(ch))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isValidIANAEncoding(String ianaEncoding) {
|
||||
if (ianaEncoding != null) {
|
||||
int length = ianaEncoding.length();
|
||||
if (length > 0) {
|
||||
char c = ianaEncoding.charAt(0);
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
|
||||
for (int i = 1; i < length; i++) {
|
||||
c = ianaEncoding.charAt(i);
|
||||
if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-')
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isValidJavaEncoding(String javaEncoding) {
|
||||
if (javaEncoding != null) {
|
||||
int length = javaEncoding.length();
|
||||
if (length > 0) {
|
||||
for (int i = 1; i < length; i++) {
|
||||
char c = javaEncoding.charAt(i);
|
||||
if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9') && c != '.' && c != '_' && c != '-')
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue