/** * Create an XML Indenter * * @param next the next receiver in the pipeline, always an XMLEmitter */ public XMLIndenter(XMLEmitter next) { super(next); emitter = next; bufferedAttributes = new AttributeCollectionImpl(getConfiguration()); }
/** * Create an XML Indenter * * @param next the next receiver in the pipeline, always an XMLEmitter */ public XMLIndenter(XMLEmitter next) { super(next); emitter = next; bufferedAttributes = new AttributeCollectionImpl(getConfiguration()); }
/** * Create an attribute list as a copy of an existing attribute list * * @param atts the existing attribute list to be copied * @return the copied attribute list. Note that if the original attribute list * is empty, the method returns the singleton object {@link #EMPTY_ATTRIBUTE_COLLECTION}; * this case must therefore be handled specially if the returned attribute list is to * be modified. */ /*@Nullable*/ public static AttributeCollectionImpl copy(/*@NotNull*/ AttributeCollectionImpl atts) { if (atts.getLength() == 0) { return EMPTY_ATTRIBUTE_COLLECTION; } AttributeCollectionImpl t = new AttributeCollectionImpl(atts.config); t.used = atts.used; t.names = new NodeName[atts.used]; t.values = new String[atts.used]; t.props = new int[atts.used]; t.locations = new Location[atts.used]; System.arraycopy(atts.names, 0, t.names, 0, atts.used); System.arraycopy(atts.values, 0, t.values, 0, atts.used); System.arraycopy(atts.props, 0, t.props, 0, atts.used); System.arraycopy(atts.locations, 0, t.locations, 0, atts.used); if (atts.types != null) { t.types = new SimpleType[atts.used]; System.arraycopy(atts.types, 0, t.types, 0, atts.used); } return t; }
/** * Create an attribute list as a copy of an existing attribute list * * @param atts the existing attribute list to be copied * @return the copied attribute list. Note that if the original attribute list * is empty, the method returns the singleton object {@link #EMPTY_ATTRIBUTE_COLLECTION}; * this case must therefore be handled specially if the returned attribute list is to * be modified. */ /*@Nullable*/ public static AttributeCollectionImpl copy(/*@NotNull*/ AttributeCollectionImpl atts) { if (atts.getLength() == 0) { return EMPTY_ATTRIBUTE_COLLECTION; } AttributeCollectionImpl t = new AttributeCollectionImpl(atts.config); t.used = atts.used; t.names = new NodeName[atts.used]; t.values = new String[atts.used]; t.props = new int[atts.used]; t.locations = new Location[atts.used]; System.arraycopy(atts.names, 0, t.names, 0, atts.used); System.arraycopy(atts.values, 0, t.values, 0, atts.used); System.arraycopy(atts.props, 0, t.props, 0, atts.used); System.arraycopy(atts.locations, 0, t.locations, 0, atts.used); if (atts.types != null) { t.types = new SimpleType[atts.used]; System.arraycopy(atts.types, 0, t.types, 0, atts.used); } return t; }
/** * Set the pipeline configuration * * @param pipe the pipeline configuration */ public void setPipelineConfiguration(/*@NotNull*/ PipelineConfiguration pipe) { super.setPipelineConfiguration(pipe); bufferedAttributes = new AttributeCollectionImpl(pipe.getConfiguration()); }
/** * Set the pipeline configuration * * @param pipe the pipeline configuration */ public void setPipelineConfiguration(/*@NotNull*/ PipelineConfiguration pipe) { super.setPipelineConfiguration(pipe); bufferedAttributes = new AttributeCollectionImpl(pipe.getConfiguration()); }
public void attribute(NodeName attName, SimpleType typeCode, /*@NotNull*/ CharSequence value, Location locationId, int properties) throws XPathException { properties &= ~ReceiverOptions.DISABLE_ESCAPING; if (contentStarted) { throw new IllegalStateException("attribute() called after startContent()"); } if (attributes == null) { attributes = new AttributeCollectionImpl(config); } if (attName.hasURI(NamespaceConstant.XML) && attName.getLocalPart().equals("id")) { value = Whitespace.trim(value); } attributes.addAttribute(attName, typeCode, value.toString(), locationId, properties); }
public void attribute(NodeName attName, SimpleType typeCode, /*@NotNull*/ CharSequence value, Location locationId, int properties) throws XPathException { properties &= ~ReceiverOptions.DISABLE_ESCAPING; if (contentStarted) { throw new IllegalStateException("attribute() called after startContent()"); } if (attributes == null) { attributes = new AttributeCollectionImpl(config); } if (attName.hasURI(NamespaceConstant.XML) && attName.getLocalPart().equals("id")) { value = Whitespace.trim(value); } attributes.addAttribute(attName, typeCode, value.toString(), locationId, properties); }
/** * Notify the start of the event stream */ public void open() throws XPathException { pendingAttributes = new AttributeCollectionImpl(getPipelineConfiguration().getConfiguration()); if (handler == null) { throw new IllegalStateException("ContentHandlerProxy.open(): no underlying handler provided"); } try { Locator locator = new ContentHandlerProxyLocator(this); handler.setDocumentLocator(locator); handler.startDocument(); } catch (SAXException err) { handleSAXException(err); } depth = 0; }
/** * Notify the start of the event stream */ public void open() throws XPathException { pendingAttributes = new AttributeCollectionImpl(getPipelineConfiguration().getConfiguration()); if (handler == null) { throw new IllegalStateException("ContentHandlerProxy.open(): no underlying handler provided"); } try { Locator locator = new ContentHandlerProxyLocator(this); handler.setDocumentLocator(locator); handler.startDocument(); } catch (SAXException err) { handleSAXException(err); } depth = 0; }
attributeList = new AttributeCollectionImpl(getConfiguration());
attributeList = new AttributeCollectionImpl(getConfiguration());
/** * Notify the start of the content, that is, the completion of all attributes and namespaces. * Note that the initial receiver of output from XSLT instructions will not receive this event, * it has to detect it itself. Note that this event is reported for every element even if it has * no attributes, no namespaces, and no content. */ public void startContent() throws XPathException { if (foundHead) { foundHead = false; nextReceiver.startContent(); FingerprintedQName metaCode = new FingerprintedQName(headPrefix, headURI, "meta"); nextReceiver.startElement(metaCode, Untyped.getInstance(), null, 0); nextReceiver.attribute(new NoNamespaceName("http-equiv"), BuiltInAtomicType.UNTYPED_ATOMIC, "Content-Type", null, 0); nextReceiver.attribute(new NoNamespaceName("content"), BuiltInAtomicType.UNTYPED_ATOMIC, mediaType + "; charset=" + encoding, null, 0); nextReceiver.startContent(); droppingMetaTags = level; seekingHead = false; attributes = new AttributeCollectionImpl(getConfiguration()); nextReceiver.endElement(); } if (!inMetaTag) { nextReceiver.startContent(); } }
/** * Notify the start of the content, that is, the completion of all attributes and namespaces. * Note that the initial receiver of output from XSLT instructions will not receive this event, * it has to detect it itself. Note that this event is reported for every element even if it has * no attributes, no namespaces, and no content. */ public void startContent() throws XPathException { if (foundHead) { foundHead = false; nextReceiver.startContent(); FingerprintedQName metaCode = new FingerprintedQName(headPrefix, headURI, "meta"); nextReceiver.startElement(metaCode, Untyped.getInstance(), null, 0); nextReceiver.attribute(new NoNamespaceName("http-equiv"), BuiltInAtomicType.UNTYPED_ATOMIC, "Content-Type", null, 0); nextReceiver.attribute(new NoNamespaceName("content"), BuiltInAtomicType.UNTYPED_ATOMIC, mediaType + "; charset=" + encoding, null, 0); nextReceiver.startContent(); droppingMetaTags = level; seekingHead = false; attributes = new AttributeCollectionImpl(getConfiguration()); nextReceiver.endElement(); } if (!inMetaTag) { nextReceiver.startContent(); } }