यहां मेरा कोड है:SAX में सेट नेमस्पेसएवेयर (सत्य) सेट करते समय "xmlns: XXX" विशेषता कैसे प्राप्त करें?
path = wsdlPath;
SAXParserFactory saxfac = SAXParserFactory.newInstance();
saxfac.setNamespaceAware(true);
saxfac.setXIncludeAware(true);
saxfac.setValidating(false);
SAXParser saxParser = saxfac.newSAXParser();
saxParser.parse(wsdlPath, this);
setNamespaceAware=true
सेट करने के बाद, मुझे public void startElement(String uri, String localName, String qName, Attributes attributes)
पैरामीटर attributes
विधि public void startElement(String uri, String localName, String qName, Attributes attributes)
में xmlns:XXX
विशेषता नहीं मिल सकती है। निम्न नोड के लिए
:
<definitions name="Service1"
targetNamespace="http://www.test.com/service"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://www.test.com/">
मुझे बस name
और targetNamespace
विशेषता मिलती है। xmlns
, xmlns:wsdl
, xmlns:mime
, xmlns:http
और xmlns:tns
attributes
पैरामीटर में हैं। लेकिन वे सुलभ नहीं हैं।
setNamespaceAware=true
का उपयोग करने और नोड के सभी गुण प्राप्त करने का कोई तरीका है?
यह काम करता है! यू के लिए बहुत से धन्यवाद! – DeepNightTwo
मैंने इस सलाह का उपयोग करने की कोशिश की और पाया कि मुझे निम्नलिखित भी करना है: 'saxfac.setFeature (" http://xml.org/sax/features/namespaces ", false);' –