Yes and thanks for share this experience! 2012/1/31 Ashok Hariharan <[email protected]>
> Hi -- > > I found the fix myself -- > > so the trick is to set the namespace context as the OdfFileDom object. > > e.g. > > XPath xpathObj = odfFileDomobject.getXpath(); > xpathObj.setNamespaceContext(odfFileDomobject); > > after that everything works fine. > > Ashok > > On Tue, Jan 31, 2012 at 10:19 AM, Ashok Hariharan > <[email protected]> wrote: > > Hello there -- > > > > I am using the RDF metadata provided by the ODF 1.2 specification in > > my ODT documents to record metadata. > > > > So the metadata gets captured in the rdf: namespace , and the metadata > > entities and objects within it get captured in their own namespace. > > > > My problem is I am unable to access the RDF metadata using ODFDOM XPath. > > > > e.g. -- I access the RDF metadata file via OdfFileDom (i have it in > > meta/meta.rdf ) > > > > then I try to access it via XPath -- "//rdf:Description" , I always > > get a namespace error ... > > > > If I set the namespace on the XPath object or If i set it globally on > > OdfNamespace: > > > > OdfNamespace.newNamespace("rdf","...."); > > > > I am still unable to access it ... > > > > Note : if I access it without the namespace "//*[local-name() = > > 'Description'] , it works . > > > > So whats the correct way to set foreign namespaces in ODFDOM ? > > > > thanks , > > > > Ashok > -- -Devin
