element.setParent(parent); element.setAttributes(new AttributeList(attributes)); element.setPrefixMapping(_prefixMapping);
protected void addAttribute(String qname, String value) { _attributes.add(qname, value); }
/** * Adds an attribute to the list */ public void add(String qname, String value) { // Initialize the internal vectors at the first usage. if (_attributes == null) alloc(); // Stuff the QName into the names vector & hashtable Integer obj = (Integer)_attributes.get(qname); if (obj == null) { _attributes.put(qname, obj = new Integer(_length++)); _qnames.addElement(qname); _values.addElement(value); int col = qname.lastIndexOf(':'); if (col > -1) { _uris.addElement(qname.substring(0,col)); _names.addElement(qname.substring(col+1)); } else { _uris.addElement(EMPTYSTRING); _names.addElement(qname); } } else { final int index = obj.intValue(); _values.set(index, value); } }
/** * SAX2: Look up an attribute's value by Namespace name - SLOW! */ public String getValue(String uri, String localName) { return(getValue(uri+':'+localName)); }
public void startElement(String elementName) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); _openElementName = elementName; _attributes.clear(); }
final int count = _attributes.getLength(); for (int i = 0; i < count; i++) { final QName qname = parser.getQName(_attributes.getQName(i)); final String uri = qname.getNamespace(); final String val = _attributes.getValue(i); final QName qname = parser.getQName(_attributes.getQName(i)); final String val = _attributes.getValue(i);
protected boolean hasAttribute(String qname) { return (_attributes != null && _attributes.getValue(qname) != null); }
public void startElement(String elementName) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); _openElementName = elementName; _attributes.clear(); }
/** * JavaScript constructor. This must be declared in every JavaScript file because * the Rhino engine won't walk up the hierarchy looking for constructors. */ public void jsConstructor() { instantiatedViaJavaScript_ = true; final SgmlPage page = (SgmlPage) getWindow().getWebWindow().getEnclosedPage(); final HtmlElement fake = HTMLParser.getFactory(TAG_NAME).createElement(page, TAG_NAME, new AttributeList()); setDomNode(fake); }
/** * Returns a value for an attribute from the source element. * @param qname The QName of the attribute to return. * @return The value of the attribute of name 'qname'. */ protected String getAttribute(String qname) { if (_attributes == null) { return EMPTYSTRING; } final String value = _attributes.getValue(qname); return (value == null || value.equals(EMPTYSTRING)) ? EMPTYSTRING : value; }
/** * Attributes clone constructor */ public AttributeList(org.xml.sax.Attributes attributes) { this(); if (attributes != null) { final int count = attributes.getLength(); for (int i = 0; i < count; i++) { add(attributes.getQName(i),attributes.getValue(i)); } } }
public void startElement(String elementName) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); _openElementName = elementName; _attributes.clear(); }
/** * Adds an attribute to the list */ public void add(String qname, String value) { // Initialize the internal vectors at the first usage. if (_attributes == null) alloc(); // Stuff the QName into the names vector & hashtable Integer obj = (Integer)_attributes.get(qname); if (obj == null) { _attributes.put(qname, obj = new Integer(_length++)); _qnames.addElement(qname); _values.addElement(value); int col = qname.lastIndexOf(':'); if (col > -1) { _uris.addElement(qname.substring(0,col)); _names.addElement(qname.substring(col+1)); } else { _uris.addElement(EMPTYSTRING); _names.addElement(qname); } } else { final int index = obj.intValue(); _values.set(index, value); } }
/** * JavaScript constructor. This must be declared in every JavaScript file because * the Rhino engine won't walk up the hierarchy looking for constructors. */ public void jsConstructor() { instantiatedViaJavaScript_ = true; final SgmlPage page = (SgmlPage) getWindow().getWebWindow().getEnclosedPage(); final HtmlElement fake = HTMLParser.getFactory(TAG_NAME).createElement(page, TAG_NAME, new AttributeList()); setDomNode(fake); }
/** * SAX2: Look up an attribute's value by qname. */ public String getValue(String qname) { if (_attributes != null) { final Integer obj = (Integer)_attributes.get(qname); if (obj == null) return null; return(getValue(obj.intValue())); } else return null; }
public void addAttribute(String name, String value) { if (_openElementName != null) { _attributes.add(name, value); } else { BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, name); } }
public void startElement(String elementName) throws SAXException { if (_dom == null) { prepareNewDOM(); } maybeEmitStartElement(); _openElementName = elementName; _attributes.clear(); }