XML Namespace evaluation using properties file in java
852806Sep 6 2011 — edited Sep 21 2011Hi All,
In my java class, i am receiving the xml as string. I am converting this string into xml . Then to evaluate the xpath, i am able to evaluate the xpath by using the namespace prefix and the namespace url as key value pairs in my properties file. It worked fine.
But my project requirement is that,
I can receive different xmls with different sets of namespaces. For each xml, the namespace prefix and the url wil be fixed. So that, I can keep track of a set of namespace prefix and url for each xml.
The problem here is that
XML_A is having its own namespace prefix - ns1 which points to "http://orders.com/purchase" , ns2 which points to "http://orders.com/invoice"
XML_B is having its own namespace prefix - ns1 which points to "http://sales.com/stock", ns2 which points to "http://sales.com/item" - i mean same ns1 and ns2
Kindly tell me , whether there is any possibility in build.properties file, to group the key-value pair. so that i need not lead to any conflict, because of having different namespace urls
for the same key 'ns1'.
ns1=http://orders.com/purchase
ns1=http://sales.com/stock
I want the above two lines to occur in the same build.properties file. Also that, while using MapObj.get("ns1") - (where MapObj will refer to the build.properties file key-values.)
I want to differentiate the ns1 based on some condition (xml_name in my case).
Here for the prefix, i have no other go to concat something to differentiate like A_ns1 and B_ns2. This will create problems. So, kindly help me by giving some other alternative.
Thanks,
Sabarisri. N