org.apache.xerces.util.XMLChar Java Examples
The following examples show how to use
org.apache.xerces.util.XMLChar.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultAdxDataService.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 6 votes |
private Map<String, Category> getCodeCategoryMap( CategoryCombo categoryCombo ) throws AdxException { Map<String, Category> categoryMap = new HashMap<>(); List<Category> categories = categoryCombo.getCategories(); for ( Category category : categories ) { String categoryCode = category.getCode(); if ( categoryCode == null || !XMLChar.isValidName( categoryCode ) ) { throw new AdxException( "Category code for " + category.getName() + " is missing or invalid: " + categoryCode ); } categoryMap.put( category.getCode(), category ); } return categoryMap; }
Example #2
Source File: DmozParser.java From nutch-htmlunit with Apache License 2.0 | 6 votes |
public int read(char[] cbuf, int off, int len) throws IOException { int n = in.read(cbuf, off, len); if (n != -1) { for (int i = 0; i < n; i++) { char c = cbuf[off+i]; char value = c; if (!(XMLChar.isValid(c))) // fix invalid characters value = 'X'; else if (lastBad && c == '<') { // fix mis-matched brackets if (i != n-1 && cbuf[off+i+1] != '/') value = 'X'; } lastBad = (c == 65533); cbuf[off+i] = value; } } return n; }
Example #3
Source File: DmozParser.java From anthelion with Apache License 2.0 | 6 votes |
public int read(char[] cbuf, int off, int len) throws IOException { int n = in.read(cbuf, off, len); if (n != -1) { for (int i = 0; i < n; i++) { char c = cbuf[off+i]; char value = c; if (!(XMLChar.isValid(c))) // fix invalid characters value = 'X'; else if (lastBad && c == '<') { // fix mis-matched brackets if (i != n-1 && cbuf[off+i+1] != '/') value = 'X'; } lastBad = (c == 65533); cbuf[off+i] = value; } } return n; }
Example #4
Source File: TmxScanner.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private boolean scanSurrogates(XMLStringBuffer buf) throws IOException { int high = entityScanner.scanChar(); int low = entityScanner.peekChar(); if (!XMLChar.isLowSurrogate(low)) { error("invalid char in content"); return false; } entityScanner.scanChar(); int c = XMLChar.supplemental((char) high, (char) low); // supplemental character must be a valid XML character if (XMLChar.isInvalid(c)) { error("invalid char in content"); return false; } // fill in the buffer buf.append((char) high); buf.append((char) low); return true; }
Example #5
Source File: TmxScanner.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private void scanCharReference() throws IOException { fStringBuffer2.clear(); boolean hex = entityScanner.peekChar() == 'x'; int ch = scanCharReferenceValue(fStringBuffer2, null); if (ch != -1) { int c = Integer.valueOf(fStringBuffer3.toString(), hex ? 16 : 10); if (c < 0x20 && !XMLChar.isSpace(c)) { return; } if (hex) {// appendCharacter("&x"); } else { appendCharacter("&"); } appendCharacter(fStringBuffer3.toString()); appendCharacter(";"); } else { appendCharacter("&#"); appendCharacter(fStringBuffer3.toString()); } }
Example #6
Source File: TmxScanner2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private boolean scanSurrogates(XMLStringBuffer buf) throws IOException, TmxEndEntityException { int high = entityScanner.scanChar(); int low = entityScanner.peekChar(); if (!XMLChar.isLowSurrogate(low)) { error("invalid char in content"); return false; } entityScanner.scanChar(); int c = XMLChar.supplemental((char) high, (char) low); if (XMLChar.isInvalid(c)) { error("invalid char in content"); return false; } // fill in the buffer buf.append((char) high); buf.append((char) low); return true; }
Example #7
Source File: TmxScanner2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
protected void scanStartElement() throws IOException, RepairableException, TmxEndEntityException { entityScanner.scanQName(elementQName); attributes.removeAllAttributes(); copyQname(elementQName, fCurrentElement); do { boolean sawSpace = entityScanner.skipSpaces(); int c = entityScanner.peekChar(); if (c == '>') { entityScanner.scanChar(); break; } else if (c == '/') { entityScanner.scanChar(); if (!entityScanner.skipChar('>')) { newRepairableException("[start element] miss '>' after '/'"); } break; } else if (!XMLChar.isNameStart(c) || !sawSpace) { setScannerState(SCANNER_STATE_CONTENT); newRepairableException("[start element] illegal char '" + Integer.toHexString(c) + '\''); } scanAttribute(attributes); } while (true); cwriter.writeStartElement(fCurrentElement, attributes); }
Example #8
Source File: AdxDataSetMetadata.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void addExplodedCategoryAttributes( CategoryOptionCombo coc ) throws AdxException { Map<String, String> categoryAttributes = new HashMap<>(); if ( !coc.isDefault() ) { for ( Category category : coc.getCategoryCombo().getCategories() ) { String categoryCode = category.getCode(); if ( categoryCode == null || !XMLChar.isValidName( categoryCode ) ) { throw new AdxException( "Category code for " + category.getName() + " is missing or invalid: " + categoryCode ); } String catOptCode = category.getCategoryOption( coc ).getCode(); if ( catOptCode == null || catOptCode.isEmpty() ) { throw new AdxException( "CategoryOption code for " + category.getCategoryOption( coc ).getName() + " is missing" ); } categoryAttributes.put( categoryCode, catOptCode ); } } categoryOptionMap.put( coc.getId(), categoryAttributes ); }
Example #9
Source File: WsdlUtils.java From iaf with Apache License 2.0 | 5 votes |
static String getNCName(String name) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < name.length(); i++) { if (i == 0) { buf.append(XMLChar.isNCNameStart(name.charAt(i)) ? name.charAt(i) : '_'); } else { buf.append(XMLChar.isNCName(name.charAt(i)) ? name.charAt(i) : '_'); } } return buf.toString(); }
Example #10
Source File: DmozParser.java From nutch-htmlunit with Apache License 2.0 | 5 votes |
public int read() throws IOException { int c = in.read(); int value = c; if (c != -1 && !(XMLChar.isValid(c))) // fix invalid characters value = 'X'; else if (lastBad && c == '<') { // fix mis-matched brackets in.mark(1); if (in.read() != '/') value = 'X'; in.reset(); } lastBad = (c == 65533); return value; }
Example #11
Source File: TmxEntityScanner.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
boolean skipSpaces() throws IOException { if (entity.position == entity.count) { load(0); } int c = entity.ch[entity.position]; if (XMLChar.isSpace(c)) { do { boolean finish = false; if (c == '\n' || c == '\r') { entity.lineNumber++; entity.columnNumber = 1; if (entity.position == entity.count - 1) { entity.ch[0] = (char) c; finish = load(1); if (!finish) { entity.position = 0; entity.startPosition = 0; } } if (c == '\r') { if (entity.ch[++entity.position] != '\n'){ entity.position--; } } } else { entity.columnNumber++; } if (!finish) entity.position++; if (entity.position == entity.count) { load(0); } } while (XMLChar.isSpace(c = entity.ch[entity.position])); return true; } return false; }
Example #12
Source File: TmxScanner2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private void scanCharReference() throws IOException, TmxEndEntityException { fStringBuffer2.clear(); boolean hex = entityScanner.peekChar() == 'x'; int ch = scanCharReferenceValue(fStringBuffer2, null); if (ch != -1) { int c = Integer.valueOf(fStringBuffer3.toString(), hex ? 16 : 10); if (c < 0x20 && !XMLChar.isSpace(c)) { return; } } }
Example #13
Source File: TmxScanner2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private boolean scanPubidLiteral(XMLString literal) throws TmxEndEntityException, IOException, RepairableException { int quote = entityScanner.scanChar(); if (quote != '\'' && quote != '"') { newRepairableException("QuoteRequiredInPublicID"); return false; } fStringBuffer.clear(); // skip leading whitespace boolean skipSpace = true; boolean dataok = true; while (true) { int c = entityScanner.scanChar(); if (c == ' ' || c == '\n' || c == '\r') { if (!skipSpace) { // take the first whitespace as a space and skip the others fStringBuffer.append(' '); skipSpace = true; } } else if (c == quote) { if (skipSpace) { // if we finished on a space let's trim it fStringBuffer.length--; } literal.setValues(fStringBuffer); break; } else if (XMLChar.isPubid(c)) { fStringBuffer.append((char) c); skipSpace = false; } else if (c == -1) { newRepairableException("PublicIDUnterminated"); return false; } else { dataok = false; newRepairableException("InvalidCharInPublicID"); } } return dataok; }
Example #14
Source File: TmxSchema.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public boolean isTextAccept(QName qname, XMLString content) { boolean spaces = true; for (int i = content.offset; i < content.offset + content.length; i++) { spaces = spaces && XMLChar.isSpace(content.ch[i]); } if (spaces) { return true; } return acceptText.containsSymbol(qname.rawname); }
Example #15
Source File: DmozParser.java From anthelion with Apache License 2.0 | 5 votes |
public int read() throws IOException { int c = in.read(); int value = c; if (c != -1 && !(XMLChar.isValid(c))) // fix invalid characters value = 'X'; else if (lastBad && c == '<') { // fix mis-matched brackets in.mark(1); if (in.read() != '/') value = 'X'; in.reset(); } lastBad = (c == 65533); return value; }
Example #16
Source File: AsyncXMLReader.java From jlibs with Apache License 2.0 | 5 votes |
private boolean isWhitespace(Chars data){ char chars[] = data.array(); int end = data.offset()+data.length(); for(int i=data.offset(); i<end; i++){ if(!XMLChar.isSpace(chars[i])) return false; } return true; }
Example #17
Source File: AsyncXMLReader.java From jlibs with Apache License 2.0 | 5 votes |
void charReference(Chars data) throws SAXException{ int cp = Integer.parseInt(data.toString(), radix); if(XMLChar.isValid(cp)){ if(valueStarted) value.appendCodePoint(cp); else if(contentHandler!=null){ char chars[] = Character.toChars(cp); contentHandler.characters(chars, 0, chars.length); } }else throw fatalError("invalid xml character"); }
Example #18
Source File: John_BaseXMLWriter.java From GeoTriples with Apache License 2.0 | 5 votes |
String tag(String namespace, String local, int type, boolean localIsQname) { if (dbg) System.err.println(namespace + " - " + local); String prefix = ns.get(namespace); if (type != FAST && type != FASTATTR) { if ((!localIsQname) && !XMLChar.isValidNCName(local)) return splitTag(namespace + local, type); if (namespace.equals(RDFNS)) { // Description, ID, nodeID, about, aboutEach, aboutEachPrefix, // li // bagID parseType resource datatype RDF if (badRDF.contains(local)) { logger.warn("The URI rdf:" + local + " cannot be serialized in RDF/XML."); throw new InvalidPropertyURIException("rdf:" + local); } } } boolean cookUp = false; if (prefix == null) { checkURI(namespace); logger.warn("Internal error: unexpected QName URI: <" + namespace + ">. Fixing up with j.cook.up code.", new BrokenException("unexpected QName URI " + namespace)); cookUp = true; } else if (prefix.length() == 0) { if (type == ATTR || type == FASTATTR) cookUp = true; else return local; } if (cookUp) return cookUpAttribution(type, namespace, local); return prefix + ":" + local; }
Example #19
Source File: TmxEntityScanner2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
boolean skipSpaces() throws IOException, TmxEndEntityException { if (entity.position == entity.count) { load(0); } int c = entity.ch[entity.position]; if (XMLChar.isSpace(c)) { do { boolean finish = false; if (c == '\n' || c == '\r') { entity.lineNumber++; entity.columnNumber = 1; if (entity.position == entity.count - 1) { entity.ch[0] = (char) c; finish = load(1); if (!finish) { entity.position = 0; entity.startPosition = 0; } } if (c == '\r') { if (entity.ch[++entity.position] != '\n'){ entity.position--; } } } else { entity.columnNumber++; } if (!finish) entity.position++; if (entity.position == entity.count) { load(0); } } while (XMLChar.isSpace(c = entity.ch[entity.position])); return true; } return false; }
Example #20
Source File: John_BaseXMLWriter.java From GeoTriples with Apache License 2.0 | 5 votes |
/** * Answer true iff prefix is a "legal" prefix to use, ie, is empty [for the * default namespace] or an NCName that does not start with "xml" and does * not match the reserved-to-Jena pattern. */ private boolean checkLegalPrefix(String prefix) { if (prefix.equals("")) return true; if (prefix.toLowerCase().startsWith("xml")) logger.warn("Namespace prefix '" + prefix + "' is reserved by XML."); else if (!XMLChar.isValidNCName(prefix)) logger.warn("'" + prefix + "' is not a legal namespace prefix."); else if (jenaNamespace.matcher(prefix).matches()) logger.warn("Namespace prefix '" + prefix + "' is reserved by Jena."); else return true; return false; }
Example #21
Source File: John_BaseXMLWriter.java From GeoTriples with Apache License 2.0 | 5 votes |
static private String escapedId(String id) { StringBuffer result = new StringBuffer(); for (int i = 0; i < id.length(); i++) { char ch = id.charAt(i); if (ch != ESCAPE && (i == 0 ? XMLChar.isNCNameStart(ch) : XMLChar .isNCName(ch))) { result.append(ch); } else { escape(result, ch); } } return result.toString(); }
Example #22
Source File: TmxScanner.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
boolean scanStartElement() throws IOException { // scan name entityScanner.scanQName(fElementQName); fCurrentElement = fElementQName; if (!scope.isEmpty()) { if (scope.lastElement().equals("note") || scope.lastElement().equals("prop")) { appendCharacter(encodingCharacter('<')); appendCharacter(fElementQName.localpart == null ? "" : fElementQName.localpart); setScannerState(SCANNER_STATE_CONTENT); return false; } } // scan attributes boolean empty = false; fAttributes.removeAllAttributes(); do { boolean sawSpace = entityScanner.skipSpaces(); int c = entityScanner.peekChar(); if (c == '>') { entityScanner.scanChar(); break; } else if (c == '/') { entityScanner.scanChar(); if (!entityScanner.skipChar('>')) { // TODO } empty = true; break; } else if (!XMLChar.isNameStart(c) || !sawSpace) { // Second chance. Check if this character is a high surrogate of a valid name start character. // if (!isValidNameStartHighSurrogate(c) || !sawSpace) { // } error("illegal char '&#" + Integer.toHexString(c) + "'"); appendCharacter(encodingCharacter(c)); setScannerState(SCANNER_STATE_CONTENT); return false; } // get the attribute scanAttribute(fAttributes); } while (true); // push element stack fCurrentElement = fElementStack.pushElement(fElementQName); // if (fElementQName.rawname != null && !fElementQName.rawname.isEmpty()) { // writer.write('<'); // writer.write(fElementQName.rawname); // QName qn = new QName(); // // for (int i = 0; i < fAttributes.getLength(); i++) { // fAttributes.getName(i, qn); // writer.write(' '); // writer.write(qn.rawname); // writer.write("="); // writer.write("\""); // writer.write(fAttributes.getValue(i)); // writer.write("\""); // } // if (empty) { // // 自加减 // writer.write("/>"); // fElementStack.popElement(new QName()); // stack.pop(); // } else {//有 content // writer.write('>'); // writer.flush(); // } // } return empty; }
Example #23
Source File: ISO9075.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 4 votes |
/** * Encode a string according to ISO 9075 * * @param toEncode String * @return String */ public static String encode(String toEncode) { if ((toEncode == null) || (toEncode.length() == 0)) { return toEncode; } else if (XMLChar.isValidName(toEncode) && (toEncode.indexOf("_x") == -1) && (toEncode.indexOf(':') == -1)) { return toEncode; } else { StringBuilder builder = new StringBuilder(toEncode.length()); for (int i = 0; i < toEncode.length(); i++) { char c = toEncode.charAt(i); // First requires special test if (i == 0) { if (XMLChar.isNCNameStart(c)) { // The first character may be the _ at the start of an // encoding pattern if (matchesEncodedPattern(toEncode, i)) { // Encode the first _ encode('_', builder); } else { // Just append builder.append(c); } } else { // Encode an invalid start character for an XML element // name. encode(c, builder); } } else if (!XMLChar.isNCName(c)) { encode(c, builder); } else { if (matchesEncodedPattern(toEncode, i)) { // '_' must be encoded encode('_', builder); } else { builder.append(c); } } } return builder.toString(); } }
Example #24
Source File: John_BaseXMLWriter.java From GeoTriples with Apache License 2.0 | 4 votes |
private String longAnonId(Resource r) { String rid = r.getId().toString(); return XMLChar.isValidNCName(rid) ? rid : escapedId(rid); }
Example #25
Source File: TmxEntityScanner.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
public boolean skipDeclSpaces() throws IOException { // load more characters, if needed if (entity.position == entity.count) { load(0); } // skip spaces int c = entity.ch[entity.position]; if (XMLChar.isSpace(c)) { do { boolean entityChanged = false; // handle newlines if (c == '\n' || c == '\r') { entity.lineNumber++; entity.columnNumber = 1; if (entity.position == entity.count - 1) { entity.ch[0] = (char) c; entityChanged = load(1); if (!entityChanged) { // the load change the position to be 1, // need to restore it when entity not changed entity.position = 0; entity.startPosition = 0; } } if (c == '\r') { // REVISIT: Does this need to be updated to fix the // #x0D ^#x0A newline normalization problem? -Ac if (entity.ch[++entity.position] != '\n') { entity.position--; } } /*** * NEWLINE NORMALIZATION *** else { if (fCurrentEntity.ch[fCurrentEntity.position + 1] == '\r' && * external) { fCurrentEntity.position++; } } / ***/ } else { entity.columnNumber++; } // load more characters, if needed if (!entityChanged) entity.position++; if (entity.position == entity.count) { load(0); } } while (XMLChar.isSpace(c = entity.ch[entity.position])); return true; } return false; }
Example #26
Source File: TmxScanner.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
private String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException { String name = entityScanner.scanName(); if (name == null) { error("not found paseudo attribute"); } entityScanner.skipDeclSpaces(); if (!entityScanner.skipChar('=')) { error("not found '='"); } entityScanner.skipDeclSpaces(); int quote = entityScanner.peekChar(); if (quote != '\'' && quote != '"') { error("not found quote when scan pseudo attribute"); } entityScanner.scanChar(); int c = entityScanner.scanLiteral(quote, value); if (c != quote) { fStringBuffer2.clear(); do { fStringBuffer2.append(value); if (c != -1) { if (c == '&' || c == '%' || c == '<' || c == ']') { fStringBuffer2.append((char) entityScanner.scanChar()); } // REVISIT: Even if you could reliably read non-ASCII chars // why bother scanning for surrogates here? Only ASCII chars // match the productions in XMLDecls and TextDecls. -- mrglavas else if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer2); } else if (XMLChar.isInvalid(c)) { String key = scanningTextDecl ? "InvalidCharInTextDecl" : "InvalidCharInXMLDecl"; error("invalid char '&#" + Integer.toHexString(c) + "'"); // reportFatalError(key, // new Object[] {Integer.toString(c, 16)}); entityScanner.scanChar(); } } c = entityScanner.scanLiteral(quote, value); } while (c != quote); fStringBuffer2.append(value); value.setValues(fStringBuffer2); } if (!entityScanner.skipChar((char) quote)) { error("not found close quote"); } // return return name; }
Example #27
Source File: TmxScanner.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
private void scanPIData(String target, XMLString xs) throws IOException { // check target if (target.length() == 3) { char c0 = Character.toLowerCase(target.charAt(0)); char c1 = Character.toLowerCase(target.charAt(1)); char c2 = Character.toLowerCase(target.charAt(2)); if (c0 == 'x' && c1 == 'm' && c2 == 'l') { // TODO // reportFatalError("ReservedPITarget", null); } } // spaces if (!entityScanner.skipSpaces()) { if (entityScanner.skipString("?>")) { // we found the end, there is no data xs.clear(); return; } else { if (entityScanner.peekChar() == ':') { entityScanner.scanChar(); XMLStringBuffer colonName = new XMLStringBuffer(target); colonName.append(':'); String str = entityScanner.scanName(); if (str != null) colonName.append(str); // TODO // reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()}); entityScanner.skipSpaces(); } else { // TODO // if there is data there should be some space // reportFatalError("SpaceRequiredInPI", null); } } } fStringBuffer.clear(); // data if (entityScanner.scanData("?>", fStringBuffer)) { do { int c = entityScanner.peekChar(); if (c != -1) { if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer); } else if (XMLChar.isInvalid(c)) { // reportFatalError("InvalidCharInPI", // new Object[]{Integer.toHexString(c)}); entityScanner.scanChar(); } } } while (entityScanner.scanData("?>", fStringBuffer)); } xs.setValues(fStringBuffer); }
Example #28
Source File: John_Unparser.java From GeoTriples with Apache License 2.0 | 4 votes |
private boolean isLocalReference(Resource r) { return (!r.isAnon()) && getNameSpace(r).equals(localName + "#") && XMLChar.isValidNCName(getLocalName(r)); }
Example #29
Source File: TmxScanner2.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
private void scanPIData(String target, XMLString xs) throws IOException, TmxEndEntityException { // check target if (target.length() == 3) { char c0 = Character.toLowerCase(target.charAt(0)); char c1 = Character.toLowerCase(target.charAt(1)); char c2 = Character.toLowerCase(target.charAt(2)); if (c0 == 'x' && c1 == 'm' && c2 == 'l') { // TODO 非法命名 return; } } // spaces if (!entityScanner.skipSpaces()) { if (entityScanner.skipString("?>")) { // we found the end, there is no data xs.clear(); return; } else { if (entityScanner.peekChar() == ':') { entityScanner.scanChar(); XMLStringBuffer colonName = new XMLStringBuffer(target); colonName.append(':'); String str = entityScanner.scanName(); if (str != null) colonName.append(str); // TODO reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()}); entityScanner.skipSpaces(); } else { // TODO reportFatalError("SpaceRequiredInPI", null); } } } fStringBuffer.clear(); // data if (entityScanner.scanData("?>", fStringBuffer)) { do { int c = entityScanner.peekChar(); if (c != -1) { if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer); } else if (XMLChar.isInvalid(c)) { // reportFatalError("InvalidCharInPI", // new Object[]{Integer.toHexString(c)}); entityScanner.scanChar(); } } } while (entityScanner.scanData("?>", fStringBuffer)); } xs.setValues(fStringBuffer); }
Example #30
Source File: TmxScanner2.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
private String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException, RepairableException, TmxEndEntityException { String name = entityScanner.scanName(); if (name.isEmpty()) { newRepairableException("not found Pseudo Attribute name", entityScanner.getLineNumber(), entityScanner.getOffsetNumber()); } entityScanner.skipDeclSpaces(); if (!entityScanner.skipChar('=')) { newRepairableException("not found '=' when scan Pseudo Attribute", entityScanner.getLineNumber(), entityScanner.getOffsetNumber()); } entityScanner.skipDeclSpaces(); int quote = entityScanner.peekChar(); if (quote != '\'' && quote != '"') { newRepairableException("not found 'quote' when scan Pseudo Attribute", entityScanner.getLineNumber(), entityScanner.getOffsetNumber()); } entityScanner.scanChar(); int c = entityScanner.scanLiteral(quote, value); if (c != quote) { fStringBuffer2.clear(); do { fStringBuffer2.append(value); if (c != -1) { if (c == '&' || c == '%' || c == '<' || c == ']') { fStringBuffer2.append((char) entityScanner.scanChar()); } // REVISIT: Even if you could reliably read non-ASCII chars // why bother scanning for surrogates here? Only ASCII chars // match the productions in XMLDecls and TextDecls. -- mrglavas else if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer2); } else if (XMLChar.isInvalid(c)) { entityScanner.scanChar(); // TODO should we report error, or skip this char silence? // error("Invalid Char in xml declaration : '&#" + Integer.toHexString(c) + "'"); } } c = entityScanner.scanLiteral(quote, value); } while (c != quote); fStringBuffer2.append(value); value.setValues(fStringBuffer2); } if (!entityScanner.skipChar((char) quote)) { throw new RepairableException("not found close quote"); } return name; }