code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public static String getVersion() { return getProduct()+" "+getImplementationLanguage()+" " +getMajorVersionNum()+"."+getReleaseVersionNum()+"." +( (getDevelopmentVersionNum() > 0) ? ("D"+getDevelopmentVersionNum()) : (""+getMaintenanceVersionNum())); }
Get the basic version string for the current Serializer. Version String formatted like <CODE>"<B>Serializer</B> <B>Java</B> v.r[.dd| <B>D</B>nn]"</CODE>. Futurework: have this read version info from jar manifest. @return String denoting our current version
Version::getVersion
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public static void main(String argv[]) { System.out.println(getVersion()); }
Print the processor version to the command line. @param argv command line arguments, unused.
Version::main
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public static String getProduct() { return "Serializer"; }
Name of product: Serializer.
Version::getProduct
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public static String getImplementationLanguage() { return "Java"; }
Implementation Language: Java.
Version::getImplementationLanguage
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public static int getMajorVersionNum() { return 2; }
Major version number. Version number. This changes only when there is a significant, externally apparent enhancement from the previous release. 'n' represents the n'th version. Clients should carefully consider the implications of new versions as external interfaces and behaviour may have changed.
Version::getMajorVersionNum
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public static int getReleaseVersionNum() { return 7; }
Release Number. Release number. This changes when: - a new set of functionality is to be added, eg, implementation of a new W3C specification. - API or behaviour change. - its designated as a reference release.
Version::getReleaseVersionNum
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public static int getMaintenanceVersionNum() { return 1; }
Maintenance Drop Number. Optional identifier used to designate maintenance drop applied to a specific release and contains fixes for defects reported. It maintains compatibility with the release and contains no API changes. When missing, it designates the final and complete development drop for a release.
Version::getMaintenanceVersionNum
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public static int getDevelopmentVersionNum() { try { if ((new String("")).length() == 0) return 0; else return Integer.parseInt(""); } catch (NumberFormatException nfe) { return 0; } }
Development Drop Number. Optional identifier designates development drop of a specific release. D01 is the first development drop of a new release. Development drops are works in progress towards a compeleted, final release. A specific development drop may not completely implement all aspects of a new feature, which may take several development drops to complete. At the point of the final drop for the release, the D suffix will be omitted. Each 'D' drops can contain functional enhancements as well as defect fixes. 'D' drops may not be as stable as the final releases.
Version::getDevelopmentVersionNum
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Version.java
Apache-2.0
public ContentHandler getContentHandler() { return m_contentHandler; }
Get the ContentHandler used for the tree walk. @return the ContentHandler used for the tree walk
TreeWalker::getContentHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
Apache-2.0
public TreeWalker(ContentHandler contentHandler, String systemId) { // Set the content handler m_contentHandler = contentHandler; if (m_contentHandler instanceof SerializationHandler) { m_Serializer = (SerializationHandler) m_contentHandler; } else m_Serializer = null; // Set the system ID, if it is given m_contentHandler.setDocumentLocator(m_locator); if (systemId != null) m_locator.setSystemId(systemId); else { try { // Bug see Bugzilla 26741 m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) {// user.dir not accessible from applet } } // Set the document locator if (m_contentHandler != null) m_contentHandler.setDocumentLocator(m_locator); try { // Bug see Bugzilla 26741 m_locator.setSystemId(System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se){// user.dir not accessible from applet } m_dh = new DOM2Helper(); }
Constructor. @param contentHandler The implemention of the contentHandler operation (toXMLString, digest, ...)
TreeWalker::TreeWalker
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
Apache-2.0
public void traverse(Node pos) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); Node top = pos; while (null != pos) { startNode(pos); Node nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if (top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || (top.equals(pos))) { if (null != pos) endNode(pos); nextNode = null; break; } } } pos = nextNode; } this.m_contentHandler.endDocument(); }
Perform a pre-order traversal non-recursive style. Note that TreeWalker assumes that the subtree is intended to represent a complete (though not necessarily well-formed) document and, during a traversal, startDocument and endDocument will always be issued to the SAX listener. @param pos Node in the tree where to start traversal @throws TransformerException
TreeWalker::traverse
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
Apache-2.0
public void traverse(Node pos, Node top) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); while (null != pos) { startNode(pos); Node nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if ((null != top) && top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || ((null != top) && top.equals(pos))) { nextNode = null; break; } } } pos = nextNode; } this.m_contentHandler.endDocument(); }
Perform a pre-order traversal non-recursive style. Note that TreeWalker assumes that the subtree is intended to represent a complete (though not necessarily well-formed) document and, during a traversal, startDocument and endDocument will always be issued to the SAX listener. @param pos Node in the tree where to start traversal @param top Node in the tree where to end traversal @throws TransformerException
TreeWalker::traverse
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
Apache-2.0
private final void dispatachChars(Node node) throws org.xml.sax.SAXException { if(m_Serializer != null) { this.m_Serializer.characters(node); } else { String data = ((Text) node).getData(); this.m_contentHandler.characters(data.toCharArray(), 0, data.length()); } }
Optimized dispatch of characters.
TreeWalker::dispatachChars
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
Apache-2.0
protected void startNode(Node node) throws org.xml.sax.SAXException { // TODO: <REVIEW> // A Serializer implements ContentHandler, but not NodeConsumer // so drop this reference to NodeConsumer which would otherwise // pull in all sorts of things // if (m_contentHandler instanceof NodeConsumer) // { // ((NodeConsumer) m_contentHandler).setOriginatingNode(node); // } // TODO: </REVIEW> if (node instanceof Locator) { Locator loc = (Locator)node; m_locator.setColumnNumber(loc.getColumnNumber()); m_locator.setLineNumber(loc.getLineNumber()); m_locator.setPublicId(loc.getPublicId()); m_locator.setSystemId(loc.getSystemId()); } else { m_locator.setColumnNumber(0); m_locator.setLineNumber(0); } switch (node.getNodeType()) { case Node.COMMENT_NODE : { String data = ((Comment) node).getData(); if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.comment(data.toCharArray(), 0, data.length()); } } break; case Node.DOCUMENT_FRAGMENT_NODE : // ??; break; case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : Element elem_node = (Element) node; { // Make sure the namespace node // for the element itself is declared // to the ContentHandler String uri = elem_node.getNamespaceURI(); if (uri != null) { String prefix = elem_node.getPrefix(); if (prefix==null) prefix=""; this.m_contentHandler.startPrefixMapping(prefix,uri); } } NamedNodeMap atts = elem_node.getAttributes(); int nAttrs = atts.getLength(); // System.out.println("TreeWalker#startNode: "+node.getNodeName()); // Make sure the namespace node of // each attribute is declared to the ContentHandler for (int i = 0; i < nAttrs; i++) { final Node attr = atts.item(i); final String attrName = attr.getNodeName(); final int colon = attrName.indexOf(':'); final String prefix; // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue()); if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" <[email protected]>. if (colon < 0) prefix = ""; else prefix = attrName.substring(colon + 1); this.m_contentHandler.startPrefixMapping(prefix, attr.getNodeValue()); } else if (colon > 0) { prefix = attrName.substring(0,colon); String uri = attr.getNamespaceURI(); if (uri != null) this.m_contentHandler.startPrefixMapping(prefix,uri); } } String ns = m_dh.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName(), new AttList(atts, m_dh)); break; case Node.PROCESSING_INSTRUCTION_NODE : { ProcessingInstruction pi = (ProcessingInstruction) node; String name = pi.getNodeName(); // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { nextIsRaw = true; } else { this.m_contentHandler.processingInstruction(pi.getNodeName(), pi.getData()); } } break; case Node.CDATA_SECTION_NODE : { boolean isLexH = (m_contentHandler instanceof LexicalHandler); LexicalHandler lh = isLexH ? ((LexicalHandler) this.m_contentHandler) : null; if (isLexH) { lh.startCDATA(); } dispatachChars(node); { if (isLexH) { lh.endCDATA(); } } } break; case Node.TEXT_NODE : { //String data = ((Text) node).getData(); if (nextIsRaw) { nextIsRaw = false; m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { dispatachChars(node); } } break; case Node.ENTITY_REFERENCE_NODE : { EntityReference eref = (EntityReference) node; if (m_contentHandler instanceof LexicalHandler) { ((LexicalHandler) this.m_contentHandler).startEntity( eref.getNodeName()); } else { // warning("Can not output entity to a pure SAX ContentHandler"); } } break; default : } }
Start processing given node @param node Node to process @throws org.xml.sax.SAXException
TreeWalker::startNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
Apache-2.0
protected void endNode(Node node) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : String ns = m_dh.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.endElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName()); if (m_Serializer == null) { // Don't bother with endPrefixMapping calls if the ContentHandler is a // SerializationHandler because SerializationHandler's ignore the // endPrefixMapping() calls anyways. . . . This is an optimization. Element elem_node = (Element) node; NamedNodeMap atts = elem_node.getAttributes(); int nAttrs = atts.getLength(); // do the endPrefixMapping calls in reverse order // of the startPrefixMapping calls for (int i = (nAttrs-1); 0 <= i; i--) { final Node attr = atts.item(i); final String attrName = attr.getNodeName(); final int colon = attrName.indexOf(':'); final String prefix; if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" <[email protected]>. if (colon < 0) prefix = ""; else prefix = attrName.substring(colon + 1); this.m_contentHandler.endPrefixMapping(prefix); } else if (colon > 0) { prefix = attrName.substring(0, colon); this.m_contentHandler.endPrefixMapping(prefix); } } { String uri = elem_node.getNamespaceURI(); if (uri != null) { String prefix = elem_node.getPrefix(); if (prefix==null) prefix=""; this.m_contentHandler.endPrefixMapping(prefix); } } } break; case Node.CDATA_SECTION_NODE : break; case Node.ENTITY_REFERENCE_NODE : { EntityReference eref = (EntityReference) node; if (m_contentHandler instanceof LexicalHandler) { LexicalHandler lh = ((LexicalHandler) this.m_contentHandler); lh.endEntity(eref.getNodeName()); } } break; default : } }
End processing of given node @param node Node we just finished processing @throws org.xml.sax.SAXException
TreeWalker::endNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/TreeWalker.java
Apache-2.0
ElemContext() { // this assignment means can never pop this context off m_prev = this; // depth 0 because it doesn't correspond to any element m_currentElemDepth = 0; }
Constructor to create the root of the element contexts.
ElemContext::ElemContext
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
Apache-2.0
private ElemContext(final ElemContext previous) { m_prev = previous; m_currentElemDepth = previous.m_currentElemDepth + 1; }
Constructor to create the "stack frame" for a given element depth. This implementation will re-use the context at each depth. If a documents deepest element depth is N then there will be (N+1) such objects created, no more than that. @param previous The "stack frame" corresponding to the new elements parent element.
ElemContext::ElemContext
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
Apache-2.0
final ElemContext pop() { /* a very simple pop. No clean up is done of the deeper * stack frame. All deeper stack frames are still attached * but dormant, just waiting to be re-used. */ return this.m_prev; }
Pop the current "stack frame". @return Returns the parent "stack frame" of the one popped.
ElemContext::pop
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
Apache-2.0
final ElemContext push() { ElemContext frame = this.m_next; if (frame == null) { /* We have never been at this depth yet, and there is no * stack frame to re-use, so we now make a new one. */ frame = new ElemContext(this); this.m_next = frame; } /* * We shouldn't need to set this true because we should just * be pushing a dummy stack frame that will be instantly popped. * Yet we need to be ready in case this element does have * unexpected children. */ frame.m_startTagOpen = true; return frame; }
This method pushes an element "stack frame" but with no initialization of values in that frame. This method is used for optimization purposes, like when pushing a stack frame for an HTML "IMG" tag which has no children and the stack frame will almost immediately be popped.
ElemContext::push
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
Apache-2.0
final ElemContext push( final String uri, final String localName, final String qName) { ElemContext frame = this.m_next; if (frame == null) { /* We have never been at this depth yet, and there is no * stack frame to re-use, so we now make a new one. */ frame = new ElemContext(this); this.m_next = frame; } // Initialize, or reset values in the new or re-used stack frame. frame.m_elementName = qName; frame.m_elementLocalName = localName; frame.m_elementURI = uri; frame.m_isCdataSection = false; frame.m_startTagOpen = true; // is_Raw is already set in the HTML startElement() method // frame.m_isRaw = false; return frame; }
Push an element context on the stack. This context keeps track of information gathered about the element. @param uri The URI for the namespace for the element name, can be null if it is not yet known. @param localName The local name of the element (no prefix), can be null. @param qName The qualified name (with prefix, if any) of the element, this parameter is required.
ElemContext::push
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java
Apache-2.0
public static Serializer getSerializer(Properties format) { Serializer ser; try { String method = format.getProperty(OutputKeys.METHOD); if (method == null) { String msg = Utils.messages.createMessage( MsgKey.ER_FACTORY_PROPERTY_MISSING, new Object[] { OutputKeys.METHOD}); throw new IllegalArgumentException(msg); } String className = format.getProperty(OutputPropertiesFactory.S_KEY_CONTENT_HANDLER); if (null == className) { // Missing Content Handler property, load default using OutputPropertiesFactory Properties methodDefaults = OutputPropertiesFactory.getDefaultMethodProperties(method); className = methodDefaults.getProperty(OutputPropertiesFactory.S_KEY_CONTENT_HANDLER); if (null == className) { String msg = Utils.messages.createMessage( MsgKey.ER_FACTORY_PROPERTY_MISSING, new Object[] { OutputPropertiesFactory.S_KEY_CONTENT_HANDLER}); throw new IllegalArgumentException(msg); } } ClassLoader loader = ObjectFactory.findClassLoader(); Class cls = ObjectFactory.findProviderClass(className, loader, true); // _serializers.put(method, cls); Object obj = cls.newInstance(); if (obj instanceof SerializationHandler) { // this is one of the supplied serializers ser = (Serializer) cls.newInstance(); ser.setOutputFormat(format); } else { /* * This must be a user defined Serializer. * It had better implement ContentHandler. */ if (obj instanceof ContentHandler) { /* * The user defined serializer defines ContentHandler, * but we need to wrap it with ToXMLSAXHandler which * will collect SAX-like events and emit true * SAX ContentHandler events to the users handler. */ className = SerializerConstants.DEFAULT_SAX_SERIALIZER; cls = ObjectFactory.findProviderClass(className, loader, true); SerializationHandler sh = (SerializationHandler) cls.newInstance(); sh.setContentHandler( (ContentHandler) obj); sh.setOutputFormat(format); ser = sh; } else { // user defined serializer does not implement // ContentHandler, ... very bad throw new Exception( Utils.messages.createMessage( MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER, new Object[] { className})); } } } catch (Exception e) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(e); } // If we make it to here ser is not null. return ser; }
Returns a serializer for the specified output method. The output method is specified by the value of the property associated with the "method" key. If no implementation exists that supports the specified output method an exception of some type will be thrown. For a list of the output "method" key values see {@link Method}. @param format The output format, minimally the "method" property must be set. @return A suitable serializer. @throws IllegalArgumentException if method is null or an appropriate serializer can't be found @throws Exception if the class for the serializer is found but does not implement ContentHandler. @throws WrappedRuntimeException if an exception is thrown while trying to find serializer
SerializerFactory::getSerializer
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerFactory.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerFactory.java
Apache-2.0
ElemDesc(int flags) { m_flags = flags; }
Construct an ElemDesc from a set of bit flags. @param flags Bit flags that describe the basic properties of this element type.
ElemDesc::ElemDesc
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
Apache-2.0
private boolean is(int flags) { // int which = (m_flags & flags); return (m_flags & flags) != 0; }
Tell if this element type has the basic bit properties that are passed as an argument. @param flags Bit flags that describe the basic properties of interest. @return true if any of the flag bits are true.
ElemDesc::is
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
Apache-2.0
void setAttr(String name, int flags) { if (null == m_attrs) m_attrs = new StringToIntTable(); m_attrs.put(name, flags); }
Set an attribute name and it's bit properties. @param name non-null name of attribute, in upper case. @param flags flag bits.
ElemDesc::setAttr
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
Apache-2.0
public boolean isAttrFlagSet(String name, int flags) { return (null != m_attrs) ? ((m_attrs.getIgnoreCase(name) & flags) != 0) : false; }
Tell if any of the bits of interest are set for a named attribute type. @param name non-null reference to attribute name, in any case. @param flags flag mask. @return true if any of the flags are set for the named attribute.
ElemDesc::isAttrFlagSet
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java
Apache-2.0
public Properties getOutputFormat() { return null; }
@see Serializer#getOutputFormat()
ToXMLSAXHandler::getOutputFormat
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public OutputStream getOutputStream() { return null; }
@see Serializer#getOutputStream()
ToXMLSAXHandler::getOutputStream
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public Writer getWriter() { return null; }
@see Serializer#getWriter()
ToXMLSAXHandler::getWriter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void indent(int n) throws SAXException { }
Do nothing for SAX.
ToXMLSAXHandler::indent
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void serialize(Node node) throws IOException { }
@see DOMSerializer#serialize(Node)
ToXMLSAXHandler::serialize
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public boolean setEscaping(boolean escape) throws SAXException { boolean oldEscapeSetting = m_escapeSetting; m_escapeSetting = escape; if (escape) { processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, ""); } return oldEscapeSetting; }
@see SerializationHandler#setEscaping(boolean)
ToXMLSAXHandler::setEscaping
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void setOutputFormat(Properties format) { }
@see Serializer#setOutputFormat(Properties)
ToXMLSAXHandler::setOutputFormat
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void setOutputStream(OutputStream output) { }
@see Serializer#setOutputStream(OutputStream)
ToXMLSAXHandler::setOutputStream
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void setWriter(Writer writer) { }
@see Serializer#setWriter(Writer)
ToXMLSAXHandler::setWriter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void attributeDecl( String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException { }
@see org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String, String, String)
ToXMLSAXHandler::attributeDecl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void elementDecl(String arg0, String arg1) throws SAXException { }
@see org.xml.sax.ext.DeclHandler#elementDecl(String, String)
ToXMLSAXHandler::elementDecl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException { }
@see org.xml.sax.ext.DeclHandler#externalEntityDecl(String, String, String)
ToXMLSAXHandler::externalEntityDecl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void internalEntityDecl(String arg0, String arg1) throws SAXException { }
@see org.xml.sax.ext.DeclHandler#internalEntityDecl(String, String)
ToXMLSAXHandler::internalEntityDecl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void endDocument() throws SAXException { flushPending(); // Close output document m_saxHandler.endDocument(); if (m_tracer != null) super.fireEndDoc(); }
Receives notification of the end of the document. @see org.xml.sax.ContentHandler#endDocument()
ToXMLSAXHandler::endDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
protected void closeStartTag() throws SAXException { m_elemContext.m_startTagOpen = false; final String localName = getLocalName(m_elemContext.m_elementName); final String uri = getNamespaceURI(m_elemContext.m_elementName, true); // Now is time to send the startElement event if (m_needToCallStartDocument) { startDocumentInternal(); } m_saxHandler.startElement(uri, localName, m_elemContext.m_elementName, m_attributes); // we've sent the official SAX attributes on their way, // now we don't need them anymore. m_attributes.clear(); if(m_state != null) m_state.setCurrentNode(null); }
This method is called when all the data needed for a call to the SAX handler's startElement() method has been gathered.
ToXMLSAXHandler::closeStartTag
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void closeCDATA() throws SAXException { // Output closing bracket - "]]>" if (m_lexHandler != null && m_cdataTagOpen) { m_lexHandler.endCDATA(); } // There are no longer any calls made to // m_lexHandler.startCDATA() without a balancing call to // m_lexHandler.endCDATA() // so we set m_cdataTagOpen to false to remember this. m_cdataTagOpen = false; }
Closes ane open cdata tag, and unlike the this.endCDATA() method (from the LexicalHandler) interface, this "internal" method will send the endCDATA() call to the wrapped handler.
ToXMLSAXHandler::closeCDATA
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void endElement(String namespaceURI, String localName, String qName) throws SAXException { // Close any open elements etc. flushPending(); if (namespaceURI == null) { if (m_elemContext.m_elementURI != null) namespaceURI = m_elemContext.m_elementURI; else namespaceURI = getNamespaceURI(qName, true); } if (localName == null) { if (m_elemContext.m_elementLocalName != null) localName = m_elemContext.m_elementLocalName; else localName = getLocalName(qName); } m_saxHandler.endElement(namespaceURI, localName, qName); if (m_tracer != null) super.fireEndElem(qName); /* Pop all namespaces at the current element depth. * We are not waiting for official endPrefixMapping() calls. */ m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, m_saxHandler); m_elemContext = m_elemContext.m_prev; }
@see org.xml.sax.ContentHandler#endElement(String, String, String)
ToXMLSAXHandler::endElement
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void endPrefixMapping(String prefix) throws SAXException { /* poping all prefix mappings should have been done * in endElement() already */ return; }
@see org.xml.sax.ContentHandler#endPrefixMapping(String)
ToXMLSAXHandler::endPrefixMapping
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException { m_saxHandler.ignorableWhitespace(arg0,arg1,arg2); }
@see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
ToXMLSAXHandler::ignorableWhitespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void setDocumentLocator(Locator arg0) { m_saxHandler.setDocumentLocator(arg0); }
@see org.xml.sax.ContentHandler#setDocumentLocator(Locator)
ToXMLSAXHandler::setDocumentLocator
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void skippedEntity(String arg0) throws SAXException { m_saxHandler.skippedEntity(arg0); }
@see org.xml.sax.ContentHandler#skippedEntity(String)
ToXMLSAXHandler::skippedEntity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void startPrefixMapping(String prefix, String uri) throws SAXException { startPrefixMapping(prefix, uri, true); }
@see org.xml.sax.ContentHandler#startPrefixMapping(String, String) @param prefix The prefix that maps to the URI @param uri The URI for the namespace
ToXMLSAXHandler::startPrefixMapping
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void comment(char[] arg0, int arg1, int arg2) throws SAXException { flushPending(); if (m_lexHandler != null) m_lexHandler.comment(arg0, arg1, arg2); if (m_tracer != null) super.fireCommentEvent(arg0, arg1, arg2); }
@see org.xml.sax.ext.LexicalHandler#comment(char[], int, int)
ToXMLSAXHandler::comment
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void endCDATA() throws SAXException { /* Normally we would do somthing with this but we ignore it. * The neccessary call to m_lexHandler.endCDATA() will be made * in flushPending(). * * This is so that if we get calls like these: * this.startCDATA(); * this.characters(chars1, off1, len1); * this.endCDATA(); * this.startCDATA(); * this.characters(chars2, off2, len2); * this.endCDATA(); * * that we will only make these calls to the wrapped handlers: * * m_lexHandler.startCDATA(); * m_saxHandler.characters(chars1, off1, len1); * m_saxHandler.characters(chars1, off2, len2); * m_lexHandler.endCDATA(); * * We will merge adjacent CDATA blocks. */ }
@see org.xml.sax.ext.LexicalHandler#endCDATA()
ToXMLSAXHandler::endCDATA
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void endDTD() throws SAXException { if (m_lexHandler != null) m_lexHandler.endDTD(); }
@see org.xml.sax.ext.LexicalHandler#endDTD()
ToXMLSAXHandler::endDTD
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void startEntity(String arg0) throws SAXException { if (m_lexHandler != null) m_lexHandler.startEntity(arg0); }
@see org.xml.sax.ext.LexicalHandler#startEntity(String)
ToXMLSAXHandler::startEntity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void characters(String chars) throws SAXException { final int length = chars.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } chars.getChars(0, length, m_charsBuff, 0); this.characters(m_charsBuff, 0, length); }
@see ExtendedContentHandler#characters(String)
ToXMLSAXHandler::characters
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void startElement( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { startElement( elementNamespaceURI,elementLocalName,elementName, null); }
Start an element in the output document. This might be an XML element (<elem>data</elem> type) or a CDATA section.
ToXMLSAXHandler::startElement
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void endElement(String elemName) throws SAXException { endElement(null, null, elemName); }
@see ExtendedContentHandler#endElement(String)
ToXMLSAXHandler::endElement
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { startPrefixMapping(prefix,uri,false); }
Send a namespace declaration in the output document. The namespace declaration will not be include if the namespace is already in scope with the same prefix.
ToXMLSAXHandler::namespaceAfterStartElement
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void processingInstruction(String target, String data) throws SAXException { flushPending(); // Pass the processing instruction to the SAX handler m_saxHandler.processingInstruction(target, data); // we don't want to leave serializer to fire off this event, // so do it here. if (m_tracer != null) super.fireEscapingEvent(target, data); }
@see org.xml.sax.ContentHandler#processingInstruction(String, String) Send a processing instruction to the output document
ToXMLSAXHandler::processingInstruction
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
protected boolean popNamespace(String prefix) { try { if (m_prefixMap.popNamespace(prefix)) { m_saxHandler.endPrefixMapping(prefix); return true; } } catch (SAXException e) { // falls through } return false; }
Undeclare the namespace that is currently pointed to by a given prefix. Inform SAX handler if prefix was previously mapped.
ToXMLSAXHandler::popNamespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void startElement( String namespaceURI, String localName, String name, Attributes atts) throws SAXException { flushPending(); super.startElement(namespaceURI, localName, name, atts); // Handle document type declaration (for first element only) if (m_needToOutputDocTypeDecl) { String doctypeSystem = getDoctypeSystem(); if (doctypeSystem != null && m_lexHandler != null) { String doctypePublic = getDoctypePublic(); if (doctypeSystem != null) m_lexHandler.startDTD( name, doctypePublic, doctypeSystem); } m_needToOutputDocTypeDecl = false; } m_elemContext = m_elemContext.push(namespaceURI, localName, name); // ensurePrefixIsDeclared depends on the current depth, so // the previous increment is necessary where it is. if (namespaceURI != null) ensurePrefixIsDeclared(namespaceURI, name); // add the attributes to the collected ones if (atts != null) addAttributes(atts); // do we really need this CDATA section state? m_elemContext.m_isCdataSection = isCdataSection(); }
@see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
ToXMLSAXHandler::startElement
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException { if (m_elemContext.m_startTagOpen) { ensurePrefixIsDeclared(uri, rawName); addAttributeAlways(uri, localName, rawName, type, value, false); } }
Adds the given attribute to the set of attributes, and also makes sure that the needed prefix/uri mapping is declared, but only if there is a currently open element. @param uri the URI of the attribute @param localName the local name of the attribute @param rawName the qualified name of the attribute @param type the type of the attribute (probably CDATA) @param value the value of the attribute @param XSLAttribute true if this attribute is coming from an xsl:attribute element @see ExtendedContentHandler#addAttribute(String, String, String, String, String)
ToXMLSAXHandler::addAttribute
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
public boolean reset() { boolean wasReset = false; if (super.reset()) { resetToXMLSAXHandler(); wasReset = true; } return wasReset; }
Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons). @return true if the class was successfuly reset. @see Serializer#reset()
ToXMLSAXHandler::reset
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
private void resetToXMLSAXHandler() { this.m_escapeSetting = true; }
Reset all of the fields owned by ToXMLSAXHandler class
ToXMLSAXHandler::resetToXMLSAXHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
Apache-2.0
DOM3TreeWalker( SerializationHandler serialHandler, DOMErrorHandler errHandler, LSSerializerFilter filter, String newLine) { fSerializer = serialHandler; //fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default? fErrorHandler = errHandler; fFilter = filter; fLexicalHandler = null; fNewLine = newLine; fNSBinder = new NamespaceSupport(); fLocalNSBinder = new NamespaceSupport(); fDOMConfigProperties = fSerializer.getOutputFormat(); fSerializer.setDocumentLocator(fLocator); initProperties(fDOMConfigProperties); try { // Bug see Bugzilla 26741 fLocator.setSystemId( System.getProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) { // user.dir not accessible from applet } }
Constructor. @param contentHandler serialHandler The implemention of the SerializationHandler interface
DOM3TreeWalker::DOM3TreeWalker
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
public void traverse(Node pos) throws org.xml.sax.SAXException { this.fSerializer.startDocument(); // Determine if the Node is a DOM Level 3 Core Node. if (pos.getNodeType() != Node.DOCUMENT_NODE) { Document ownerDoc = pos.getOwnerDocument(); if (ownerDoc != null && ownerDoc.getImplementation().hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } else { if (((Document) pos) .getImplementation() .hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } if (fSerializer instanceof LexicalHandler) { fLexicalHandler = ((LexicalHandler) this.fSerializer); } if (fFilter != null) fWhatToShowFilter = fFilter.getWhatToShow(); Node top = pos; while (null != pos) { startNode(pos); Node nextNode = null; nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if (top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || (top.equals(pos))) { if (null != pos) endNode(pos); nextNode = null; break; } } } pos = nextNode; } this.fSerializer.endDocument(); }
Perform a pre-order traversal non-recursive style. Note that TreeWalker assumes that the subtree is intended to represent a complete (though not necessarily well-formed) document and, during a traversal, startDocument and endDocument will always be issued to the SAX listener. @param pos Node in the tree where to start traversal @throws TransformerException
DOM3TreeWalker::traverse
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
public void traverse(Node pos, Node top) throws org.xml.sax.SAXException { this.fSerializer.startDocument(); // Determine if the Node is a DOM Level 3 Core Node. if (pos.getNodeType() != Node.DOCUMENT_NODE) { Document ownerDoc = pos.getOwnerDocument(); if (ownerDoc != null && ownerDoc.getImplementation().hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } else { if (((Document) pos) .getImplementation() .hasFeature("Core", "3.0")) { fIsLevel3DOM = true; } } if (fSerializer instanceof LexicalHandler) { fLexicalHandler = ((LexicalHandler) this.fSerializer); } if (fFilter != null) fWhatToShowFilter = fFilter.getWhatToShow(); while (null != pos) { startNode(pos); Node nextNode = null; nextNode = pos.getFirstChild(); while (null == nextNode) { endNode(pos); if ((null != top) && top.equals(pos)) break; nextNode = pos.getNextSibling(); if (null == nextNode) { pos = pos.getParentNode(); if ((null == pos) || ((null != top) && top.equals(pos))) { nextNode = null; break; } } } pos = nextNode; } this.fSerializer.endDocument(); }
Perform a pre-order traversal non-recursive style. Note that TreeWalker assumes that the subtree is intended to represent a complete (though not necessarily well-formed) document and, during a traversal, startDocument and endDocument will always be issued to the SAX listener. @param pos Node in the tree where to start traversal @param top Node in the tree where to end traversal @throws TransformerException
DOM3TreeWalker::traverse
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
private final void dispatachChars(Node node) throws org.xml.sax.SAXException { if (fSerializer != null) { this.fSerializer.characters(node); } else { String data = ((Text) node).getData(); this.fSerializer.characters(data.toCharArray(), 0, data.length()); } }
Optimized dispatch of characters.
DOM3TreeWalker::dispatachChars
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void startNode(Node node) throws org.xml.sax.SAXException { if (node instanceof Locator) { Locator loc = (Locator) node; fLocator.setColumnNumber(loc.getColumnNumber()); fLocator.setLineNumber(loc.getLineNumber()); fLocator.setPublicId(loc.getPublicId()); fLocator.setSystemId(loc.getSystemId()); } else { fLocator.setColumnNumber(0); fLocator.setLineNumber(0); } switch (node.getNodeType()) { case Node.DOCUMENT_TYPE_NODE : serializeDocType((DocumentType) node, true); break; case Node.COMMENT_NODE : serializeComment((Comment) node); break; case Node.DOCUMENT_FRAGMENT_NODE : // Children are traversed break; case Node.DOCUMENT_NODE : break; case Node.ELEMENT_NODE : serializeElement((Element) node, true); break; case Node.PROCESSING_INSTRUCTION_NODE : serializePI((ProcessingInstruction) node); break; case Node.CDATA_SECTION_NODE : serializeCDATASection((CDATASection) node); break; case Node.TEXT_NODE : serializeText((Text) node); break; case Node.ENTITY_REFERENCE_NODE : serializeEntityReference((EntityReference) node, true); break; default : } }
Start processing given node @param node Node to process @throws org.xml.sax.SAXException
DOM3TreeWalker::startNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void endNode(Node node) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_NODE : break; case Node.DOCUMENT_TYPE_NODE : serializeDocType((DocumentType) node, false); break; case Node.ELEMENT_NODE : serializeElement((Element) node, false); break; case Node.CDATA_SECTION_NODE : break; case Node.ENTITY_REFERENCE_NODE : serializeEntityReference((EntityReference) node, false); break; default : } }
End processing of given node @param node Node we just finished processing @throws org.xml.sax.SAXException
DOM3TreeWalker::endNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected boolean applyFilter(Node node, int nodeType) { if (fFilter != null && (fWhatToShowFilter & nodeType) != 0) { short code = fFilter.acceptNode(node); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : return false; // skip the node default : // fall through.. } } return true; }
Applies a filter on the node to serialize @param node The Node to serialize @return True if the node is to be serialized else false if the node is to be rejected or skipped.
DOM3TreeWalker::applyFilter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializeDocType(DocumentType node, boolean bStart) throws SAXException { // The DocType and internalSubset can not be modified in DOM and is // considered to be well-formed as the outcome of successful parsing. String docTypeName = node.getNodeName(); String publicId = node.getPublicId(); String systemId = node.getSystemId(); String internalSubset = node.getInternalSubset(); //DocumentType nodes are never passed to the filter if (internalSubset != null && !"".equals(internalSubset)) { if (bStart) { try { // The Serializer does not provide a way to write out the // DOCTYPE internal subset via an event call, so we write it // out here. Writer writer = fSerializer.getWriter(); StringBuffer dtd = new StringBuffer(); dtd.append("<!DOCTYPE "); dtd.append(docTypeName); if (null != publicId) { dtd.append(" PUBLIC \""); dtd.append(publicId); dtd.append('\"'); } if (null != systemId) { if (null == publicId) { dtd.append(" SYSTEM \""); } else { dtd.append(" \""); } dtd.append(systemId); dtd.append('\"'); } dtd.append(" [ "); dtd.append(fNewLine); dtd.append(internalSubset); dtd.append("]>"); dtd.append(new String(fNewLine)); writer.write(dtd.toString()); writer.flush(); } catch (IOException e) { throw new SAXException(Utils.messages.createMessage( MsgKey.ER_WRITING_INTERNAL_SUBSET, null), e); } } // else if !bStart do nothing } else { if (bStart) { if (fLexicalHandler != null) { fLexicalHandler.startDTD(docTypeName, publicId, systemId); } } else { if (fLexicalHandler != null) { fLexicalHandler.endDTD(); } } } }
Serializes a Document Type Node. @param node The Docuemnt Type Node to serialize @param bStart Invoked at the start or end of node. Default true.
DOM3TreeWalker::serializeDocType
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializeComment(Comment node) throws SAXException { // comments=true if ((fFeatures & COMMENTS) != 0) { String data = node.getData(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCommentWellFormed(data); } if (fLexicalHandler != null) { // apply the LSSerializer filter after the operations requested by the // DOMConfiguration parameters have been applied if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) { return; } fLexicalHandler.comment(data.toCharArray(), 0, data.length()); } } }
Serializes a Comment Node. @param node The Comment Node to serialize
DOM3TreeWalker::serializeComment
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializeElement(Element node, boolean bStart) throws SAXException { if (bStart) { fElementDepth++; // We use the Xalan specific startElement and starPrefixMapping calls // (and addAttribute and namespaceAfterStartElement) as opposed to // SAX specific, for performance reasons as they reduce the overhead // of creating an AttList object upfront. // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isElementWellFormed(node); } // REVISIT: We apply the LSSerializer filter for elements before // namesapce fixup if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } // namespaces=true, record and fixup namspaced element if ((fFeatures & NAMESPACES) != 0) { fNSBinder.pushContext(); fLocalNSBinder.reset(); recordLocalNSDecl(node); fixupElementNS(node); } // Namespace normalization fSerializer.startElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); serializeAttList(node); } else { fElementDepth--; // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } this.fSerializer.endElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); // since endPrefixMapping was not used by SerializationHandler it was removed // for performance reasons. if ((fFeatures & NAMESPACES) != 0 ) { fNSBinder.popContext(); } } }
Serializes an Element Node. @param node The Element Node to serialize @param bStart Invoked at the start or end of node.
DOM3TreeWalker::serializeElement
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializeAttList(Element node) throws SAXException { NamedNodeMap atts = node.getAttributes(); int nAttrs = atts.getLength(); for (int i = 0; i < nAttrs; i++) { Node attr = atts.item(i); String localName = attr.getLocalName(); String attrName = attr.getNodeName(); String attrPrefix = attr.getPrefix() == null ? "" : attr.getPrefix(); String attrValue = attr.getNodeValue(); // Determine the Attr's type. String type = null; if (fIsLevel3DOM) { type = ((Attr) attr).getSchemaTypeInfo().getTypeName(); } type = type == null ? "CDATA" : type; String attrNS = attr.getNamespaceURI(); if (attrNS !=null && attrNS.length() == 0) { attrNS=null; // we must remove prefix for this attribute attrName=attr.getLocalName(); } boolean isSpecified = ((Attr) attr).getSpecified(); boolean addAttr = true; boolean applyFilter = false; boolean xmlnsAttr = attrName.equals("xmlns") || attrName.startsWith("xmlns:"); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isAttributeWellFormed(attr); } //----------------------------------------------------------------- // start Attribute namespace fixup //----------------------------------------------------------------- // namespaces=true, normalize all non-namespace attributes // Step 3. Attribute if ((fFeatures & NAMESPACES) != 0 && !xmlnsAttr) { // If the Attr has a namespace URI if (attrNS != null) { attrPrefix = attrPrefix == null ? "" : attrPrefix; String declAttrPrefix = fNSBinder.getPrefix(attrNS); String declAttrNS = fNSBinder.getURI(attrPrefix); // attribute has no prefix (default namespace decl does not apply to // attributes) // OR // attribute prefix is not declared // OR // conflict: attribute has a prefix that conflicts with a binding if ("".equals(attrPrefix) || "".equals(declAttrPrefix) || !attrPrefix.equals(declAttrPrefix)) { // namespaceURI matches an in scope declaration of one or // more prefixes if (declAttrPrefix != null && !"".equals(declAttrPrefix)) { // pick the prefix that was found and change attribute's // prefix and nodeName. attrPrefix = declAttrPrefix; if (declAttrPrefix.length() > 0 ) { attrName = declAttrPrefix + ":" + localName; } else { attrName = localName; } } else { // The current prefix is not null and it has no in scope // declaration if (attrPrefix != null && !"".equals(attrPrefix) && declAttrNS == null) { // declare this prefix if ((fFeatures & NAMESPACEDECLS) != 0) { fSerializer.addAttribute(XMLNS_URI, attrPrefix, XMLNS_PREFIX + ":" + attrPrefix, "CDATA", attrNS); fNSBinder.declarePrefix(attrPrefix, attrNS); fLocalNSBinder.declarePrefix(attrPrefix, attrNS); } } else { // find a prefix following the pattern "NS" +index // (starting at 1) // make sure this prefix is not declared in the current // scope. int counter = 1; attrPrefix = "NS" + counter++; while (fLocalNSBinder.getURI(attrPrefix) != null) { attrPrefix = "NS" + counter++; } // change attribute's prefix and Name attrName = attrPrefix + ":" + localName; // create a local namespace declaration attribute // Add the xmlns declaration attribute if ((fFeatures & NAMESPACEDECLS) != 0) { fSerializer.addAttribute(XMLNS_URI, attrPrefix, XMLNS_PREFIX + ":" + attrPrefix, "CDATA", attrNS); fNSBinder.declarePrefix(attrPrefix, attrNS); fLocalNSBinder.declarePrefix(attrPrefix, attrNS); } } } } } else { // if the Attr has no namespace URI // Attr has no localName if (localName == null) { // DOM Level 1 node! String msg = Utils.messages.createMessage( MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, new Object[] { attrName }); if (fErrorHandler != null) { fErrorHandler .handleError(new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, null, null, null)); } } else { // uri=null and no colon // attr has no namespace URI and no prefix // no action is required, since attrs don't use default } } } // discard-default-content=true // Default attr's are not passed to the filter and this contraint // is applied only when discard-default-content=true // What about default xmlns attributes???? check for xmlnsAttr if ((((fFeatures & DISCARDDEFAULT) != 0) && isSpecified) || ((fFeatures & DISCARDDEFAULT) == 0)) { applyFilter = true; } else { addAttr = false; } if (applyFilter) { // apply the filter for Attributes that are not default attributes // or namespace decl attributes if (fFilter != null && (fFilter.getWhatToShow() & NodeFilter.SHOW_ATTRIBUTE) != 0) { if (!xmlnsAttr) { short code = fFilter.acceptNode(attr); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : addAttr = false; break; default : //fall through.. } } } } // if the node is a namespace node if (addAttr && xmlnsAttr) { // If namespace-declarations=true, add the node , else don't add it if ((fFeatures & NAMESPACEDECLS) != 0) { // The namespace may have been fixed up, in that case don't add it. if (localName != null && !"".equals(localName)) { fSerializer.addAttribute(attrNS, localName, attrName, type, attrValue); } } } else if ( addAttr && !xmlnsAttr) { // if the node is not a namespace node // If namespace-declarations=true, add the node with the Attr nodes namespaceURI // else add the node setting it's namespace to null or else the serializer will later // attempt to add a xmlns attr for the prefixed attribute if (((fFeatures & NAMESPACEDECLS) != 0) && (attrNS != null)) { fSerializer.addAttribute( attrNS, localName, attrName, type, attrValue); } else { fSerializer.addAttribute( "", localName, attrName, type, attrValue); } } // if (xmlnsAttr && ((fFeatures & NAMESPACEDECLS) != 0)) { int index; // Use "" instead of null, as Xerces likes "" for the // name of the default namespace. Fix attributed // to "Steven Murray" <[email protected]>. String prefix = (index = attrName.indexOf(":")) < 0 ? "" : attrName.substring(index + 1); if (!"".equals(prefix)) { fSerializer.namespaceAfterStartElement(prefix, attrValue); } } } }
Serializes the Attr Nodes of an Element. @param node The OwnerElement whose Attr Nodes are to be serialized.
DOM3TreeWalker::serializeAttList
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } }
Serializes an ProcessingInstruction Node. @param node The ProcessingInstruction Node to serialize
DOM3TreeWalker::serializePI
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializeCDATASection(CDATASection node) throws SAXException { // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCDATASectionWellFormed(node); } // cdata-sections = true if ((fFeatures & CDATA) != 0) { // split-cdata-sections = true // Assumption: This parameter has an effect only when // cdata-sections=true // ToStream, by default splits cdata-sections. Hence the check // below. String nodeValue = node.getNodeValue(); int endIndex = nodeValue.indexOf("]]>"); if ((fFeatures & SPLITCDATA) != 0) { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_WARNING, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT, null, relatedData, null)); } } } else { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT)); } // Report an error and return. What error??? return; } } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) { return; } // splits the cdata-section if (fLexicalHandler != null) { fLexicalHandler.startCDATA(); } dispatachChars(node); if (fLexicalHandler != null) { fLexicalHandler.endCDATA(); } } else { dispatachChars(node); } }
Serializes an CDATASection Node. @param node The CDATASection Node to serialize
DOM3TreeWalker::serializeCDATASection
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializeText(Text node) throws SAXException { if (fNextIsRaw) { fNextIsRaw = false; fSerializer.processingInstruction( javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); fSerializer.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { // keep track of dispatch or not to avoid duplicaiton of filter code boolean bDispatch = false; // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isTextWellFormed(node); } // if the node is whitespace // Determine the Attr's type. boolean isElementContentWhitespace = false; if (fIsLevel3DOM) { isElementContentWhitespace = node.isElementContentWhitespace(); } if (isElementContentWhitespace) { // element-content-whitespace=true if ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) { bDispatch = true; } } else { bDispatch = true; } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_TEXT)) { return; } if (bDispatch) { dispatachChars(node); } } }
Serializes an Text Node. @param node The Text Node to serialize
DOM3TreeWalker::serializeText
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void serializeEntityReference( EntityReference node, boolean bStart) throws SAXException { if (bStart) { EntityReference eref = node; // entities=true if ((fFeatures & ENTITIES) != 0) { // perform well-formedness and other checking only if // entities = true // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isEntityReferneceWellFormed(node); } // check "unbound-prefix-in-entity-reference" [fatal] // Raised if the configuration parameter "namespaces" is set to true if ((fFeatures & NAMESPACES) != 0) { checkUnboundPrefixInEntRef(node); } // The filter should not apply in this case, since the // EntityReference is not being expanded. // should we pass entity reference nodes to the filter??? } if (fLexicalHandler != null) { // startEntity outputs only Text but not Element, Attr, Comment // and PI child nodes. It does so by setting the m_inEntityRef // in ToStream and using this to decide if a node is to be // serialized or not. fLexicalHandler.startEntity(eref.getNodeName()); } } else { EntityReference eref = node; // entities=true or false, if (fLexicalHandler != null) { fLexicalHandler.endEntity(eref.getNodeName()); } } }
Serializes an EntityReference Node. @param node The EntityReference Node to serialize @param bStart Inicates if called from start or endNode
DOM3TreeWalker::serializeEntityReference
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if (!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); }
Taken from org.apache.xerces.dom.CoreDocumentImpl Check the string against XML's definition of acceptable names for elements and attributes and so on using the XMLCharacterProperties utility class
DOM3TreeWalker::isXMLName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected boolean isValidQName( String prefix, String local, boolean xml11Version) { // check that both prefix and local part match NCName if (local == null) return false; boolean validNCName = false; if (!xml11Version) { validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local); } else { validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix)) && XML11Char.isXML11ValidNCName(local); } return validNCName; }
Taken from org.apache.xerces.dom.CoreDocumentImpl Checks if the given qualified name is legal with respect to the version of XML to which this document must conform. @param prefix prefix of qualified name @param local local part of qualified name
DOM3TreeWalker::isValidQName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected boolean isWFXMLChar(String chardata, Character refInvalidChar) { if (chardata == null || (chardata.length() == 0)) { return true; } char[] dataarray = chardata.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { //we need to check all characters as per production rules of XML11 int i = 0; while (i < datalength) { if (XML11Char.isXML11Invalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // version of the document is XML 1.0 else { // we need to check all characters as per production rules of XML 1.0 int i = 0; while (i < datalength) { if (XMLChar.isInvalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // end-else fDocument.isXMLVersion() return true; } // isXMLCharWF
Checks if a XML character is well-formed @param characters A String of characters to be checked for Well-Formedness @param refInvalidChar A reference to the character to be returned that was determined invalid.
DOM3TreeWalker::isWFXMLChar
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected Character isWFXMLChar(String chardata) { Character refInvalidChar; if (chardata == null || (chardata.length() == 0)) { return null; } char[] dataarray = chardata.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { //we need to check all characters as per production rules of XML11 int i = 0; while (i < datalength) { if (XML11Char.isXML11Invalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return refInvalidChar; } } } // version of the document is XML 1.0 else { // we need to check all characters as per production rules of XML 1.0 int i = 0; while (i < datalength) { if (XMLChar.isInvalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return refInvalidChar; } } } // end-else fDocument.isXMLVersion() return null; } // isXMLCharWF
Checks if a XML character is well-formed. If there is a problem with the character a non-null Character is returned else null is returned. @param characters A String of characters to be checked for Well-Formedness @return Character A reference to the character to be returned that was determined invalid.
DOM3TreeWalker::isWFXMLChar
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void isCommentWellFormed(String data) { if (data == null || (data.length() == 0)) { return; } char[] dataarray = data.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { // we need to check all chracters as per production rules of XML11 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XML11Char.isXML11Invalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } // version of the document is XML 1.0 else { // we need to check all chracters as per production rules of XML 1.0 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XMLChar.isInvalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } return; }
Checks if a comment node is well-formed @param data The contents of the comment node @return a boolean indiacating if the comment is well-formed or not.
DOM3TreeWalker::isCommentWellFormed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void isElementWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Element", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } }
Checks if an element node is well-formed, by checking its Name for well-formedness. @param data The contents of the comment node @return a boolean indiacating if the comment is well-formed or not.
DOM3TreeWalker::isElementWellFormed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void isAttributeWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Attr", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Check the Attr's node value // WFC: No < in Attribute Values String value = node.getNodeValue(); if (value.indexOf('<') >= 0) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_LT_IN_ATTVAL, new Object[] { ((Attr) node).getOwnerElement().getNodeName(), node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_LT_IN_ATTVAL, null, null, null)); } } // we need to loop through the children of attr nodes and check their values for // well-formedness NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); // An attribute node with no text or entity ref child for example // doc.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns"); // followes by // element.setAttributeNodeNS(attribute); // can potentially lead to this situation. If the attribute // was a prefix Namespace attribute declaration then then DOM Core // should have some exception defined for this. if (child == null) { // we should probably report an error continue; } switch (child.getNodeType()) { case Node.TEXT_NODE : isTextWellFormed((Text) child); break; case Node.ENTITY_REFERENCE_NODE : isEntityReferneceWellFormed((EntityReference) child); break; default : } } // TODO: // WFC: Check if the attribute prefix is bound to // http://www.w3.org/2000/xmlns/ // WFC: Unique Att Spec // Perhaps pass a seen boolean value to this method. serializeAttList will determine // if the attr was seen before. }
Checks if an attr node is well-formed, by checking it's Name and value for well-formedness. @param data The contents of the comment node @return a boolean indiacating if the comment is well-formed or not.
DOM3TreeWalker::isAttributeWellFormed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void isPIWellFormed(ProcessingInstruction node) { // Is the PI Target a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "ProcessingInstruction", node.getTarget()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Does the PI Data carry valid XML characters // REVISIT: Should we check if the PI DATA contains a ?> ??? Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
Checks if a PI node is well-formed, by checking it's Name and data for well-formedness. @param data The contents of the comment node
DOM3TreeWalker::isPIWellFormed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void isCDATASectionWellFormed(CDATASection node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); //if (!isWFXMLChar(node.getData(), invalidChar)) { if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
Checks if an CDATASection node is well-formed, by checking it's data for well-formedness. Note that the presence of a CDATA termination mark in the contents of a CDATASection is handled by the parameter spli-cdata-sections @param data The contents of the comment node
DOM3TreeWalker::isCDATASectionWellFormed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void isTextWellFormed(Text node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
Checks if an Text node is well-formed, by checking if it contains invalid XML characters. @param data The contents of the comment node
DOM3TreeWalker::isTextWellFormed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void isEntityReferneceWellFormed(EntityReference node) { // Is the EntityReference name a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "EntityReference", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // determine the parent node Node parent = node.getParentNode(); // Traverse the declared entities and check if the nodeName and namespaceURI // of the EntityReference matches an Entity. If so, check the if the notationName // is not null, if so, report an error. DocumentType docType = node.getOwnerDocument().getDoctype(); if (docType != null) { NamedNodeMap entities = docType.getEntities(); for (int i = 0; i < entities.getLength(); i++) { Entity ent = (Entity) entities.item(i); String nodeName = node.getNodeName() == null ? "" : node.getNodeName(); String nodeNamespaceURI = node.getNamespaceURI() == null ? "" : node.getNamespaceURI(); String entName = ent.getNodeName() == null ? "" : ent.getNodeName(); String entNamespaceURI = ent.getNamespaceURI() == null ? "" : ent.getNamespaceURI(); // If referenced in Element content // WFC: Parsed Entity if (parent.getNodeType() == Node.ELEMENT_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_UNPARSED_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_UNPARSED_ENT, null, null, null)); } } } } // end if WFC: Parsed Entity // If referenced in an Attr value // WFC: No External Entity References if (parent.getNodeType() == Node.ATTRIBUTE_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getPublicId() != null || ent.getSystemId() != null || ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, null, null, null)); } } } } //end if WFC: No External Entity References } } } // isEntityReferneceWellFormed
Checks if an EntityRefernece node is well-formed, by checking it's node name. Then depending on whether it is referenced in Element content or in an Attr Node, checks if the EntityReference references an unparsed entity or a external entity and if so throws raises the appropriate well-formedness error. @param data The contents of the comment node @parent The parent of the EntityReference Node
DOM3TreeWalker::isEntityReferneceWellFormed
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void checkUnboundPrefixInEntRef(Node node) { Node child, next; for (child = node.getFirstChild(); child != null; child = next) { next = child.getNextSibling(); if (child.getNodeType() == Node.ELEMENT_NODE) { //If a NamespaceURI is not declared for the current //node's prefix, raise a fatal error. String prefix = child.getPrefix(); if (prefix != null && fNSBinder.getURI(prefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), prefix }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } NamedNodeMap attrs = child.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { String attrPrefix = attrs.item(i).getPrefix(); if (attrPrefix != null && fNSBinder.getURI(attrPrefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), attrs.item(i)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } } } if (child.hasChildNodes()) { checkUnboundPrefixInEntRef(child); } } }
If the configuration parameter "namespaces" is set to true, this methods checks if an entity whose replacement text contains unbound namespace prefixes is referenced in a location where there are no bindings for the namespace prefixes and if so raises a LSException with the error-type "unbound-prefix-in-entity-reference" @param Node, The EntityReference nodes whose children are to be checked
DOM3TreeWalker::checkUnboundPrefixInEntRef
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void recordLocalNSDecl(Node node) { NamedNodeMap atts = ((Element) node).getAttributes(); int length = atts.getLength(); for (int i = 0; i < length; i++) { Node attr = atts.item(i); String localName = attr.getLocalName(); String attrPrefix = attr.getPrefix(); String attrValue = attr.getNodeValue(); String attrNS = attr.getNamespaceURI(); localName = localName == null || XMLNS_PREFIX.equals(localName) ? "" : localName; attrPrefix = attrPrefix == null ? "" : attrPrefix; attrValue = attrValue == null ? "" : attrValue; attrNS = attrNS == null ? "" : attrNS; // check if attribute is a namespace decl if (XMLNS_URI.equals(attrNS)) { // No prefix may be bound to http://www.w3.org/2000/xmlns/. if (XMLNS_URI.equals(attrValue)) { String msg = Utils.messages.createMessage( MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, new Object[] { attrPrefix, XMLNS_URI }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, null, null, null)); } } else { // store the namespace-declaration if (XMLNS_PREFIX.equals(attrPrefix) ) { // record valid decl if (attrValue.length() != 0) { fNSBinder.declarePrefix(localName, attrValue); } else { // Error; xmlns:prefix="" } } else { // xmlns // empty prefix is always bound ("" or some string) fNSBinder.declarePrefix("", attrValue); } } } } }
Records local namespace declarations, to be used for normalization later @param Node, The element node, whose namespace declarations are to be recorded
DOM3TreeWalker::recordLocalNSDecl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void fixupElementNS(Node node) throws SAXException { String namespaceURI = ((Element) node).getNamespaceURI(); String prefix = ((Element) node).getPrefix(); String localName = ((Element) node).getLocalName(); if (namespaceURI != null) { //if ( Element's prefix/namespace pair (or default namespace, // if no prefix) are within the scope of a binding ) prefix = prefix == null ? "" : prefix; String inScopeNamespaceURI = fNSBinder.getURI(prefix); if ((inScopeNamespaceURI != null && inScopeNamespaceURI.equals(namespaceURI))) { // do nothing, declaration in scope is inherited } else { // Create a local namespace declaration attr for this namespace, // with Element's current prefix (or a default namespace, if // no prefix). If there's a conflicting local declaration // already present, change its value to use this namespace. // Add the xmlns declaration attribute //fNSBinder.pushNamespace(prefix, namespaceURI, fElementDepth); if ((fFeatures & NAMESPACEDECLS) != 0) { if ("".equals(prefix) || "".equals(namespaceURI)) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceURI); } else { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX + ":" + prefix, namespaceURI); } } fLocalNSBinder.declarePrefix(prefix, namespaceURI); fNSBinder.declarePrefix(prefix, namespaceURI); } } else { // Element has no namespace // DOM Level 1 if (localName == null || "".equals(localName)) { // DOM Level 1 node! String msg = Utils.messages.createMessage( MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, null, null, null)); } } else { namespaceURI = fNSBinder.getURI(""); if (namespaceURI !=null && namespaceURI.length() > 0) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, ""); fLocalNSBinder.declarePrefix("", ""); fNSBinder.declarePrefix("", ""); } } } }
Fixes an element's namespace @param Node, The element node, whose namespace is to be fixed
DOM3TreeWalker::fixupElementNS
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
protected void initProperties(Properties properties) { for (Enumeration keys = properties.keys(); keys.hasMoreElements();) { final String key = (String) keys.nextElement(); // caonical-form // Other features will be enabled or disabled when this is set to true or false. // error-handler; set via the constructor // infoset // Other features will be enabled or disabled when this is set to true // A quick lookup for the given set of properties (cdata-sections ...) final Object iobj = s_propKeys.get(key); if (iobj != null) { if (iobj instanceof Integer) { // Dealing with a property that has a simple bit value that // we need to set // cdata-sections // comments // element-content-whitespace // entities // namespaces // namespace-declarations // split-cdata-sections // well-formed // discard-default-content final int BITFLAG = ((Integer) iobj).intValue(); if ((properties.getProperty(key).endsWith("yes"))) { fFeatures = fFeatures | BITFLAG; } else { fFeatures = fFeatures & ~BITFLAG; } } else { // We are interested in the property, but it is not // a simple bit that we need to set. if ((DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT) .equals(key)) { // format-pretty-print; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setIndent(true); fSerializer.setIndentAmount(3); } else { fSerializer.setIndent(false); } } else if ( (DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL).equals( key)) { // omit-xml-declaration; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setOmitXMLDeclaration(true); } else { fSerializer.setOmitXMLDeclaration(false); } } else if ( ( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION).equals( key)) { // Retreive the value of the XML Version attribute via the xml-version String version = properties.getProperty(key); if ("1.1".equals(version)) { fIsXMLVersion11 = true; fSerializer.setVersion(version); } else { fSerializer.setVersion("1.0"); } } else if ( (DOMConstants.S_XSL_OUTPUT_ENCODING).equals(key)) { // Retreive the value of the XML Encoding attribute String encoding = properties.getProperty(key); if (encoding != null) { fSerializer.setEncoding(encoding); } } else if ((DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES).equals(key)) { // Preserve entity references in the document if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setDTDEntityExpansion(false); } else { fSerializer.setDTDEntityExpansion(true); } } else { // We shouldn't get here, ever, now what? } } } } // Set the newLine character to use if (fNewLine != null) { fSerializer.setOutputProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR, fNewLine); } }
Initializes fFeatures based on the DOMConfiguration Parameters set. @param properties DOMConfiguraiton properties that were set and which are to be used while serializing the DOM.
DOM3TreeWalker::initProperties
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
Apache-2.0
DOMOutputImpl() {}
Default Constructor
DOMOutputImpl::DOMOutputImpl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOMOutputImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOMOutputImpl.java
Apache-2.0
public LSSerializerImpl () { // set default parameters fFeatures |= CDATA; fFeatures |= COMMENTS; fFeatures |= ELEM_CONTENT_WHITESPACE; fFeatures |= ENTITIES; fFeatures |= NAMESPACES; fFeatures |= NAMESPACEDECLS; fFeatures |= SPLITCDATA; fFeatures |= WELLFORMED; fFeatures |= DISCARDDEFAULT; fFeatures |= XMLDECL; // New OutputFormat properties fDOMConfigProperties = new Properties(); // Initialize properties to be passed on the underlying serializer initializeSerializerProps(); // Create the underlying serializer. Properties configProps = OutputPropertiesFactory.getDefaultMethodProperties("xml"); // change xml version from 1.0 to 1.1 //configProps.setProperty("version", "1.1"); // Get a serializer that seriailizes according the the properties, // which in this case is to xml fXMLSerializer = SerializerFactory.getSerializer(configProps); // Initialize Serializer fXMLSerializer.setOutputFormat(fDOMConfigProperties); }
Constructor: Creates a LSSerializerImpl object. The underlying XML 1.0 or XML 1.1 org.apache.xml.serializer.Serializer object is created and initialized the first time any of the write methods are invoked to serialize the Node. Subsequent write methods on the same LSSerializerImpl object will use the previously created Serializer object.
LSSerializerImpl::LSSerializerImpl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0
public void initializeSerializerProps () { // canonical-form fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM3_DEFAULT_FALSE); // cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_TRUE); // "check-character-normalization" fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CHECK_CHAR_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // comments fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); // datatype-normalization fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // element-content-whitespace fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); // entities fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // error-handler // Should we set our default ErrorHandler /* * if (fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER) != null) { * fDOMErrorHandler = * (DOMErrorHandler)fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER); } */ // infoset if ((fFeatures & INFOSET) != 0) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); } // namespaces fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); // namespace-declarations fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); // normalize-characters /* fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NORMALIZE_CHARACTERS, DOMConstants.DOM3_DEFAULT_FALSE); */ // split-cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_DEFAULT_TRUE); // validate fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE, DOMConstants.DOM3_DEFAULT_FALSE); // validate-if-schema fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); // well-formed fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); // pretty-print fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_INDENT, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty( OutputPropertiesFactory.S_KEY_INDENT_AMOUNT, Integer.toString(3)); // // discard-default-content fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_DEFAULT_TRUE); // xml-declaration fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); }
Initializes the underlying serializer's configuration depending on the default DOMConfiguration parameters. This method must be called before a node is to be serialized. @xsl.usage internal
LSSerializerImpl::initializeSerializerProps
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0
public boolean canSetParameter(String name, Object value) { if (value instanceof Boolean){ if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){ // both values supported return true; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported return !((Boolean)value).booleanValue(); } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported return ((Boolean)value).booleanValue(); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) && value == null || value instanceof DOMErrorHandler){ return true; } return false; }
Checks if setting a parameter to a specific value is supported. @see org.w3c.dom.DOMConfiguration#canSetParameter(java.lang.String, java.lang.Object) @since DOM Level 3 @param name A String containing the DOMConfiguration parameter name. @param value An Object specifying the value of the corresponding parameter.
LSSerializerImpl::canSetParameter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0
public Object getParameter(String name) throws DOMException { if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) { return ((fFeatures & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) { return ((fFeatures & CDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) { return ((fFeatures & ENTITIES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) { return ((fFeatures & NAMESPACES) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) { return ((fFeatures & NAMESPACEDECLS) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) { return ((fFeatures & SPLITCDATA) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) { return ((fFeatures & WELLFORMED) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) { return ((fFeatures & DISCARDDEFAULT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { return ((fFeatures & XMLDECL) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { return ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { return ((fFeatures & PRETTY_PRINT) != 0) ? Boolean.TRUE : Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { return Boolean.TRUE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)){ if ((fFeatures & ENTITIES) == 0 && (fFeatures & CDATA) == 0 && (fFeatures & ELEM_CONTENT_WHITESPACE) != 0 && (fFeatures & NAMESPACES) != 0 && (fFeatures & NAMESPACEDECLS) != 0 && (fFeatures & WELLFORMED) != 0 && (fFeatures & COMMENTS) != 0) { return Boolean.TRUE; } return Boolean.FALSE; } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER)) { return fDOMErrorHandler; } else if ( name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { return null; } else { // Here we have to add the Xalan specific DOM Message Formatter String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } }
This method returns the value of a parameter if known. @see org.w3c.dom.DOMConfiguration#getParameter(java.lang.String) @param name A String containing the DOMConfiguration parameter name whose value is to be returned. @return Object The value of the parameter if known.
LSSerializerImpl::getParameter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0
public DOMStringList getParameterNames() { return new DOMStringListImpl(fRecognizedParameters); }
This method returns a of the parameters supported by this DOMConfiguration object and for which at least one value can be set by the application @see org.w3c.dom.DOMConfiguration#getParameterNames() @return DOMStringList A list of DOMConfiguration parameters recognized by the serializer
LSSerializerImpl::getParameterNames
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0
public void setParameter(String name, Object value) throws DOMException { // If the value is a boolean if (value instanceof Boolean) { boolean state = ((Boolean) value).booleanValue(); if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)) { fFeatures = state ? fFeatures | COMMENTS : fFeatures & ~COMMENTS; // comments if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)) { fFeatures = state ? fFeatures | CDATA : fFeatures & ~CDATA; // cdata-sections if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)) { fFeatures = state ? fFeatures | ENTITIES : fFeatures & ~ENTITIES; // entities if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)) { fFeatures = state ? fFeatures | NAMESPACES : fFeatures & ~NAMESPACES; // namespaces if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name .equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)) { fFeatures = state ? fFeatures | NAMESPACEDECLS : fFeatures & ~NAMESPACEDECLS; // namespace-declarations if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)) { fFeatures = state ? fFeatures | SPLITCDATA : fFeatures & ~SPLITCDATA; // split-cdata-sections if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)) { fFeatures = state ? fFeatures | WELLFORMED : fFeatures & ~WELLFORMED; // well-formed if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name .equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)) { fFeatures = state ? fFeatures | DISCARDDEFAULT : fFeatures & ~DISCARDDEFAULT; // discard-default-content if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)) { fFeatures = state ? fFeatures | PRETTY_PRINT : fFeatures & ~PRETTY_PRINT; // format-pretty-print if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)) { fFeatures = state ? fFeatures | XMLDECL : fFeatures & ~XMLDECL; if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); } else { fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "yes"); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)) { fFeatures = state ? fFeatures | ELEM_CONTENT_WHITESPACE : fFeatures & ~ELEM_CONTENT_WHITESPACE; // element-content-whitespace if (state) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_FALSE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported if (!state) { // Here we have to add the Xalan specific DOM Message Formatter String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, new Object[] { name }); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg); } else { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, DOMConstants.DOM3_EXPLICIT_TRUE); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported if (state) { String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, new Object[] { name }); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg); } else { if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)) { fDOMConfigProperties.setProperty(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION + DOMConstants.DOM_CHECK_CHAR_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE); } else if (name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE); } /* else if (name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NORMALIZE_CHARACTERS, DOMConstants.DOM3_EXPLICIT_FALSE); } */ } } else if (name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)) { // infoset if (state) { fFeatures &= ~ENTITIES; fFeatures &= ~CDATA; fFeatures &= ~SCHEMAVALIDATE; fFeatures &= ~DTNORMALIZE; fFeatures |= NAMESPACES; fFeatures |= NAMESPACEDECLS; fFeatures |= WELLFORMED; fFeatures |= ELEM_CONTENT_WHITESPACE; fFeatures |= COMMENTS; fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_EXPLICIT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_EXPLICIT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_EXPLICIT_FALSE); } } else { // If this is a non-boolean parameter a type mismatch should be thrown. if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } // Parameter is not recognized String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } } // If the parameter value is not a boolean else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER)) { if (value == null || value instanceof DOMErrorHandler) { fDOMErrorHandler = (DOMErrorHandler)value; } else { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } } else if ( name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_LOCATION) || name.equalsIgnoreCase(DOMConstants.DOM_SCHEMA_TYPE)) { if (value != null) { if (!(value instanceof String)) { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_SUPPORTED, new Object[] { name }); throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg); } } else { // If this is a boolean parameter a type mismatch should be thrown. if (name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)) { String msg = Utils.messages.createMessage( MsgKey.ER_TYPE_MISMATCH_ERR, new Object[] { name }); throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg); } // Parameter is not recognized String msg = Utils.messages.createMessage( MsgKey.ER_FEATURE_NOT_FOUND, new Object[] { name }); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } }
This method sets the value of the named parameter. @see org.w3c.dom.DOMConfiguration#setParameter(java.lang.String, java.lang.Object) @param name A String containing the DOMConfiguration parameter name. @param value An Object contaiing the parameters value to set.
LSSerializerImpl::setParameter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0
public DOMConfiguration getDomConfig() { return (DOMConfiguration)this; }
Returns the DOMConfiguration of the LSSerializer. @see org.w3c.dom.ls.LSSerializer#getDomConfig() @since DOM Level 3 @return A DOMConfiguration object.
LSSerializerImpl::getDomConfig
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0
public LSSerializerFilter getFilter() { return fSerializerFilter; }
Returns the DOMConfiguration of the LSSerializer. @see org.w3c.dom.ls.LSSerializer#getFilter() @since DOM Level 3 @return A LSSerializerFilter object.
LSSerializerImpl::getFilter
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
Apache-2.0