/** * Parses the inputsource and informs the error handler about errors. * * @throws DOMParserException * if an SAXException or IOException occurs. */ public Document parse(final InputSource inputSource, final ErrorHandler errorhandler) throws DOMParserException { return parse(inputSource, errorhandler, getDefaultEntityResolver()); }
/** * Parses the inputsource. * * @throws DOMParserException * if an SAXException or IOException occurs. */ public Document parse(final InputSource inputSource) throws DOMParserException { return parse(inputSource, null, getDefaultEntityResolver()); } }
@Override public Document readRawResponse(HTTPResponse<?> response, InputStream rawStream) { return DOMParser.createNew().parse(new InputSource(rawStream)); }
/** * Utility method to transform a string into a w3c-Document * * @param xmlString * string containing xml * @return document representing xml string * @throws Exception * is thrown in case an transformation error occurs */ public static Document readStringToDoc(String xmlString) throws Exception { Reader reader = new StringReader(xmlString); InputSource source = new InputSource(reader); Document doc = DOMParser.createNew().parse(source); return doc; }
public static Document createFromString(String pStr, DOMParserOptions options) { return DOMParser.createNew(options).parse(new InputSource(new StringReader(pStr))); }
public static Document createFromInputSource(InputSource source, DOMParserOptions options) { return DOMParser.createNew(options).parse(source); }
private Document toDom(InputStream in) { return DOMParser.createNew().parse(new InputSource(in)); }
public static Document createFromStream(InputStream pStream, DOMParserOptions options) { return DOMParser.createNew(options).parse(new InputSource(pStream)); }
/** * Method findIn constructs a new XMLPath starting in a string source. * * @param source the source. * @return XMLPath. */ public XMLPath findIn(final String source) { return findIn(DOMParser.createNew().parse(new InputSource(new StringReader(source)))); }
/** * Creates a license reference from a reader of XML. */ public static LicenseReference createFrom(final Reader reader) { Document doc = DOMParser.createNew().parse(new InputSource(reader)); return new XmlLicenseReference(doc.getDocumentElement()); }
public static FederationMetadata create(InputStream is) { Document fedMDdoc = DOMParser.createNew().parse(new InputSource(is)); return new FederationMetadata(fedMDdoc.getDocumentElement()); }
/** * Method creates a license reference from a stream of XML. * */ public static LicenseReference createFrom(final InputStream stream) { Document doc = DOMParser.createNew().parse(new InputSource(stream)); return new XmlLicenseReference(doc.getDocumentElement()); }
public void load() throws Exception { URLConnection con = getSosUrl().openConnection(); InputStream stream = con.getInputStream(); Document doc = DOMParser.createNew().parse(new InputSource(stream)); parseData(doc); }
public DefaultPDPProxy(final InputStream rightsDocument) { if (rightsDocument == null) { throw new IllegalArgumentException("parameter <rightsDocument> must not null"); } m_rightsDocument = DOMParser.createNew(DOMParserOptions.getDefault().notNamespaceaware()).parse( new InputSource(rightsDocument)); }
/** * Method findIn constructs a new XMLPath starting in a InputSource source. * * @param source the source. * @return XMLPath. */ public XMLPath findIn(final InputSource source) { return findIn(DOMParser.createNew().parse(source)); }
public static WSSCapabilitiesDocument parse(InputStream in) { DOMParser domParser = DOMParser.createNew(DOMParserOptions.getDefault()); Document document = domParser.parse(new InputSource(in)); return new WSSCapabilitiesDocument(document); }
private static Document parsePAOSResponse(InputStream instream) { return DOMParser.createNew(DOMParserOptions.getDefault().namespaceaware()).parse(new InputSource(instream)); }
public void setLicensePrecondition(LicensePrecondition licenseProcondition) { if (licenseProcondition == null) { return; } Node caproot = m_xPathCtx.findIn(m_capsDoc).node("//wss:Capability").get(); String baseUrl = licenseProcondition.getBaseUrl(); String redirectUrl = licenseProcondition.getRedirectUrl(); String ssoUrl = licenseProcondition.getSsoGetUrl(); String filledTemplate = String.format(licensePreconditionTemplate, baseUrl, ssoUrl, redirectUrl, baseUrl); StringReader reader = new StringReader(filledTemplate); Document templateDoc = DOMParser.createNew().parse(new InputSource(reader)); Node importedTemplateNode = m_capsDoc.importNode(templateDoc.getDocumentElement(), true); caproot.appendChild(importedTemplateNode); }
public void handleChunkEnd(final List<QName> currentXPath, final QName handlerQName, final String xmlChunk) { Element request = DOMParser.createNew().parse(new InputSource(new StringReader(xmlChunk))).getDocumentElement(); if (LOG.isDebugEnabled()) { debugPDPRequest(request); } Element response = getDecisionService().evaluate(request); if (request.isDefaultNamespace(PDP_REQUEST_NAME_V2.getNamespaceURI())) { response.setAttribute(XMLConstants.XMLNS_ATTRIBUTE, PDP_REQUEST_NAME_V2.getNamespaceURI()); } if (LOG.isDebugEnabled()) { debugPDPResponse(response); } DOMSerializer.createNew(DOMSerializerOptions.getDefaultOptions().omitXMLDeclaration().encodingUTF8()) .serialize(response, out); }
private ResponseDocument convertToXACML1XmlBeanResponse(String xmlChunk) { Document responseChunk = DOMParser.createNew().parse(new InputSource(new StringReader(xmlChunk))); ResponseDocument responseDoc = ResponseDocument.Factory.newInstance(); ResponseType response = responseDoc.addNewResponse(); ResultType result = response.addNewResult(); result.setDecision(DecisionType.Enum.forString(xmlPathCtx.findIn(responseChunk).text("/c:Response/c:Result[1]/c:Decision/text()").get())); result.setResourceId(xmlPathCtx.findIn(responseChunk).text("/c:Response/c:Result[1]/@ResourceId").get()); NodeList obligationNodes = xmlPathCtx.findIn(responseChunk).all("/c:Response/c:Result[1]/p:Obligations/*").get(); ObligationsType obligations; if (obligationNodes.getLength() > 0) { obligations = result.addNewObligations(); for (int i = 0; i < obligationNodes.getLength(); i++) { Element oblElem = (Element) obligationNodes.item(i); fillObligationFromElem(obligations.addNewObligation(), oblElem); } } return responseDoc; }