xml-namespaces

How do I access an element with xpath with a namespace in powershell?

孤人 提交于 2019-12-05 03:57:46
Powershell: $doc = new-object System.Xml.XmlDocument $doc.Load($filename) $items = Select-Xml -Xml $doc -XPath '//item' $items | foreach { $item = $_ write-host $item.name } I get no output XML: <?xml version="1.0" encoding="UTF-8"?> <submission version="2.0" type="TREE" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:noNamespaceSchemaLocation="TREE.xsd" xmlns="some/kind/of/tree/v1"> <group> <item></item> <item></item> <item></item> </group> <submission> You've got a few problems going on. First you need to specify the namespace in the XPath pattern, the XML isn't well formed

Querying XML data types which have xmlns node attributes

夙愿已清 提交于 2019-12-05 03:10:31
I have the following SQL query: DECLARE @XMLDOC XML SET @XMLDOC = '<Feed><Product><Name>Foo</Name></Product></Feed>' SELECT x.u.value('Name[1]', 'varchar(100)') as Name from @XMLDOC.nodes('/Feed/Product') x(u) This returns: Name ---- Foo However, if my <Feed> node has an xmlns attribute, then this doesn't return any results: DECLARE @XMLDOC XML SET @XMLDOC = '<Feed xmlns="bar"><Product><Name>Foo</Name></Product></Feed>' SELECT x.u.value('Name[1]', 'varchar(100)') as Name from @XMLDOC.nodes('/Feed/Product') x(u) Returns: Name ---- This only happens if I have an xmlns attribute, anything else

Java XPath: Get all the elements that match a query

江枫思渺然 提交于 2019-12-05 01:09:33
I want to make an XPath query on this XML file (excerpt shown): <?xml version="1.0" encoding="UTF-8"?> <!-- MetaDataAPI generated on: Friday, May 25, 2007 3:26:31 PM CEST --> <Component xmlns="http://xml.sap.com/2002/10/metamodel/webdynpro" xmlns:IDX="urn:sap.com:WebDynpro.Component:2.0" mmRelease="6.30" mmVersion="2.0" mmTimestamp="1180099591892" name="MassimaleContr" package="com.bi.massimalecontr" masterLanguage="it"> ... <Component.UsedModels> <Core.Reference package="com.test.test" name="MasterModel" type="Model"/> <Core.Reference package="com.test.massimalecontr" name="MassimaleModel"

XElement is automatically adding xmlns=“” to itself

不羁岁月 提交于 2019-12-04 22:27:28
I am creating a new XDocument from a table. I have to validate the document from an XSD document and it keeps failing because it add the xmlns="" to one of the Elements when it shouldn't. Here's parts of the code that are pertinent. XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance"; XNamespace xmlns = "https://uidataexchange.org/schemas"; XElement EmployerTPASeparationResponse = null; XElement EmployerTPASeparationResponseCollection = new XElement(xmlns + "EmployerTPASeparationResponseCollection", new XAttribute(XNamespace.Xmlns + "xsi", xsi), new XAttribute(xsi + "schemaLocation",

XSLT root tag namespace instead of element attribute namespace

大憨熊 提交于 2019-12-04 20:48:58
问题 I have a XSL file to transfer another XSL file. I want the namespace declaration to be on the root tag, instead of it being repeated on every single element!! Here is my stylesheet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mynamespace="somenamespace" version="2.0"> <xsl:output method="xml" omit-xml-declaration="no" standalone="yes" indent="yes" /> <xsl:template match="myMatchedNode"> <mynamespace:tag>Some text i want inserted into the xsl</mynamespace:tag> <xsl

Is it legal to have different SOAP namespaces/versions between the request and response?

孤街醉人 提交于 2019-12-04 20:21:45
THIRD EDIT: I now believe that this problem is due to a SOAP version mismatch (1.1 request, 1.2 response) masquerading as a namespace problem. Is it illegal to mix versions, or just bad style? Am I completely out of luck if I can't change my SOAP version or the service's? SECOND EDIT: Clarified error message, and tried to reduce "tl;dr"-ness. EDIT: [Link deleted, not related] Using soapUI, I'm sending a request that starts with: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ... and getting a response that starts with: <soap:Envelope xmlns:soap="http://www.w3.org

Android XML DOM Parsing when you have namespaces?

…衆ロ難τιáo~ 提交于 2019-12-04 19:18:13
When you have xml nodes with namespaces like: <ns:abc> then getElementsByTagName("abc"); fails, but getElementsByTagName("ns:abc"); works. But the issue is I don't know what is the namespace prefix chosen. Also for me, getElementsByTagNameNS("*", "abc"); and getElementsByTagNameNS("http://abcnamespace.com", "abc"); both return null. If device is of interest, I am using CM7 on Nook. I don't want to use SAX, any other clean way to read the node lists. Evgeny Zhuravlev DocumentBuilderFactory.setNamespaceAware(true) should fix your problem. 来源: https://stackoverflow.com/questions/7076149/android

How to query default namespace with MSXML

女生的网名这么多〃 提交于 2019-12-04 17:03:39
问题 I have some XML: <?xml version="1.0" ?> <Project ToolsVersion="4.0"> <PropertyGroup Condition="'$(key)'=='1111'"> <Key>Value</Key> </PropertyGroup> </Project> Note : This isn't the actual XML i'm using, it's just prettier and shorter, and demonstrates the problem. Using MSXML i can query for nodes: IXMLDOMNode node = doc.selectSingleNode("//PropertyGroup/@Condition"); And it works fine: Condition="'$(key)'=='1111'" But that's not really the XML i have In reality the XML i have contains a

Parse and query SOAP in C#

…衆ロ難τιáo~ 提交于 2019-12-04 16:57:49
I am trying to parse a heavily namespaced SOAP message (source can be found also here ): <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <ns1:TransactionID soapenv:mustUnderstand="1" xsi:type="xsd:string" xmlns:ns1="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2">0a00f556419041c08d8479fbaad02a3c</ns1:TransactionID> </soapenv:Header> <soapenv:Body> <SubmitRsp xmlns="http://www.3gpp.org

Spring 3 applicationContext-security-JDBC.xml has beans:bean not bean?

半世苍凉 提交于 2019-12-04 14:00:00
问题 can someone please tell me what in my ApplicationContext I have to use beans:bean and not bean and how to fix it. <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans