I am reading XML files of Office 2007 document using xquery. In these files the namespaces are also included. I need to retrieve the node of namespaces. I wrote xquery to fetch data and it works fine if I removed namespace from the source XML file else of the xquery resultset is empty. Wanna know how can I read namespaces and value from the xml source file using xquery 1.0. (I am not sure that whether xquery 1.0 supports namespaces and also can I have to define namespaces in DTD too for creating custom output xml file by reading data from multiple xml files.
Share
Try defining a default namespace in your XQuery prolog:
declare default element namespace "<namespace-name>";Example:
declare default element namespace "http://somewhere.com/foo";You can also declare other namespaces so you can use them in the query:
declare namespace <prefix> = "<namespace-name>";Example:
declare namespace foo = "http://somewhere.com/foo";