SharePoint 목록 SOAP 요청의 특정 필드를 반환하는 데 문제가 있습니다. 내가 방법을 알아낼 수없는 것, 그러나Jdom2 Sharepoint XML 필드
// set your name spaces.
Namespace soap = Namespace.getNamespace("soap","http://www.w3.org/2003/05/soap-envelope");
Namespace soap1 = Namespace.getNamespace("soap1","http://schemas.microsoft.com/sharepoint/soap/");
// drill down into elements
Element rootNode = doc.getRootElement();
// Get Body node
Element body = rootNode.getChild("Body",soap);
// Get UpdateListItem Element
Element UpdateListItems = body.getChild("UpdateListItems",soap1);
// Get updates node
Element updates = UpdateListItems.getChild("updates",soap1);
// Set list name as String variable
String listNameString = UpdateListItems.getChild("listName",soap1).getText();
// Print list text value ** THIS WORKS**
System.out.println(listNameString);
: 나는 어떤 같은 값을 잡기 위해 다음 Jdom2 코드를 사용할 수 있어요
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header/>
<soap:Body>
<soap1:UpdateListItems>
<soap1:listName>69A3FFFA-782B-45D5-B776-2BE6D5645745</soap1:listName>
<soap1:updates>
<Batch OnError="Continue">
<Method ID="1" Cmd="New">
<Field Name="Title">New Item</Field>
</Method>
</Batch>
</soap1:updates>
</soap1:UpdateListItems>
</soap:Body>
</soap:Envelope>
: 여기
은 XML이다 필드 요소를 선택하십시오. 예 : '제목'입력란은 어떻게 선택합니까?<Field Name="Title">New Item</Field>
UPDATE :
또한나는 "필드"요소에서 속성 "이름"을 얻을 수 있지만 반환하거나 속성의 값의 이름을 설정할 수 있습니다. "필드"요소 내에서 테스트에 액세스 할 수 있어야합니다.
내가이 같은 속성의 값을 얻을 수 있습니다 :이 같은 이름을 얻을 수 있습니다 System.out.println(field.getAttribute("Name").getValue()); // Prints Title
그리고 : System.out.println(field.getAttribute("Name").getName()); // Prints Name
을하지만, 나는의 텍스트 값을 반환 할 수 있어야합니다 요소.
업데이트 2 : 나는 언급하지 않았다. XML은 실제로 다음과 같이 보입니다.
` <?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header/>
<soap:Body>
<soap1:UpdateListItems>
<soap1:listName>69A3FFFA-782B-45D5-B776-2BE6D5645745</soap1:listName>
<soap1:updates>
<Batch OnError="Continue">
<Method ID="1" Cmd="New">
<Field Name="Title">New Item</Field>
<Field Name="Classification" Type="Choice">Funny</Field>
<Field Name="Title">New Item</Field>
<Field Name="Title" Type="Text">Funny List Item</Field>
</Method>
</Batch>
</soap1:updates>
</soap1:UpdateListItems>
</soap:Body>
</soap:Envelope>`
SoapUI를 통해 SharePoint에 제출할 수 있으며 작동합니다. 그러나 속성이 다른 "Field"요소가 여러 개있는 경우 Jdom2를 통해 올바른 필드를 선택하려면 어떻게해야합니까? String title = field.getText(); //returns New Item
을하지만 어떻게 "이름"속성을 사용하는 다른 "필드"요소의 텍스트를 잡을 수있을 것입니다 :
나는이 작업을 수행 할 수 있습니까?
대괄호? 무슨 꼴인가? – rolfl
요소의 텍스트 값을 반환 할 수 있어야합니다. ' 새 항목 ' –
luskbo