/** @param ownerDocument */ public DocumentImpl(DocumentImpl ownerDocument, OMFactory factory) { super(ownerDocument, factory); ((OMDOMFactory) factory).setDocument(this); this.done = true; }
/** * Create an OMElement with the given QName * <p/> * If the QName contains a prefix, we will ensure that an OMNamespace is created mapping the * given namespace to the given prefix. If no prefix is passed, we'll create a generated one. * * @param qname * @return the new OMElement. */ public OMElement createOMElement(QName qname) throws OMException { return createOMElement(qname, null); }
public static OMFactory getOMFactory() { return new OMDOMFactory(); }
public void applyPolicy(AxisDescription axisDescription, Element policy) { try { OMElement policyElement = (OMElement) new OMDOMFactory().getDocument().importNode(policy, true); axisDescription.applyPolicy(PolicyEngine.getPolicy(policyElement)); } catch (Exception e) { // TODO Handle exception properly throw new AssertionError(e); } }
/** * Serialize the given node to a String. * * @param node Node to be serialized. * @return The serialized node as a java.lang.String instance. */ public static String nodeToString(Node node) { if (importerDoc == null) { OMDOMFactory fac = new OMDOMFactory(); importerDoc = (Document) fac.createOMDocument(); } // Import the node as an AXIOM-DOOM node and use toSting() Node axiomNode = importerDoc.importNode(node, true); return axiomNode.toString(); }
public ElementImpl(OMFactory factory) { super(factory); this.ownerNode = ((OMDOMFactory) factory).getDocument(); }
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { // TODO Handle docType stuff OMDOMFactory fac = new OMDOMFactory(); DocumentImpl doc = new DocumentImpl(fac); fac.setDocument(doc); new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName), new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName)), fac); return doc; }
public DocumentImpl getDocument() { return (DocumentImpl) this.createOMDocument(); }
public OMText createOMText(OMContainer parent, String text, int type) { OMText textNode = createOMText(parent, text); ((OMNodeEx) textNode).setType(type); return textNode; }
/** * Returns a new document impl. * * @see javax.xml.parsers.DocumentBuilder#newDocument() */ public Document newDocument() { OMDOMFactory factory = new OMDOMFactory(); DocumentImpl documentImpl = new DocumentImpl(factory); documentImpl.setComplete(true); return documentImpl; }
public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) throws SOAPProcessingException { super(((OMDOMFactory) factory).getDocument(), localName, (NamespaceImpl) ns, factory); this.setNamespace(ns); }
public OMElement createOMElement(String localName, OMNamespace ns) { return new ElementImpl((DocumentImpl) this.createOMDocument(), localName, (NamespaceImpl) ns, this); }
public DocumentImpl(OMFactory factory) { super(factory); ((OMDOMFactory) factory).setDocument(this); this.done = true; }
/** * Creates an OMElement. * * @see org.apache.axiom.om.OMFactory#createOMElement(String, String, * String) */ public OMElement createOMElement(String localName, String namespaceURI, String namespacePrefix) { NamespaceImpl ns = new NamespaceImpl(namespaceURI, namespacePrefix); return this.createOMElement(localName, ns); }
/** @see javax.xml.parsers.DocumentBuilder#parse(java.io.File) */ public Document parse(File file) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); XMLStreamReader reader = StAXUtils .createXMLStreamReader(new FileInputStream(file)); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); return (DocumentImpl) builder.getDocument(); } catch (XMLStreamException e) { throw new SAXException(e); } }
public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value) { return new AttrImpl(this.getDocument(), localName, ns, value, this); }
public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) { super(factory); this.builder = parserWrapper; ((OMDOMFactory) factory).setDocument(this); }
/** * Creates a new OMDOM Element node and adds it to the given parent. * * @see #createOMElement(String, OMNamespace, OMContainer) * @see org.apache.axiom.om.OMFactory#createOMElement( javax.xml.namespace.QName, * org.apache.axiom.om.OMContainer) */ public OMElement createOMElement(QName qname, OMContainer parent) throws OMException { NamespaceImpl ns; if (qname.getPrefix() != null) { ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix()); } else { ns = new NamespaceImpl(qname.getNamespaceURI()); } return createOMElement(qname.getLocalPart(), ns, parent); }
/** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) */ public Document parse(InputStream is) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); XMLStreamReader reader = StAXUtils .createXMLStreamReader(is); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); return (DocumentImpl) builder.getDocument(); } catch (XMLStreamException e) { throw new SAXException(e); } }
public Document parse(InputSource inputSource) throws SAXException, IOException { try { OMDOMFactory factory = new OMDOMFactory(); // Not really sure whether this will work :-? XMLStreamReader reader = StAXUtils .createXMLStreamReader(inputSource.getCharacterStream()); StAXOMBuilder builder = new StAXOMBuilder(factory, reader); DocumentImpl doc = (DocumentImpl) builder.getDocument(); ((ElementImpl) doc.getDocumentElement()).build(); return (DocumentImpl) builder.getDocument(); } catch (XMLStreamException e) { throw new SAXException(e); } }