/** * Adds the specified symbol to the symbol table and returns a * reference to the unique symbol. If the symbol already exists, * the previous symbol reference is returned instead, in order * guarantee that symbol references remain unique. * * @param symbol The new symbol. */ public String addSymbol(String symbol) { synchronized (fSymbolTable) { return fSymbolTable.addSymbol(symbol); } } // addSymbol(String)
/** * Adds the specified symbol to the symbol table and returns a * reference to the unique symbol. If the symbol already exists, * the previous symbol reference is returned instead, in order * guarantee that symbol references remain unique. * * @param buffer The buffer containing the new symbol. * @param offset The offset into the buffer of the new symbol. * @param length The length of the new symbol in the buffer. */ public String addSymbol(char[] buffer, int offset, int length) { synchronized (fSymbolTable) { return fSymbolTable.addSymbol(buffer, offset, length); } } // addSymbol(char[],int,int):String
private String symbolize( String s ) { return fSymbolTable.addSymbol(s); }
public String getSymbol (String symbol) { if (fSymbolTable != null) return fSymbolTable.addSymbol(symbol); // if there is no symbol table, we return java-internalized string, // because symbol table strings are also java-internalzied. // this guarantees that the returned string from this method can be // compared by reference with other symbol table string. -SG return symbol.intern(); } // qname, notation
private void fillQName(QName toFill, Node node) { final String prefix = node.getPrefix(); final String localName = node.getLocalName(); final String rawName = node.getNodeName(); final String namespace = node.getNamespaceURI(); toFill.prefix = (prefix != null) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING; toFill.localpart = (localName != null) ? fSymbolTable.addSymbol(localName) : XMLSymbols.EMPTY_STRING; toFill.rawname = (rawName != null) ? fSymbolTable.addSymbol(rawName) : XMLSymbols.EMPTY_STRING; toFill.uri = (namespace != null && namespace.length() > 0) ? fSymbolTable.addSymbol(namespace) : null; }
private void fillQName(QName toFill, Node node) { final String prefix = node.getPrefix(); final String localName = node.getLocalName(); final String rawName = node.getNodeName(); final String namespace = node.getNamespaceURI(); toFill.prefix = (prefix != null) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING; toFill.localpart = (localName != null) ? fSymbolTable.addSymbol(localName) : XMLSymbols.EMPTY_STRING; toFill.rawname = (rawName != null) ? fSymbolTable.addSymbol(rawName) : XMLSymbols.EMPTY_STRING; toFill.uri = (namespace != null && namespace.length() > 0) ? fSymbolTable.addSymbol(namespace) : null; } }
protected final void updateQName (Node node, QName qname){ String prefix = node.getPrefix(); String namespace = node.getNamespaceURI(); String localName = node.getLocalName(); // REVISIT: the symbols are added too often: start/endElement // and in the namespaceFixup. Should reduce number of calls to symbol table. qname.prefix = (prefix!=null && prefix.length()!=0)?fSymbolTable.addSymbol(prefix):null; qname.localpart = (localName != null)?fSymbolTable.addSymbol(localName):null; qname.rawname = fSymbolTable.addSymbol(node.getNodeName()); qname.uri = (namespace != null)?fSymbolTable.addSymbol(namespace):null; }
public String getURI(String prefix) { if (fNamespaceContext != null) { String uri = fNamespaceContext.getNamespaceURI(prefix); if (uri != null && !XMLConstants.NULL_NS_URI.equals(uri)) { return (fSymbolTable != null) ? fSymbolTable.addSymbol(uri) : uri.intern(); } } return null; }
/** * Adds the specified symbol to the symbol table and returns a * reference to the unique symbol. If the symbol already exists, * the previous symbol reference is returned instead, in order * guarantee that symbol references remain unique. * * @param symbol The new symbol. */ public String addSymbol(String symbol) { if (fSymbolTable.containsSymbol(symbol)) { return fSymbolTable.addSymbol(symbol); } return super.addSymbol(symbol); } // addSymbol(String)
/** * Adds the specified symbol to the symbol table and returns a * reference to the unique symbol. If the symbol already exists, * the previous symbol reference is returned instead, in order * guarantee that symbol references remain unique. * * @param buffer The buffer containing the new symbol. * @param offset The offset into the buffer of the new symbol. * @param length The length of the new symbol in the buffer. */ public String addSymbol(char[] buffer, int offset, int length) { if (fSymbolTable.containsSymbol(buffer, offset, length)) { return fSymbolTable.addSymbol(buffer, offset, length); } return super.addSymbol(buffer, offset, length); } // addSymbol(char[],int,int):String
public String getPrefix(int index) { if (fAttributes != null) { Node node = (Node) fAttributes.getItem(index); String prefix = node.getPrefix(); prefix = (prefix != null && prefix.length() != 0) ? fSymbolTable.addSymbol(prefix) : null; return prefix; } return null; }
public String getLocalName(int index) { if (fAttributes != null) { Node node = (Node) fAttributes.getItem(index); String localName = node.getLocalName(); localName = (localName != null) ? fSymbolTable.addSymbol(localName) : null; return localName; } return null; }
public String getURI(int index) { if (fAttributes != null) { Node node = (Node) fAttributes.getItem(index); String namespace = node.getNamespaceURI(); namespace = (namespace != null) ? fSymbolTable.addSymbol(namespace) : null; return namespace; } return null; }
public String getQName(int index) { if (fAttributes != null) { Node node = (Node) fAttributes.getItem(index); String rawname = fSymbolTable.addSymbol(node.getNodeName()); return rawname; } return null; }
public String getPrefix(String uri) { if (fNamespaceContext != null) { if (uri == null) { uri = XMLConstants.NULL_NS_URI; } String prefix = fNamespaceContext.getPrefix(uri); if (prefix == null) { prefix = XMLConstants.DEFAULT_NS_PREFIX; } return (fSymbolTable != null) ? fSymbolTable.addSymbol(prefix) : prefix.intern(); } return null; }
private String findQName(String name, XSDocumentInfo schemaDoc) { SchemaNamespaceSupport currNSMap = schemaDoc.fNamespaceSupport; int colonPtr = name.indexOf(':'); String prefix = XMLSymbols.EMPTY_STRING; if (colonPtr > 0) prefix = name.substring(0, colonPtr); String uri = currNSMap.getURI(fSymbolTable.addSymbol(prefix)); String localpart = (colonPtr == 0)?name:name.substring(colonPtr+1); if (prefix == XMLSymbols.EMPTY_STRING && uri == null && schemaDoc.fIsChameleonSchema) uri = schemaDoc.fTargetNamespace; if (uri == null) return ","+localpart; return uri+","+localpart; } // findQName(String, XSDocumentInfo): String
/** Fills in a QName object. */ final void fillQName(QName toFill, String uri, String localpart, String prefix) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; prefix = (prefix != null && prefix.length() > 0) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING; String raw = localpart; if (prefix != XMLSymbols.EMPTY_STRING) { fStringBuffer.clear(); fStringBuffer.append(prefix); fStringBuffer.append(':'); fStringBuffer.append(localpart); raw = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length); } toFill.setValues(prefix, localpart, raw, uri); }
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { try { if (!pushedContext) namespaceContext.pushContext(); else pushedContext = false; for (int i = 0, len = atts.getLength(); i < len; i++) attributes.addAttribute(makeQName(atts.getURI(i), atts.getLocalName(i), atts.getQName(i)), symbolTable.addSymbol(atts.getType(i)), atts.getValue(i)); schemaValidator.startElement(makeQName(namespaceURI, localName, qName), attributes, null); attributes.removeAllAttributes(); } catch (XNIException e) { throw toSAXException(e); } }
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { try { if (!pushedContext) namespaceContext.pushContext(); else pushedContext = false; for (int i = 0, len = atts.getLength(); i < len; i++) attributes.addAttribute(makeQName(atts.getURI(i), atts.getLocalName(i), atts.getQName(i)), symbolTable.addSymbol(atts.getType(i)), atts.getValue(i)); schemaValidator.startElement(makeQName(namespaceURI, localName, qName), attributes, null); attributes.removeAllAttributes(); } catch (XNIException e) { throw toSAXException(e); } }
public String checkTargetNamespace(Element element, XSDocumentInfo schemaDoc) { if (DOMUtil.getAttr(element, SchemaSymbols.ATT_TARGETNAMESPACE) != null) { final String value = DOMUtil.getAttrValueTrimmed(element, SchemaSymbols.ATT_TARGETNAMESPACE); try { fExtraDVs[DT_ANYURI].validate(value, schemaDoc.fValidationContext, null); return fSymbolTable.addSymbol(value); } catch (InvalidDatatypeValueException ide) { // REVISIT: bypass checking in checkAttributes? // Ignore for now, it will be reported when we call checkAttributes } } return null; } /**