How to get namespace of xml

John

New Member
I have this xml:\[code\]InputStream is = new ByteArrayInputStream( "<data:RobCtiAifoData xmlns:data=http://stackoverflow.com/"urn:cz:isvs:rob:schemas:RobDotazyData:v1\" xmlns:reg=\"urn:cz:isvs:reg:schemas:RegTypy:v1\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:cz:isvs:rob:schemas:RobUnivDotazy:v1\"><data:Aifo a=\"b\">1</data:Aifo><data:VyuzitiPoskytnuti>vyuziti</data:VyuzitiPoskytnuti> </data:RobCtiAifoData>" .getBytes());// InputStream is = new ByteArrayInputStream(xml.getBytes());DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();DocumentBuilder db = dbf.newDocumentBuilder();Document document = db.parse(is);Node node = document.getDocumentElement();\[/code\]when wanna get name of element without namespace so I wanna call substring of name of element withou prefix\[code\]node.getNodeName()\[/code\] gives me data:VyuzitiPoskytnutiand \[code\]node.getNamespaceURI()\[/code\] or \[code\]node.getPrefix()\[/code\] gives me just null. So how I can get prefix of node ?
 
Back
Top