xml-namespaces

Resolve namespaces with SimpleXML regardless of structure or namespace

房东的猫 提交于 2019-12-02 09:33:13
I got a Google Shopping feed like this (extract): <?xml version="1.0" encoding="utf-8" ?> <rss version="2.0" xmlns:g="http://base.google.com/ns/1.0"> ... <g:id><![CDATA[Blah]]></g:id> <title><![CDATA[Blah]]></title> <description><![CDATA[Blah]]></description> <g:product_type><![CDATA[Blah]]></g:product_type> Now, SimpleXML can read the "title" and "description" tags but it can't read the tags with "g:" prefix. There are solutions on stackoverflow for this specific case, using the "children" function. But I don't only want to read Google Shopping XMLs, I need it to be undependend from structure

Copy all elements of a namespace and nothing else

隐身守侯 提交于 2019-12-02 08:49:31
问题 We have a bunch of files that are html pages but which contain additional xml elements (all prefixed with our company name 'TLA') to provide data and structure for an older program which I am now rewriting. Example Form: <html > <head> <title>Highly Simplified Example Form</title> </head> <body> <TLA:document xmlns:TLA="http://www.tla.com"> <TLA:contexts> <TLA:context id="id_1" value=""></TLA:context> </TLA:contexts> <TLA:page> <TLA:question id="q_id_1"> <table> <tr> <td> <input id="input_id

Strange behavior with xml-namespace

半腔热情 提交于 2019-12-02 08:26:37
Why do I get an empty output? When I remove the xmlns part in the xml the output is as expected, but then intellisense doesn't work anymore. warehouse.xml <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="warehouse.xsl"?> <warehouse xmlns="http://schema.mynamespace.net"> <container> <item> <name>book</name> <value>1.23</value> </item> <item> <name>phone</name> <value>45.6</value> </item> </container> </warehouse> warehouse.xsl <xsl:stylesheet xmlns="http://schema.mynamespace.net" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method=

Namespace in XML element value?

半腔热情 提交于 2019-12-02 08:09:23
问题 I recently stumbled across this: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"> <s:Header> <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</a:Action> <a:MessageID>uuid:21859bf9-6193-4c8a-ad50-d082e6d296ab</a:MessageID> <a:ReplyTo> <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address> </a:ReplyTo> <a:To s:mustUnderstand="1">urn:schemas-xmlsoap-org:ws

How to declare element

不羁的心 提交于 2019-12-02 08:03:57
I'm looking for validate an XML document with xrm prefix as you can read here : I wrote the following XML Schema : </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> However, when I check my XML document, I get the following error: 'xrm:plugin' is not a valid value for 'NCName' I understand I can't put xrm: in my name, but how can I validate my xrm:plugin and xrm:header ? Because, if I try to validate my XML document, I get this error: Cannot find the declaration of element 'xrm:plugin'. xrm is a namespace prefix, an abbreviation for the namespace. As the syntax error

.Net Add namespace to XML document as default and with a prefix

和自甴很熟 提交于 2019-12-02 07:46:56
When using XMLSerializer to create an XML string of a serialization of a class oXML in vb.net as follows: Dim x As New Xml.Serialization.XmlSerializer(oXML.GetType, "urn:oecd:blah:blah") Dim xmlns = New XmlSerializerNamespaces() xmlns.Add(String.Empty, "urn:oecd:blah:blah") xmlns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance") xmlns.Add("sfa", "urn:oecd:blah:blah1") xmlns.Add("iso", "urn:oecd:blah:blah2") xmlns.Add("ftc", "urn:oecd:blah:blah") Dim sw As New IO.StringWriter() x.Serialize(sw, oXML, xmlns) You will notice that I have repeated the addition of namespace "urn:oecd:blah:blah"

How to reference element in other XSD's namespace?

独自空忆成欢 提交于 2019-12-02 07:16:10
问题 I have a complexType that's defined across two .XSD files. Parent.xsd: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:Parent" xmlns:emb="urn:Embedded" targetNamespace="urn:Parent" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="urn:Embedded" schemaLocation="Embedded.xsd"/> <xs:element name="ParentType"> <xs:complexType> <xs:sequence> <xs:element name="embedded" type="emb:EmbeddedType"></xs

Extract XML namespace declarations into separate tagfile/taglib

余生长醉 提交于 2019-12-02 06:31:03
问题 I would like to seperate my XML namespace declarations at the top of the page into a seperate (tag)file in which I can include in any Facelets page I wish. Is this possible? Or do I need to copypaste all XML namespaces in each Facelets file? Here's a theoretical example, xmlns.xhtml : <something xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl

why would an inline XMLNS change the entire tag structure? JSF

ぃ、小莉子 提交于 2019-12-02 06:25:44
My apologies in advance, i don't do a lot of front end development. But in short xmlns attributes are removing tags and moving them around in the rendered document. This is probably a JSF issue as it even happens in view source. This svg tag works and does not alter the structure: <svg id="Layer_1" x="0px" y="0px" width="150px" height="150px" viewBox="0 0 150 150" enable-background="new 0 0 150 150"> But as soon as an xml namespace is declared, all the code on the page is altered. It moves my span tags, a tags, heading tags, removes closing div tags, and orders them in a way that just breaks

How to reference element in other XSD's namespace?

為{幸葍}努か 提交于 2019-12-02 05:59:31
I have a complexType that's defined across two .XSD files. Parent.xsd: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:Parent" xmlns:emb="urn:Embedded" targetNamespace="urn:Parent" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="urn:Embedded" schemaLocation="Embedded.xsd"/> <xs:element name="ParentType"> <xs:complexType> <xs:sequence> <xs:element name="embedded" type="emb:EmbeddedType"></xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Embedded.xsd: <?xml version="1.0"