xml-namespaces

PHP namespace simplexml problems

丶灬走出姿态 提交于 2019-11-26 03:31:52
问题 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.

What are XML namespaces for?

我们两清 提交于 2019-11-26 02:34:56
问题 This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML schemas? Should XSD schemas always be associated with a namespace? 回答1: They're for allowing multiple markup languages to be combined, without having to worry about conflicts of element and attribute names. For example, look at any bit of XSLT code,

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

独自空忆成欢 提交于 2019-11-26 02:05:10
问题 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 \

How to query XML using namespaces in Java with XPath?

自作多情 提交于 2019-11-26 01:40:00
问题 When my XML looks like this (no xmlns ) then I can easly query it with XPath like /workbook/sheets/sheet[1] <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> <workbook> <sheets> <sheet name=\"Sheet1\" sheetId=\"1\" r:id=\"rId1\"/> </sheets> </workbook> But when it looks like this then I can\'t <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> <workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org

What does “xmlns” in XML mean?

我们两清 提交于 2019-11-25 23:58:42
问题 I saw the following line in an XML file: xmlns:android=\"http://schemas.android.com/apk/res/android\" I have also seen xmlns in many other XML files that I\'ve come across. What is it? 回答1: It defines an XML Namespace. In your example, the Namespace Prefix is " android " and the Namespace URI is " http://schemas.android.com/apk/res/android " In the document, you see elements like: <android:foo /> Think of the namespace prefix as a variable with a short name alias for the full namespace URI.

Parsing XML with namespace in Python via &#39;ElementTree&#39;

房东的猫 提交于 2019-11-25 23:57:32
问题 I have the following XML which I want to parse using Python\'s ElementTree : <rdf:RDF xml:base=\"http://dbpedia.org/ontology/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns=\"http://dbpedia.org/ontology/\"> <owl:Class rdf:about=\"http://dbpedia.org/ontology/BasketballLeague\"> <rdfs:label xml:lang=\"en\">basketball league</rdfs

How does XPath deal with XML namespaces?

China☆狼群 提交于 2019-11-25 23:56:27
问题 How does XPath deal with XML namespaces? If I use /IntuitResponse/QueryResponse/Bill/Id to parse the XML document below I get 0 nodes back. <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> <IntuitResponse xmlns=\"http://schema.intuit.com/finance/v3\" time=\"2016-10-14T10:48:39.109-07:00\"> <QueryResponse startPosition=\"1\" maxResults=\"79\" totalCount=\"79\"> <Bill domain=\"QBO\" sparse=\"false\"> <Id>=1</Id> </Bill> </QueryResponse> </IntuitResponse> However, I\'m not

Use Linq to Xml with Xml namespaces

孤者浪人 提交于 2019-11-25 23:47:31
问题 I have this code : /*string theXml = @\"<Response xmlns=\"\"http://myvalue.com\"\"><Result xmlns:a=\"\"http://schemas.datacontract.org/2004/07/My.Namespace\"\" xmlns:i=\"\"http://www.w3.org/2001/XMLSchema-instance\"\"><a:TheBool>true</a:TheBool><a:TheId>1</a:TheId></Result></Response>\";*/ string theXml = @\"<Response><Result><TheBool>true</TheBool><TheId>1</TheId></Result></Response>\"; XDocument xmlElements = XDocument.Parse(theXml); var elements = from data in xmlElements.Descendants(\

Reference - how do I handle namespaces (tags and attributes with colon in) in SimpleXML?

喜欢而已 提交于 2019-11-25 22:58:18
问题 This question is intended as a reference to answer a particularly common question, which might take different forms: I have an XML document which contains multiple namespaces; how do I parse it with SimpleXML? My XML has a colon (\":\") in the tag name, how do I access it with SimpleXML? How do I access attributes in my XML file when they have a colon in their name? If your question has been closed as a duplicate of this, it may not be identical to these examples, but this page should tell