WebSphere Enterprise Service Bus, 버전 6.2.0 운영 체제: AIX, HP-UX, i5/OS, Linux, Solaris, Windows


anyAttribute 값 가져오기/설정 방법

<anyAttribute/> 값 설정은 <any/>를 설정하는 것과 동일한 방법으로 수행되지만 글로벌 요소 대신 글로벌 속성을 사용합니다.

anyAttribute 필드에 설정된 데이터 이름을 알고 있는 경우 기타 속성 값과 동일한 방법으로 데이터 가져오기를 수행할 수 있습니다. XPath "@<name>"을 사용하여 가져오기를 수행할 수 있으며 가져오기가 해결됩니다. 이름을 알 수 없는 경우 위의 코드를 사용하여 값을 반복시키고 차례로 값에 액세스할 수 있습니다. 다음 코드 예제는 이 작업의 수행 방법을 보여 줍니다.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:tns="http://AnyAttrOnlyMixed" 
 targetNamespace="http://AnyAttrOnly">
  <xsd:complexType name="AnyAttrOnly">
    <xsd:sequence>
      <xsd:element name="element" type="xsd:string"/>
    </xsd:sequence>
    <xsd:anyAttribute/>
  </xsd:complexType>
</xsd:schema>

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	targetNamespace="http://GlobalAttrs">
  <xsd:attribute name="globalAttribute" type="xsd:string"/>
</xsd:schema>

	DataObject dobj = ...

	// Get the global attribute Property that is going to be set
	Property globalProp = boXsdHelper.getGlobalProperty(http://GlobalAttrs, 
	"globalAttribute", false);

	// Set the value on the dobj, just like any other data
	dobj.set(globalProp, "foo");

	// The data can now be accessed by a get call
	System.out.println(dobj.get("@globalAttribute")); // Displays "foo"

concept 개념 주제

이용약관 | 피드백


시간소인 아이콘 마지막 갱신 날짜: 2010년 7월 7일 수요일


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wesb620.doc/doc/cbo_howgetsetanyattrs.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
이 Information Center는 Eclipse 기술을 기반으로 합니다(http://www.eclipse.org 웹 사이트 참조).