하나의 네임 스페이스에 대해 다른 스키마가있을 때 xml 파일에서 xpath가있는 항목을 선택하려고 할 때 문제가 있습니다. 그래서이 xpath-query //f5k1:notice
를 사용XPath 한 네임 스페이스 다른 스키마
<getDataAction xmlns="http://example.org/ns1">
<getData xmlns:f4k1="http://example.org/ns2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<f4k1:place xmlns:f5k1="http://example.org/ns3">
<f4k1:city i:type="f5k1:Country" xmlns:f5k1="http://example.org/ns4">
<f5k1:notice>Notice</f5k1:notice>
</f4k1:city>
<f4k1:testvillage i:nil="true">
<f4k1:data xmlns:f5k1="http://example.org/ns5">
<f5k1:address xmlns:d7k1="http://example.org/ns6">
<f5k1:important>no</f5k1:important>
</f5k1:address>
</f4k1:data>
</f4k1:testvillage>
</f4k1:place>
</getData>
</getDataAction>
내가
<f5k1:notice>Notice</f5k1:notice>
을 선택합니다,하지만 작동하지 않습니다 감안할 때
는이 유효한 XML 파일입니다. ns5 네임 스페이스 (8 행)를 ns4 (4 행)로 변경하면 작동합니다.
이것이 작동하는 이유와 XML을 변경하지 않고 작동 시키려면 어떻게해야하는지 말해 줄 수 있습니까?
접두어'f5k1'은 XPath 표현식을 실행하는 코드의 네임 스페이스 URI에 어떻게 매핑됩니까? – jasso