本文整理汇总了Java中org.jaxen.dom4j.Dom4jXPath类的典型用法代码示例。如果您正苦于以下问题:Java Dom4jXPath类的具体用法?Java Dom4jXPath怎么用?Java Dom4jXPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dom4jXPath类属于org.jaxen.dom4j包,在下文中一共展示了Dom4jXPath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSelection
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
public void testSelection() throws JaxenException, DocumentException
{
XPath xpath = new Dom4jXPath( "/foo/bar/baz" );
SAXReader reader = new SAXReader();
Document doc = reader.read( BASIC_XML );
List results = xpath.selectNodes( doc );
assertEquals( 3, results.size() );
Iterator iter = results.iterator();
assertEquals( "baz",
((Element)iter.next()).getName() );
assertEquals( "baz",
((Element)iter.next()).getName() );
assertEquals( "baz",
((Element)iter.next()).getName() );
assertTrue( ! iter.hasNext() );
}
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:19,代码来源:DOM4JXPathTest.java
示例2: testNamespaceNodesAreInherited
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
public void testNamespaceNodesAreInherited() throws JaxenException
{
Namespace ns0 = Namespace.get("p0", "www.acme0.org");
Namespace ns1 = Namespace.get("p1", "www.acme1.org");
Namespace ns2 = Namespace.get("p2", "www.acme2.org");
Element element = new DefaultElement("test", ns1);
Attribute attribute = new DefaultAttribute("pre:foo", "bar", ns2);
element.add(attribute);
Element root = new DefaultElement("root", ns0);
root.add(element);
Document doc = new DefaultDocument(root);
XPath xpath = new Dom4jXPath( "/*/*/namespace::node()" );
List results = xpath.selectNodes( doc );
assertEquals( 4,
results.size() );
}
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:20,代码来源:DOM4JXPathTest.java
示例3: main
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
public static void main(String[] args) {
try {
URL u = new URL("http://www.ibiblio.org/xml/examples/shakespeare/much_ado.xml");
Document doc = new SAXReader().read(u);
Dom4jXPath xpath = new Dom4jXPath("PLAY/ACT/SCENE/SPEECH/SPEAKER");
long start = System.currentTimeMillis();
int count = 0;
for (int i = 0; i < 1000; i++) {
Element speaker = (Element) xpath.selectSingleNode(doc);
count += (speaker == null ? 0 : 1);
}
long end = System.currentTimeMillis();
System.out.println((end - start));
System.out.println(count);
} catch (Exception ex) {
ex.printStackTrace();
}
}
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:23,代码来源:DOM4JPerformance.java
示例4: Sentence
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* This constructor is to be used with AnnotationCorpus.
*
* @param annotationCorpus
* The corpus
* @param element
* The XML element of the sentence
* @throws JaxenException
*/
@SuppressWarnings("unchecked")
public Sentence(AnnotationCorpus annotationCorpus, Element element)
throws JaxenException {
super(element.attributeValue("ID"), element.element("text").getText());
Dom4jXPath xpath = new Dom4jXPath("berk:annotationSet/berk:layer/berk:label[@start and @end]");
xpath.setNamespaceContext(annotationCorpus.getFrameNet().getNameSpaceContext());
List allTokens = xpath.selectNodes(element);
for (Object tokenObj : allTokens) {
Element token = (Element) tokenObj;
Range range = new Range(new Integer(token.attributeValue("start")),
new Integer(token.attributeValue("end")) + 1);
addToken(range);
}
}
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:25,代码来源:Sentence.java
示例5: AnnotationSet
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* The constructor used for constructing the AnnotationSet object
* out of an XML element node.
*
* @param sentence The sentence which is annotated
* @param element The XML element representing the annotation set
* @throws FrameNotFoundException
* @throws FrameElementNotFoundException
* @throws ParsingException
*/
public AnnotationSet(Sentence sentence, Element element)
throws FrameNotFoundException, FrameElementNotFoundException, ParsingException, JaxenException {
this.sentence = sentence;
init(element);
frameRef = element.attributeValue("frameRef");
luRef = element.attributeValue("lexUnitRef");
String frameName = element.attributeValue("frameName");
String luName = element.attributeValue("luName");
if (frameName != null) {
frame = sentence.corpus.getFrameNet().getFrame(frameName);
}
if (luName != null) {
lexicalUnit = frame.getLexicalUnit(luName);
}
Element targetlabel = (Element) new Dom4jXPath("layers/layer[@name='Target']/labels/label").selectSingleNode(element);
if (targetlabel != null && targetlabel.attributeValue("start") != null) {
int start = Integer.parseInt(targetlabel.attributeValue("start"));
int end = Integer.parseInt(targetlabel.attributeValue("end")) + 1;
realizedFrame = new RealizedFrame(frame, sentence.getToken(new Range( start, end )), "");
}
this.processFrameElements(element);
}
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:35,代码来源:AnnotationSet.java
示例6: supplyNode
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Used to complete a semantic type by providing only the XML node.
* This method overwrittes all data that have been preliminarily stored
* within this semantic type.
*
* @param node The XML node
* @return true if the node has been successfully loaded, false if it was
* already loaded
*/
@SuppressWarnings("unchecked")
protected Boolean supplyNode(Element node) throws JaxenException {
if (! this.nodeSupplied) {
this.id = node.attributeValue("ID");
this.name = node.attributeValue("name");
this.abbreviation = node.attributeValue("abbrev");
this.definition = node.element("definition").getText().replace('\n', ' ');
Dom4jXPath xpath = new Dom4jXPath("berk:superType");
xpath.setNamespaceContext(this.frameNet.getNameSpaceContext());
List list = xpath.selectNodes(node);
for (Object item : list) {
Element st = (Element) item;
this.superTypes.add(frameNet.getSemanticType(st.attributeValue("superTypeName"), true));
try {
this.frameNet.getSemanticType(st.attributeValue("superTypeName")).registerSubType(this);
} catch (SemanticTypeNotFoundException e) {
// TODO: Collect inconsistencies in the FrameNet database
}
}
this.nodeSupplied = true;
return true;
}
return false;
}
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:35,代码来源:FNSemanticType.java
示例7: testJaxen20AttributeNamespaceNodes
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
public void testJaxen20AttributeNamespaceNodes() throws JaxenException
{
Namespace ns1 = Namespace.get("p1", "www.acme1.org");
Namespace ns2 = Namespace.get("p2", "www.acme2.org");
Element element = new DefaultElement("test", ns1);
Attribute attribute = new DefaultAttribute("pre:foo", "bar", ns2);
element.add(attribute);
Document doc = new DefaultDocument(element);
XPath xpath = new Dom4jXPath( "//namespace::node()" );
List results = xpath.selectNodes( doc );
assertEquals( 3, results.size() );
}
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:16,代码来源:DOM4JXPathTest.java
示例8: testJaxen16
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
public void testJaxen16() throws JaxenException, DocumentException
{
String document = "<a xmlns:b=\"...\"/>";
SAXReader reader = new SAXReader();
Document doc = reader.read( new StringReader(document) );
XPath xpath = new Dom4jXPath( "/a/b" );
List results = xpath.selectNodes( doc );
assertEquals( 0, results.size() );
}
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:13,代码来源:DOM4JXPathTest.java
示例9: testSyntaxException
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
public void testSyntaxException() throws JaxenException {
String path = "/row/[some_node='val1']|[some_node='val2']";
try {
new Dom4jXPath(path);
fail("Allowed union of non-node-sets");
}
catch (XPathSyntaxException success) {
assertNotNull(success.getMessage());
}
}
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:13,代码来源:DOM4JXPathTest.java
示例10: execute
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Creates new folder in site's document library
*
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse})
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is started.");
}
// mapping xml namespace to prefix
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(prefix, namespace);
nc.addNamespace(soapUriPrefix, soapUri);
// getting url parameter from request
XPath urlPath = new Dom4jXPath(buildXPath(prefix, "/CreateFolder/url"));
urlPath.setNamespaceContext(nc);
Element url = (Element) urlPath.selectSingleNode(soapRequest.getDocument().getRootElement());
handler.createFolder(getDwsFromUri(soapRequest) + "/" + url.getText());
// creating soap response
Element root = soapResponse.getDocument().addElement("CreateFolderResponse", namespace);
Element createFolderResult = root.addElement("CreateFolderResult");
// Contents are standalone XML
createFolderResult.setText("<Result/>");
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is finished.");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:37,代码来源:CreateFolderEndpoint.java
示例11: execute
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Rename document workspace
*
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse})
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is started.");
}
// mapping xml namespace to prefix
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(prefix, namespace);
nc.addNamespace(soapUriPrefix, soapUri);
// getting title parameter from request
XPath titlePath = new Dom4jXPath(buildXPath(prefix, "/RenameDws/title"));
titlePath.setNamespaceContext(nc);
Element title = (Element) titlePath.selectSingleNode(soapRequest.getDocument().getRootElement());
handler.renameDws(getDwsFromUri(soapRequest), title.getText());
// creating soap response
Element root = soapResponse.getDocument().addElement("RenameDwsResponse");
Element renameDwsResult = root.addElement("RenameDwsResult", namespace);
renameDwsResult.setText("<Result/>");
if (logger.isDebugEnabled())
{
logger.debug("SOAP method with name " + getName() + " is finished.");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:37,代码来源:RenameDwsEndpoint.java
示例12: execute
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Deletes document workspace
*
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse})
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception {
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is started.");
}
// mapping xml namespace to prefix
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(soapUriPrefix, soapUri);
nc.addNamespace(prefix, namespace);
// Grab the site name
String dws = getDwsFromUri(soapRequest);
// Fetch the root of the document
Element requestElement = soapRequest.getDocument().getRootElement();
// Get the listName parameter from the request
XPath listNameXPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/listName"));
listNameXPath.setNamespaceContext(nc);
Element listNameE = (Element) listNameXPath.selectSingleNode(requestElement);
String listName = null;
if (listNameE != null)
{
listName = listNameE.getTextTrim();
}
// Have any further details fetched as needed
executeListActionDetails(soapRequest, soapResponse, dws, listName, requestElement, nc);
// All done
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is finished.");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:41,代码来源:AbstractListEndpoint.java
示例13: executeListActionDetails
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
protected void executeListActionDetails(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse,
String siteName, String listName, Element requestElement, SimpleNamespaceContext nc) throws Exception
{
// Get the description parameter from the request
XPath descriptionXPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/description"));
descriptionXPath.setNamespaceContext(nc);
Element descriptionE = (Element) descriptionXPath.selectSingleNode(soapRequest.getDocument().getRootElement());
String description = null;
if (descriptionE != null)
{
description = descriptionE.getTextTrim();
}
// Get the template ID parameter from the request
XPath templateXPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/templateID"));
templateXPath.setNamespaceContext(nc);
Element templateE = (Element) templateXPath.selectSingleNode(soapRequest.getDocument().getRootElement());
int templateID = -1;
if (templateE != null)
{
templateID = Integer.parseInt( templateE.getTextTrim() );
}
// Have the List Added / Fetched
ListInfoBean list = executeListAction(soapRequest, siteName, listName, description, templateID);
// Have it rendered
renderList(soapRequest, soapResponse, siteName, list);
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:31,代码来源:AbstractListEndpoint.java
示例14: execute
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Retrieves url of the document workspace site from the document url
*
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse})
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
if (logger.isDebugEnabled())
logger.debug("Soap Method with name " + getName() + " is started.");
// mapping xml namespace to prefix
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(prefix, namespace);
nc.addNamespace(soapUriPrefix, soapUri);
// getting pageUrl parameter from request
XPath xpath = new Dom4jXPath(buildXPath(prefix, "/WebUrlFromPageUrl/pageUrl"));
xpath.setNamespaceContext(nc);
String pageUrl = URLDecoder.decode(((Element) xpath.selectSingleNode(soapRequest.getDocument().getRootElement())).getTextTrim(), "UTF-8");
if (logger.isDebugEnabled())
logger.debug("pageUrl parameter for this request: " + pageUrl);
String server = getHost(soapRequest);
String context = soapRequest.getAlfrescoContextName();
String[] uris = handler.decomposeURL(URIUtil.getPath(pageUrl), context);
// creating soap response
Element responseElement = soapResponse.getDocument().addElement("WebUrlFromPageUrlResponse", namespace);
Element result = responseElement.addElement("WebUrlFromPageUrlResult");
result.setText(server + uris[0]);
if (logger.isDebugEnabled())
{
logger.debug("Soap Method with name " + getName() + " is finished.");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:39,代码来源:WebUrlFromPageUrlEndpoint.java
示例15: execute
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Creates new document workspace with given title
*
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse})
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is started.");
}
// mapping xml namespace to prefix
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(prefix, namespace);
nc.addNamespace(soapUriPrefix, soapUri);
// getting title parameter from request
XPath urlPath = new Dom4jXPath(buildXPath(prefix, "/CanCreateDwsUrl/url"));
urlPath.setNamespaceContext(nc);
Element url = (Element) urlPath.selectSingleNode(soapRequest.getDocument().getRootElement());
String urlText = "";
if(url != null)
{
urlText = url.getTextTrim();
if (urlText.equals(""))
{
// [MS-DWSS] return a generated/unique name
urlText = GUID.generate();
}
}
if (false == handler.canCreateDwsUrl(urlText))
{
throw new VtiHandlerException(VtiError.NO_PERMISSIONS);
}
// creating soap response
Element resultElement = buildResultTag(soapResponse);
resultElement.setText(processTag("Result", urlText).toString());
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is finished.");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:46,代码来源:CanCreateDwsUrlEndpoint.java
示例16: execute
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Removes user from site
*
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse})
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is started.");
}
// mapping xml namespace to prefix
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(prefix, namespace);
nc.addNamespace(soapUriPrefix, soapUri);
// getting id parameter from request
XPath idPath = new Dom4jXPath(buildXPath(prefix, "/RemoveDwsUser/id"));
idPath.setNamespaceContext(nc);
Element id = (Element) idPath.selectSingleNode(soapRequest.getDocument().getRootElement());
handler.removeDwsUser(getDwsFromUri(soapRequest), id.getText());
// creating soap response
Element root = soapResponse.getDocument().addElement("RemoveDwsUserResponse", namespace);
Element removeDwsUserResult = root.addElement("RemoveDwsUserResult");
removeDwsUserResult.setText("<Results/>");
if (logger.isDebugEnabled())
{
logger.debug("SOAP method with name " + getName() + " is finished.");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:36,代码来源:RemoveDwsUserEndpoint.java
示例17: getTimeZoneInformation
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
protected TimeZoneInformation getTimeZoneInformation(Element requestElement) throws Exception
{
TimeZoneInformation timeZoneInforation = new TimeZoneInformation();
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(prefix, namespace);
nc.addNamespace(soapUriPrefix, soapUri);
// Is the timezone present?
XPath timezonePath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation"));
timezonePath.setNamespaceContext(nc);
Element tzElement = (Element)timezonePath.selectSingleNode(requestElement);
if (tzElement == null)
{
if (logger.isDebugEnabled())
logger.debug("No TimeZone information supplied, using the default");
return null;
}
// Fetch the details of the timezone
// TODO Fetch from the tzElement object
XPath biasPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/bias"));
biasPath.setNamespaceContext(nc);
timeZoneInforation.setBias(Integer.valueOf(((Element) biasPath.selectSingleNode(requestElement)).getTextTrim()));
timeZoneInforation.setStandardDate(createTimeZoneInformationDate(requestElement, "standardDate"));
XPath standardBiasPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/standardBias"));
standardBiasPath.setNamespaceContext(nc);
timeZoneInforation.setStandardBias(Integer.valueOf(((Element) standardBiasPath.selectSingleNode(requestElement)).getTextTrim()));
timeZoneInforation.setDaylightDate(createTimeZoneInformationDate(requestElement, "daylightDate"));
XPath daylightBiasPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/daylightBias"));
daylightBiasPath.setNamespaceContext(nc);
timeZoneInforation.setDaylightBias(Integer.valueOf(((Element) daylightBiasPath.selectSingleNode(requestElement)).getTextTrim()));
return timeZoneInforation;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:40,代码来源:AbstractWorkspaceEndpoint.java
示例18: execute
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
/**
* Delete folder from site's document library
*
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse})
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is started.");
}
// mapping xml namespace to prefix
SimpleNamespaceContext nc = new SimpleNamespaceContext();
nc.addNamespace(prefix, namespace);
nc.addNamespace(soapUriPrefix, soapUri);
// getting url parameter from request
XPath urlPath = new Dom4jXPath(buildXPath(prefix, "/DeleteFolder/url"));
urlPath.setNamespaceContext(nc);
Element url = (Element) urlPath.selectSingleNode(soapRequest.getDocument().getRootElement());
handler.deleteFolder(getDwsFromUri(soapRequest) + "/" + url.getText());
// creating soap response
Element root = soapResponse.getDocument().addElement("DeleteFolderResponse", namespace);
Element deleteFolderResult = root.addElement("DeleteFolderResult");
deleteFolderResult.addElement("Result");
if (logger.isDebugEnabled()) {
logger.debug("SOAP method with name " + getName() + " is finished.");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:36,代码来源:DeleteFolderEndpoint.java
示例19: getParameter
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
protected String getParameter(Element rootElement, String path, SimpleNamespaceContext nc) throws JaxenException
{
XPath xPath = new Dom4jXPath(buildXPath(prefix, path));
xPath.setNamespaceContext(nc);
Element titleEl = (Element) xPath.selectSingleNode(rootElement);
return titleEl.getTextTrim();
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:8,代码来源:CreateDwsEndpoint.java
示例20: testMNT_10251
import org.jaxen.dom4j.Dom4jXPath; //导入依赖的package包/类
@Test
public void testMNT_10251() throws Throwable
{
// test that AbstractEndpoint#getDwsFromUri should not return site name with leading slash
String siteName = AbstractEndpoint.getDwsFromUri(alfrescoContextSoapRequest);
assertEquals("test", siteName);
siteName = AbstractEndpoint.getDwsFromUri(rootContextSoapRequest);
assertEquals("test", siteName);
XPath fileNameXPath = new Dom4jXPath("/" + endpoint.getName() + "/fileName");
// test that AbstractEndpoint#getFileName correctly parses absolute ant site-relative document names
fileNameElement.setText("http://localhost:7070/alfresco/test/documentLibrary/test.docx");
String fileName = endpoint.getFileName(alfrescoContextSoapRequest, fileNameXPath);
assertEquals("documentLibrary/test.docx", fileName);
fileNameElement.setText("http://localhost:7070/test/documentLibrary/test.docx");
fileName = endpoint.getFileName(rootContextSoapRequest, fileNameXPath);
assertEquals("documentLibrary/test.docx", fileName);
fileNameElement.setText("documentLibrary/test.docx");
fileName = endpoint.getFileName(alfrescoContextSoapRequest, fileNameXPath);
assertEquals("documentLibrary/test.docx", fileName);
fileNameElement.setText("documentLibrary/test.docx");
fileName = endpoint.getFileName(rootContextSoapRequest, fileNameXPath);
assertEquals("documentLibrary/test.docx", fileName);
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:TestAbstractEndpointTest.java
注:本文中的org.jaxen.dom4j.Dom4jXPath类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论