List of usage examples for org.xml.sax.helpers NamespaceSupport XMLNS
String XMLNS
To view the source code for org.xml.sax.helpers NamespaceSupport XMLNS.
Click Source Link
From source file:net.sf.joost.stx.Processor.java
/** * Create a fresh namespace hashtable/* www .ja v a 2 s . co m*/ */ private void initNamespaces() { inScopeNamespaces = new Hashtable(); inScopeNamespaces.put("xml", NamespaceSupport.XMLNS); }
From source file:org.apache.cocoon.forms.formmodel.WidgetTestHelper.java
/** * Get the result of a widget's generateSaxFragment() method as a Document. * <p>/*from w w w . j a va2 s. c o m*/ * The widget's fragment is encapsulated in a root <fi:fragment> element, * since there's no guarantee that a widget outputs a single top-level element * (there can be several elements, or even none if the widget is invisible) * * @param widget the widget of which we want the fragment * @param locale the locale to be used to generate the fragment * @return the document containing the fragment */ public static Document getWidgetFragment(Widget widget, Locale locale) throws SAXException { DOMBuilder domBuilder = new DOMBuilder(); // Start document and "fi:fragment" root element domBuilder.startDocument(); domBuilder.startPrefixMapping(FormsConstants.INSTANCE_PREFIX, FormsConstants.INSTANCE_NS); // FIXME: why simply declaring the prefix isn't enough? AttributesImpl attr = new AttributesImpl(); attr.addCDATAAttribute(NamespaceSupport.XMLNS, "fi:", "xmlns:fi", FormsConstants.INSTANCE_NS); domBuilder.startElement(FormsConstants.INSTANCE_NS, "fragment", FormsConstants.INSTANCE_PREFIX_COLON + "fragment", attr); widget.generateSaxFragment(domBuilder, locale); // End "fi:fragment" element and document domBuilder.endElement(FormsConstants.INSTANCE_NS, "fragment", FormsConstants.INSTANCE_PREFIX_COLON + "fragment"); domBuilder.endPrefixMapping(FormsConstants.INSTANCE_PREFIX); domBuilder.endDocument(); // Return the document return domBuilder.getDocument(); }