xml-namespaces

XPath without using local-name() or name() functions

£可爱£侵袭症+ 提交于 2019-12-01 11:53:57
问题 I have to parse oprResult/@code from below XML using XPath. The XPath expression //*[local-name()='oprResult']/@code is working as expected, BUT I could not use name or local-name functions as '(' ')' are used as delimiter in my parsing function. Is it possible to parse oprResult without local-name ? <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ChangeResponse xmlns="http://www.example.com" code="0" message="Success"> <oprResult code="0" message="Success"

How to deserialize an XML doc with a prefixed namespace but no ns-prefixed elements?

喜夏-厌秋 提交于 2019-12-01 11:51:51
I have an XML document from an external source. <?xml version="1.0" encoding="utf-8"?> <ns0:Info xmlns:ns0="http://www.ZomboCorp.com/"> <Name>Anthony</Name> <Job>Developer</Job> </ns0:Info> I need to deserialize it into an object like this. public class Info { public String Name { get; set; } public String Job { get; set; } } Used as is, the Serializer throws an InvalidOperationException <Info xmlns='http://www.ZomboCorp.com/'> was not expected. If I add [XmlElement(Namespace = "http://www.ZomboCorp.com/")] to the class definition, the Serializer returns a new Info object with null properties.

XPath without using local-name() or name() functions

梦想的初衷 提交于 2019-12-01 11:49:39
I have to parse oprResult/@code from below XML using XPath. The XPath expression //*[local-name()='oprResult']/@code is working as expected, BUT I could not use name or local-name functions as '(' ')' are used as delimiter in my parsing function. Is it possible to parse oprResult without local-name ? <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ChangeResponse xmlns="http://www.example.com" code="0" message="Success"> <oprResult code="0" message="Success"/> </ChangeResponse> </soap:Body> </soap:Envelope> Is it possible to parse oprResult without local-name

WPF xmlns: The 'clr-namespace' URI refers to a namespace that is not included in the assembly

别等时光非礼了梦想. 提交于 2019-12-01 09:55:07
问题 I am learning data binding in xaml and this xmlns problem is stopping me. My cs code is in namespace "Ping". Here is my MainWindow.xaml: <Window x:Class="Ping.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:custom="clr-namespace:WPFDemo;assembly=WPFDemo" xmlns:local="clr-namespace:Ping" The last line complains as in the title. Why is it not working? I am using "Ping" and it's the only namespace I got.

Using XPath and VB.NET to parse XML containing namespsaces

狂风中的少年 提交于 2019-12-01 09:47:31
问题 There are several related questions, but none which provide the guidance I need. Assuming the following XML: <?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" > <entry>

Trying to import XML children from one file to another

為{幸葍}努か 提交于 2019-12-01 09:21:33
I have looked into this post and found that it is almost exactly what I need to do. However, I am not able to produce the output expected given the suggestion in this post. Basically, I am trying to import </parameter> elements from an XML ( $ManifestFile ) file that contains something like: <?xml version="1.0" encoding="utf-8"?> <plasterManifest schemaVersion="1.1" templateType="Project" xmlns="http://www.microsoft.com/schemas/PowerShell/Plaster/v1"> <metadata> <name>PlasterTestProject</name> <id>4c08dedb-7da7-4193-a2c0-eb665fe2b5e1</id> <version>0.0.1</version> <title>Testing creating custom

Using perl's XML::LibXML how do you use XML Prefixes and not xmlns attributes?

試著忘記壹切 提交于 2019-12-01 09:03:11
问题 I believe this question might have been previously attempted in 2006 on a different site. But, my current XML/RDF writer ( XML::LibXML 1.70) outputs element namespaces in the form of xmlns attributes. This will exclude people using non-namespace aware parsers who just do a look_down for foaf:Person . I'm wondering if anyone knows of an easy way in perl to achive this, firstly, with XML::LibXML . Or through a different means. Nodes like this: <Person xmlns="http://xmlns.com/foaf/0.1/" rdf:ID=

WPF Custom Namespaces not working [duplicate]

∥☆過路亽.° 提交于 2019-12-01 08:59:00
问题 This question already has answers here : How to make XmlnsDefinition work on the local assembly? (2 answers) Closed 5 years ago . I follow this Guide in codeproject. So, I add this to the AssemblyInfo.cs: [assembly: XmlnsPrefix("http://my-project.com/wpf", "g")] [assembly: XmlnsDefinition("http://my-project.com/wpf", "GUI.View.Result")] [assembly: XmlnsDefinition("http://my-project.com/wpf", "GUI.ViewModel.Result")] Then I use it like this in xaml: <ResourceDictionary xmlns="http://schemas

How to deserialize an XML doc with a prefixed namespace but no ns-prefixed elements?

时光怂恿深爱的人放手 提交于 2019-12-01 08:04:49
问题 I have an XML document from an external source. <?xml version="1.0" encoding="utf-8"?> <ns0:Info xmlns:ns0="http://www.ZomboCorp.com/"> <Name>Anthony</Name> <Job>Developer</Job> </ns0:Info> I need to deserialize it into an object like this. public class Info { public String Name { get; set; } public String Job { get; set; } } Used as is, the Serializer throws an InvalidOperationException <Info xmlns='http://www.ZomboCorp.com/'> was not expected. If I add [XmlElement(Namespace = "http://www

DOM XPath query doesn't work when a xmlns is given

爱⌒轻易说出口 提交于 2019-12-01 07:15:32
问题 In Firefox JavaScript console: parser = new DOMParser(); foo = parser.parseFromString('<foo></foo>', "text/xml"); res = foo.evaluate("/foo", foo, null, 0, null); res.iterateNext(); > [object Element] foo = parser.parseFromString('<foo xmlns="http://foo.bar.baz/quux"></foo>', "text/xml"); res = foo.evaluate("/foo", foo, null, 0, null); res.iterateNext(); > null res = foo.evaluate("*[1]", foo, null, 0, null); res.iterateNext(); > [object Element] If an XML document doesn't contain an xmlns, it