public void startDocument() throws SAXException { namespaces = new SimpleNamespaceContext(); }
protected BaseXMLEventWriter(XMLEventFactory eventFactory, NamespaceContext nsCtx) { if (nsCtx != null) { nsStack.add(new SimpleNamespaceContext(nsCtx)); } else { nsStack.add(new SimpleNamespaceContext()); } if (eventFactory != null) { factory = eventFactory; } else { factory = XMLEventFactory.newInstance(); } }
/** * Creates a new {@link SimpleNamespaceContext} and adds it to the top of * the stack. * * @return The new {@link SimpleNamespaceContext}. */ protected SimpleNamespaceContext pushNamespaceStack() { SimpleNamespaceContext nsCtx; SimpleNamespaceContext parent = peekNamespaceStack(); if (parent != null) { nsCtx = new SimpleNamespaceContext(parent); } else { nsCtx = new SimpleNamespaceContext(); } nsStack.add(nsCtx); return nsCtx; }
public void startPrefixMapping(String prefix, String uri) throws SAXException { if (prefix == null) { prefix = ""; } else if (prefix.equals("xml")) { return; } if (namespaces == null) { namespaces = new SimpleNamespaceContext(); } namespaces.setPrefix(prefix, uri); }
XPathFactory xpf = XPathFactory.newInstance(); XPath xpath = xpf.newXPath(); SimpleNamespaceContext nsc = new SimpleNamespaceContext(); nsc.setPrefix(SchematronGenerator.SCH_PREFIX, SchematronGenerator.SCH_NAMESPACE); xpath.setNamespaceContext(nsc);