I am trying to use xpath queries on an xmldocument passed to my web service.
The document nodes have namespace prefixes. How can I programatically
create an xpath query and run it assuming that the namespace and prefix
could potentially change?
Here is an example of my xml (from an infopath form in this case, but could
be from any application)
<?xml version="1.0" encoding="UTF-8"?>
<?mso-infoPathSolutio n solutionVersion ="1.0.0.52" productVersion= "11.0.6357"
PIVersion="1.0. 0.0"
href="http://testmachine/infopathforms/DocumentLibrary Test.xsn"
name="urn:schem as-microsoft-com:office:info path:DocumentLi braryTest:-myXSD-2005-07-28T21-22-28"
?><?mso-application progid="InfoPat h.Document"?>
<my:Form xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:my="http://schemas.microso ft.com/office/infopath/2003/myXSD/2005-07-28T21:22:28"
xmlns:xd="http://schemas.microso ft.com/office/infopath/2003"
xml:lang="en-us">
<my:Header>
<my:PHN>1234</my:PHN>
</my:Header>
<my:Footer>
<my:DateComplet ed>2005-08-04</my:DateComplete d>
<my:CompletedBy >123</my:CompletedBy>
</my:Footer>
<my:Description >
<my:Text></my:Text>
</my:Description>
<my:Extra>
<my:Active>fals e</my:Active>
<my:ExtraText ></my:ExtraText>
</my:Extra>
</my:Form>
The document nodes have namespace prefixes. How can I programatically
create an xpath query and run it assuming that the namespace and prefix
could potentially change?
Here is an example of my xml (from an infopath form in this case, but could
be from any application)
<?xml version="1.0" encoding="UTF-8"?>
<?mso-infoPathSolutio n solutionVersion ="1.0.0.52" productVersion= "11.0.6357"
PIVersion="1.0. 0.0"
href="http://testmachine/infopathforms/DocumentLibrary Test.xsn"
name="urn:schem as-microsoft-com:office:info path:DocumentLi braryTest:-myXSD-2005-07-28T21-22-28"
?><?mso-application progid="InfoPat h.Document"?>
<my:Form xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:my="http://schemas.microso ft.com/office/infopath/2003/myXSD/2005-07-28T21:22:28"
xmlns:xd="http://schemas.microso ft.com/office/infopath/2003"
xml:lang="en-us">
<my:Header>
<my:PHN>1234</my:PHN>
</my:Header>
<my:Footer>
<my:DateComplet ed>2005-08-04</my:DateComplete d>
<my:CompletedBy >123</my:CompletedBy>
</my:Footer>
<my:Description >
<my:Text></my:Text>
</my:Description>
<my:Extra>
<my:Active>fals e</my:Active>
<my:ExtraText ></my:ExtraText>
</my:Extra>
</my:Form>
Comment