xml-namespaces

PHP namespace simplexml problems

删除回忆录丶 提交于 2019-11-26 11:25:46
Evening guys. Firstly to say, I have read How do I parse XML containing custom namespaces using SimpleXML? . I'm parsing an XML document from a source not mind, and they use a custom namespace. <?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:moshtix="http://www.moshtix.com.au"> <channel> <item> <link>qweqwe</link> <moshtix:genre>asdasd</moshtix:genre> ... For example. When I parse using SimpleXML, none of the mostix: namespace elements are on show or accessible. Probably a really simple solution, but any ideas guys? Usually, people use children() . $rss = simplexml_load_string(

How do I specify XML serialization attributes to support namespace prefixes during deserialization in .NET?

点点圈 提交于 2019-11-26 11:09:09
问题 I have a following XML: <person xmlns:a=\"http://example.com\" xmlns:b=\"http://sample.net\"> <a:fName>John</a:fName> <a:lName>Wayne</a:lName> <b:age>37</b:age> </person> How do I define XML serialization attributes on a class to support described scenario? 回答1: You'll need to indicate which namespaces each field requires by using Namespace of XmlElement attribute. This will allow you to associate a field with a particular namespace, but you'll also need to expose a property on your class

What is the &#39;app&#39; Android XML namespace?

坚强是说给别人听的谎言 提交于 2019-11-26 09:51:48
Here is an example of the app namespace that I've seen from a res/menu/main.xml file <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity" > <item android:id="@+id/action_settings" android:title="@string/action_settings" android:orderInCategory="100" app:showAsAction="never" /> </menu> What purpose does the app namespace serve? Is it a "standard" Android XML namespace? Are the same value options available for the same attribute placed in two different

How to ignore namespace when selecting XML nodes with XPath

好久不见. 提交于 2019-11-26 09:35:19
问题 I have to parse an XML document that looks like this: <?xml version=\"1.0\" encoding=\"UTF-8\" ?> <m:OASISReport xmlns:m=\"http://oasissta.caiso.com/mrtu-oasis/xsd/OASISReport.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://oasissta.caiso.com/mrtu-oasis/xsd/OASISReport.xsd http://oasissta.caiso.com/mrtu-oasis/xsd/OASISReport.xsd\"> <m:MessagePayload> <m:RTO> <m:name>CAISO</m:name> <m:REPORT_ITEM> <m:REPORT_HEADER> <m:SYSTEM>OASIS</m:SYSTEM> <m:TZ>PPT<

Why are URLs in XML namespaces?

岁酱吖の 提交于 2019-11-26 09:11:57
问题 Take this line as just one example: <configuration xmlns:xdt=\"http://schemas.microsoft.com/XML-Document-Transform\"> </configuration> Some brief research has taught me that nothing necessarily has to be hosted at that URL. Therefore, if it\'s just a reference to a namespace contained in a local assembly, why use URLs instead of regular namespaces like the ones typically used by .NET (System.Data, for example)? 回答1: It's just a convention. URIs (which is what they are, not really URLs) are a

How to prevent blank xmlns attributes in output from .NET&#39;s XmlDocument?

独自空忆成欢 提交于 2019-11-26 06:35:15
问题 When generating XML from XmlDocument in .NET, a blank xmlns attribute appears the first time an element without an associated namespace is inserted; how can this be prevented? Example: XmlDocument xml = new XmlDocument(); xml.AppendChild(xml.CreateElement(\"root\", \"whatever:name-space-1.0\")); xml.DocumentElement.AppendChild(xml.CreateElement(\"loner\")); Console.WriteLine(xml.OuterXml); Output: <root xmlns=\"whatever:name-space-1.0\"><loner xmlns=\"\" /></root> Desired Output: <root xmlns=

Which XML namespace to use with JSF 2.2 and up

孤者浪人 提交于 2019-11-26 05:38:14
问题 I have migrated my application from JSF 1.2 to 2.2. It used XML namespaces on java.sun.com domain like xmlns:f=\"http://java.sun.com/jsf/core\" . However, Oracle\'s Java EE 7 tutorial is using XML namespaces on xmlns.jcp.org domain like xmlns:f=\"http://xmlns.jcp.org/jsf/core\" . Which one is recommended and why was this changed? 回答1: Which one is recommended? Go ahead with XML namespaces on xmlns.jcp.org domain. This was newly introduced since Java EE 7 in 2013 (which covers a.o. JSF 2.2,

XML Namespaces and Unprefixed Attributes

匆匆过客 提交于 2019-11-26 04:56:16
问题 The specification of XML Namespaces explains that the interpretation of unprefixed attributes is determined by the element on which they appear. And that the namespace name for an unprefixed attribute name always has no value. How does this rule apply to the namespace of the attribute jid in the following cases. <query xmlns=\"jabber:iq:roster\"> <item jid=\"romeo@example.com\"></item> </query> If the declaration of the namespace and the attribute in question both don\'t have an prefix, the

XPath select node with namespace

只愿长相守 提交于 2019-11-26 04:41:07
问题 Its a .vbproj and looks like this <Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"> <PropertyGroup> <ProjectGuid>15a7ee82-9020-4fda-a7fb-85a61664692d</ProjectGuid> all i want to get is the ProjectGuid but it does not work when a namespace is there... Dim xmlDoc As New XmlDocument() Dim filePath As String = Path.Combine(mDirectory, name + \"\\\" + name + \".vbproj\") xmlDoc.Load(filePath) Dim value As Object = xmlDoc.SelectNodes(\"/Project

how to ignore namespaces with XPath

牧云@^-^@ 提交于 2019-11-26 04:38:00
问题 My goal is to extract certain nodes from multiple xml files with multiple namespaces using XPath. Everything works fine as long as i know the namespace URIs. The namespace name itself remains constant, but the Schemas (XSD) are sometimes client-generated i.e. unknown to me. Then i am left with basically three choices : use just one schema for the namespace, hoping nothing goes wrong (can i be sure?) get the children nodes of the document and look for the first node with a namespace URI,