XmlElement
개요
XmlElement는 Aspose.Slides FOSS for C++에 포함된 클래스입니다.
OOXML 조작을 위한 경량 인메모리 XML 요소입니다. 요소 이름은 Clark 표기법을 사용합니다: {namespace-uri}local-name. 속성은 단순한 이름-값 쌍으로 저장됩니다.
이 클래스는 C++ 프로그램에서 XmlElement 객체를 다루기 위한 25개의 메서드를 제공합니다. 사용 가능한 메서드에는 add_sub_element, append_child, child_count, children, find, find_all, get, get_optional, has_attribute, index_of, insert_child, local_name 및 추가 13개의 메서드가 포함됩니다. Aspose.Slides FOSS for C++ 패키지를 설치한 후에는 모든 공개 멤버를 어느 C++ 애플리케이션에서도 사용할 수 있습니다.
메서드
| 시그니처 | 설명 |
|---|---|
name() → std::string | @name Identity @{ |
local_name() → std::string | 요소의 로컬(자격이 없는) 이름을 반환합니다 |
namespace_uri() → std::string | 요소와 연결된 네임스페이스 URI를 반환합니다 |
get(attr: std::string_view, default_val: std::string_view) → std::string | @} @name Attributes @{ |
get_optional(attr: std::string_view) → std::optional<std::string> | 존재하는 경우 속성 값을 포함하는 Optional을 반환합니다 |
set(attr: std::string_view, value: std::string_view) | 지정된 속성을 주어진 값에 할당하고, 없을 경우 추가합니다 |
remove_attribute(attr: std::string_view) | 요소에서 지정된 속성을 삭제합니다 |
has_attribute(attr: std::string_view) → bool | 요소가 지정된 속성을 포함하고 있으면 true를 반환합니다 |
text() → std::string | @} @name 텍스트 내용 @{ |
set_text(value: std::string_view) | |
children() → std::vector<Ptr> | @} @name 자식 @{ |
append_child(child: Ptr) → Ptr | 요소의 자식 목록 끝에 자식 노드를 추가하고 반환합니다. |
add_sub_element(name: std::string_view) → Ptr | 주어진 이름으로 새로운 자식 요소를 생성하고, 추가한 뒤 반환합니다. |
insert_child(index: std::size_t, child: Ptr) | 지정된 자식을 요소의 자식들 중 주어진 인덱스에 삽입합니다. |
remove_child(child: Ptr) | 요소에서 지정된 자식 노드를 제거합니다. |
remove_child_at(index: std::size_t) | 주어진 인덱스에 위치한 자식 노드를 제거합니다. |
find(name: std::string_view) → Ptr | 주어진 이름과 일치하는 이름을 가진 첫 번째 하위 요소를 반환합니다 |
find_all(name: std::string_view) → std::vector<Ptr> | 지정된 이름을 가진 모든 하위 요소들의 벡터를 반환합니다 |
index_of(child: Ptr) → std::optional<std::size_t> | 해당 자식이 존재하면 그 인덱스를 반환하고, 그렇지 않으면 빈 옵션을 반환합니다 |
child_count() → std::size_t | |
set_namespace(prefix: std::string_view, uri: std::string_view) | @} @name 네임스페이스 맵 (직렬화를 위한) @{ |
namespace_map() → std::vector<std::pair<std::string, std::string>> | |
parse(xml: std::string_view) → Ptr | @} @name Serialization @{ |
serialize(xml_declaration: bool, pretty_print: bool) → std::string | 요소와 그 자식들을 선택적 선언 및 예쁘게 출력 옵션과 함께 XML 문자열로 변환합니다 |
unescape_xml(input: std::string_view) → std::string | @} XML 엔티티(&, <, >, ‘, ")를 역이스케이프합니다. |