1
xmllint 및 "네임 스페이스 지원"에 대한 많은 항목을 stackoverflow에서 찾았지만 아무도 도움이되지 않았습니다. 여기 xmllint - 네임 스페이스가있는 xml 파일을 구문 분석합니다.
파일 (XSD 정확한 수) 내 XML입니다 : 나는이 파일에서 "내 텍스트"체인 그래서 나는이 시도 검색 할<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation>My Text</xsd:documentation>
</xsd:annotation>
</xsd:schema>
:
xmllint myfile.xsd --xpath "/*[namespace-uri()='http://www.w3.org/2001/XMLSchema' and
name()='schema']/*[namespace-uri()='http://www.w3.org/2001/XMLSchema' and
name()='annotation']/*[namespace-uri()='http://www.w3.org/2001/XMLSchema' and
name()='documentation']/text()"
을하지만 아무튼 일하지 마라. 나는 "Segmentation Fault"를 얻는다.
UPDATE
나는 또 다른 질문이 :이 파일에 내 태그의 속성 "토토"값을 얻기 위해 사용해야 무엇 :
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:toto="testAtributeValue">
<xsd:annotation>
<xsd:documentation>myText</xsd:documentation>
</xsd:annotation>
</xsd:schema>
이 다른 방법을 넣어를, 내가 원하는 get "testAtributeValue"
+1 나에게 도움이되었습니다. –