Refine search
/** * Generate XML for FixedPartitionAttribute element in PartitionedRegion Attributes */ private void generateFixedPartitionAttributes(String kind, List<FixedPartitionAttributes> allStaticAttrs) throws SAXException { for (FixedPartitionAttributes attr : allStaticAttrs) { AttributesImpl sAtts = new AttributesImpl(); sAtts.addAttribute("", "", PARTITION_NAME, "", attr.getPartitionName()); sAtts.addAttribute("", "", IS_PRIMARY, "", String.valueOf(attr.isPrimary())); sAtts.addAttribute("", "", NUM_BUCKETS, "", String.valueOf(attr.getNumBuckets())); handler.startElement("", kind, kind, sAtts); handler.endElement("", kind, kind); } }
/** * Copy an entire Attributes object. * * <p>It may be more efficient to reuse an existing object * rather than constantly allocating new ones.</p> * * @param atts The attributes to copy. */ public void setAttributes (Attributes atts) { clear(); length = atts.getLength(); if (length > 0) { data = new String[length*5]; for (int i = 0; i < length; i++) { data[i*5] = atts.getURI(i); data[i*5+1] = atts.getLocalName(i); data[i*5+2] = atts.getQName(i); data[i*5+3] = atts.getType(i); data[i*5+4] = atts.getValue(i); } } }
String val) int index = super.getLength(); super.addAttribute(uri, local, qname, type, val);
/** * This method clears the accumulated attributes. * * @see org.xml.sax.helpers.AttributesImpl#clear() */ public final void clear() { int len = super.getLength(); super.clear(); if (MAX <= len) { // if we have had enough attributes and are // using the Hashtable, then clear the Hashtable too. m_indexFromQName.clear(); } }
@Override public void visitAnnotableParameterCount( final int parameterCount, final boolean visible) { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", "count", "count", "", Integer.toString(parameterCount)); attrs.addAttribute("", "visible", "visible", "", visible ? "true" : "false"); sa.addElement("annotableParameterCount", attrs); }
/** * This method gets the index of an attribute given its qName. * @param qname the qualified name of the attribute, e.g. "prefix1:locName1" * @return the integer index of the attribute. * @see org.xml.sax.Attributes#getIndex(String) */ public final int getIndex(String qname) { int index; if (super.getLength() < MAX) { // if we haven't got too many attributes let the // super class look it up index = super.getIndex(qname); return index; } // we have too many attributes and the super class is slow // so find it quickly using our Hashtable. Integer i = (Integer)m_indexFromQName.get(qname); if (i == null) index = -1; else index = i.intValue(); return index; } /**
|| !throwError); if (isCompatibleMode) undefines = new AttributesImpl(); int nAttrs = attributes.getLength(); String attrUri = attributes.getURI(i); && (attributes.getQName(i).startsWith("xmlns:") || attributes.getQName(i).equals("xmlns"))) undefines.addAttribute(attrUri, attrLocalName, attributes.getQName(i), attributes.getType(i),
handler.processingInstruction((String) saxEvent.getParm(0), (String) saxEvent.getParm(1)); handler.startPrefixMapping((String) saxEvent.getParm(0), (String) saxEvent.getParm(1)); handler.endPrefixMapping((String) saxEvent.getParm(0)); AttributesImpl attributes = new AttributesImpl(); List<String[]> attParmList = (List<String[]>) saxEvent.getParm(3); attributes.addAttribute(attParms[0], attParms[1], attParms[2], attParms[3], attParms[4]); ((LexicalHandler) handler).startDTD((String) saxEvent .getParm(0), (String) saxEvent.getParm(1), (String) saxEvent.getParm(2)); ((LexicalHandler) handler).endDTD(); ((LexicalHandler) handler).startEntity((String) saxEvent .getParm(0)); throw new SAXException("Unrecognized event: " + saxEvent.event);
switch (pNode.getNodeType()) { case Node.DOCUMENT_NODE: pHandler.startDocument(); doSerializeChilds(pNode, pHandler); pHandler.endDocument(); break; case Node.DOCUMENT_FRAGMENT_NODE: break; case Node.ELEMENT_NODE: AttributesImpl attr = new AttributesImpl(); boolean isNamespaceDeclarationAttribute = isNamespaceDeclarationAttribute(); if (!isNamespaceDeclarationAttribute) { attr.addAttribute(aUri == null ? "" : aUri, aNodeName, aLocalName, "CDATA", a.getNodeValue()); nUri = ""; pHandler.startElement(nUri, pNode.getLocalName(), pNode.getNodeName(), attr); doSerializeChilds(pNode, pHandler); if (pHandler instanceof LexicalHandler) { String s = pNode.getNodeValue(); ((LexicalHandler) pHandler).comment(s.toCharArray(), 0, s.length());
public void adapt() throws XMLStreamException, SAXException { QName qname; String prefix, localPart; AttributesImpl attrs = new AttributesImpl(); char[] buffer; int nsc; int nat; _handler.startDocument(); _handler.startPrefixMapping(_reader.getNamespacePrefix(i), _reader.getNamespaceURI(i)); attrs.clear(); nat = _reader.getAttributeCount(); for (int i = 0; i < nat; i++) { qName = qName + ":" + q.getLocalPart(); attrs.addAttribute(_reader.getAttributeNamespace(i), q.getLocalPart(), qName, localPart = qname.getLocalPart(); _handler.startElement(_reader.getNamespaceURI(), localPart, (prefix.length() > 0) ?
/** * Start visitor (initialization) */ @Override public void start(int version) throws IOException { try { contentHandler.startElement("", "", "EDITS_VERSION", new AttributesImpl()); StringBuilder bld = new StringBuilder(); bld.append(version); addString(bld.toString()); contentHandler.endElement("", "", "EDITS_VERSION"); } catch (SAXException e) { throw new IOException("SAX error: " + e.getMessage()); } }
final String cdata = node.getNodeValue(); if (_lex != null) { _lex.startCDATA(); _sax.characters(cdata.toCharArray(), 0, cdata.length()); _lex.endCDATA(); _sax.characters(cdata.toCharArray(), 0, cdata.length()); if (_lex != null) { final String value = node.getNodeValue(); _lex.comment(value.toCharArray(), 0, value.length()); _sax.setDocumentLocator(this); _sax.startDocument(); String prefix; List pushedPrefixes = new ArrayList(); final AttributesImpl attrs = new AttributesImpl(); final NamedNodeMap map = node.getAttributes(); final int length = map.getLength(); attrs.addAttribute(attr.getNamespaceURI(), getLocalName(attr), qnameAttr, "CDATA", attr.getNodeValue());
public void startElement( String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if (namespaceDecls != null) { for (int i = 0, ii = atts.getLength(); i < ii; i++) { namespaceDecls.addAttribute( null, null, atts.getQName(i), atts.getType(i), atts.getValue(i)); } atts = namespaceDecls; namespaceDecls = null; } if (namespaceURI == null) namespaceURI = ""; if (localName == null) localName = ""; original.startElement(namespaceURI, localName, qName, atts); }
/** * Called by the transformer to parse the "input source". We ignore the input source and, instead, * generate SAX events to the {@link #setContentHandler ContentHandler}. */ @Override public void parse(InputSource input) throws SAXException { Assert.assertTrue(this.handler != null); handler.startDocument(); AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", "", ID, "", String.valueOf(this.system.getConfig().getSystemId())); handler.startElement("", DISTRIBUTED_SYSTEM, DISTRIBUTED_SYSTEM, atts); // Add generation methods here try { generateRemoteCommand(); generateDiscovery(); generateSSL(); generateCacheServers(); } catch (AdminException ex) { throw new SAXException( "An AdminException was thrown while generating XML.", ex); } handler.endElement("", DISTRIBUTED_SYSTEM, DISTRIBUTED_SYSTEM); handler.endDocument(); }
AttributesImpl newAttributes = new AttributesImpl(atts); for (int att = 0; att < newAttributes.getLength(); att++) { String attrName = newAttributes.getLocalName(att); String normAttrName = mapper.mapSafeAttribute(name, attrName); if (normAttrName == null) { newAttributes.removeAttribute(att); att--; } else { newAttributes.setLocalName(att, normAttrName); String v = newAttributes.getValue(att); if (v.startsWith("data:")) { newAttributes.setValue(att, "data:"); newAttributes.setValue(att, resolve(newAttributes.getValue(att))); } else if (isObject && "codebase".equals(normAttrName)) { newAttributes.setValue(att, codebase); } else if (isObject && ("data".equals(normAttrName) || "classid".equals(normAttrName))) { newAttributes.setValue( att, resolve(codebase, newAttributes.getValue(att))); if ("img".equals(name) && newAttributes.getValue("", "alt") == null) { newAttributes.addAttribute("", "alt", "alt", "CDATA", "");
this.m_contentHandler.startDocument(); break; case DTM.ELEMENT_NODE : this.m_contentHandler.startPrefixMapping(prefix, dtm.getNodeValue(nsn)); new org.xml.sax.helpers.AttributesImpl(); i = dtm.getNextAttribute(i)) attrs.addAttribute(dtm.getNamespaceURI(i), dtm.getLocalName(i), dtm.getNodeName(i), this.m_contentHandler.startElement(ns, m_dtm.getLocalName(node), m_dtm.getNodeName(node), lh.startCDATA(); lh.endCDATA(); ((LexicalHandler) this.m_contentHandler).startEntity( m_dtm.getNodeName(node));
extractor.process(td); } catch (BoilerpipeProcessingException e) { throw new SAXException(e); Attributes emptyAttrs = new AttributesImpl(); switch (element.getElementType()) { case START: delegate.startElement(element.getUri(), element.getLocalName(), element.getQName(), element.getAttrs()); delegate.characters(chars, 0, chars.length); delegate.ignorableWhitespace(NL, 0, NL.length);
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { localName = localName.toLowerCase(Locale.US); if (MS_SPREADSHEET_URN.equals(uri)) { if (BODY.equals(localName)) { inBody = true; } else if (TABLE.equals(localName)) { handler.startElement(XHTMLContentHandler.XHTML, TABLE, TABLE, EMPTY_ATTRS); handler.startElement(XHTMLContentHandler.XHTML, TBODY, TBODY, EMPTY_ATTRS); } else if (WORKSHEET.equals(localName)) { String worksheetName = attrs.getValue(MS_SPREADSHEET_URN, "Name"); AttributesImpl xhtmlAttrs = new AttributesImpl(); if (worksheetName != null) { xhtmlAttrs.addAttribute(XHTMLContentHandler.XHTML, NAME_ATTR, NAME_ATTR, CDATA, worksheetName); } handler.startElement(XHTMLContentHandler.XHTML, DIV, DIV, xhtmlAttrs); } else if (ROW.equals(localName)) { handler.startElement(XHTMLContentHandler.XHTML, TR, TR, EMPTY_ATTRS); } else if (CELL.equals(localName)) { href = attrs.getValue(MS_SPREADSHEET_URN, "HRef"); handler.startElement(XHTMLContentHandler.XHTML, TD, TD, EMPTY_ATTRS); } else if (DATA.equals(localName)) { inData = true; } } }
final NamedNodeMap attributes = e.getAttributes(); atts.clear(); int len = attributes==null ? 0: attributes.getLength(); receiver.startPrefixMapping( "", a.getValue() ); } else { String localName = a.getLocalName(); receiver.startPrefixMapping( localName, a.getValue() ); atts.addAttribute( uri, local, String qname = e.getTagName(); if(local==null) local = qname; receiver.startElement( uri, local, qname, atts );
protected void startXMLDocument() throws SAXException { AttributesImpl attrList = new AttributesImpl(); attrList.clear(); final ContentHandler contentHandler = getContentHandler(); if (contentHandler == null) { throw new SAXException("No ContentHandler configured for EDIReader"); } contentHandler.startDocument(); String rootTag = getXMLTags().getRootTag(); if (isNamespaceEnabled()) { contentHandler.startElement(BERRYWORKS_NAMESPACE, rootTag, rootTag, attrList); } else { startElement(rootTag, attrList); } }