xml-namespaces

XML Default namespaces for unqualified attribute names?

风流意气都作罢 提交于 2019-11-26 19:50:55
问题 I'm trying to understand the correct interpretation of the "Namespaces in XML 1.0 (Third Edition)" definition for unqualified attribute namespaces. "The namespace name for an unprefixed attribute name always has no value." And later in the same section: "The attribute value in a default namespace declaration MAY be empty. This has the same effect, within the scope of the declaration, of there being no default namespace." So if I want to declare a default namespace for an element (and its

Which XML namespace to use with JSF 2.2 and up

醉酒当歌 提交于 2019-11-26 19:05:40
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? BalusC 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, Servlet 3.1, CDI 1.1, etc). Do note that this not only affects Facelets files, but also XML configuration

How to prevent blank xmlns attributes in output from .NET's XmlDocument?

戏子无情 提交于 2019-11-26 18:42:35
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="whatever:name-space-1.0"><loner /></root> Is there a solution applicable to the XmlDocument code, not something

Xml Namespace breaking my xpath! [duplicate]

最后都变了- 提交于 2019-11-26 18:30:56
This question already has an answer here: How does XPath deal with XML namespaces? 1 answer I have the following XML: <List xmlns="http://schemas.microsoft.com/sharepoint/soap/"> <Fields> <Field> </Field> </Fields> </List> This is a slimmed down version of XML being returned from a SharePoint web service. I also have the following xPath: /List/Fields/Field When I remove the xmlns from my XML the xPath works fine. When it's in there my xPath finds nothing. Is there something I should be doing differently with my xPath? Modifying the XML is not an option. Dimitre Novatchev I also have the

cvc-elt.1: Cannot find the declaration of element 'MyElement'

人走茶凉 提交于 2019-11-26 18:11:19
问题 I'm trying to validate a really simple xml using xsd, but for some reason I get this error. I'll really appreciate if someone can explain me why. XML File <?xml version="1.0" encoding="utf-8"?> <MyElement>A</MyElement> XSD File <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Test" xmlns:tns="http://www.example.org/Test" elementFormDefault="qualified"> <simpleType name="MyType"> <restriction base="string"><

How to Select XML Nodes with XML Namespaces from an XmlDocument?

依然范特西╮ 提交于 2019-11-26 17:53:12
my code attempts to grab data from the RSS feed of a website. It grabs the nodes fine, but when attempting to grab the data from a node with a colon, it crashes and gives the error "Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function." The code is shown below: WebRequest request = WebRequest.Create("http://buypoe.com/external.php?type=RSS2&lastpost=true"); WebResponse response = request.GetResponse(); StringBuilder sb = new StringBuilder(""); System.IO.StreamReader rssStream = new System.IO.StreamReader(response.GetResponseStream(), System.Text

How do XML namespaces work

不问归期 提交于 2019-11-26 17:45:24
问题 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd

How to serialize an object to XML without getting xmlns=“…”?

这一生的挚爱 提交于 2019-11-26 17:29:15
Is there a way for me to serialize an object in .NET without the XML Namespaces automatically serializing also? It seems that by default .NET believes the XSI and XSD namespaces should be included, but I don't want them there. Wes P Ahh... nevermind. It's always the search after the question is posed that yields the answer. My object that is being serialized is obj and has already been defined. Adding an XMLSerializerNamespace with a single empty namespace to the collection does the trick. In VB like this: Dim xs As New XmlSerializer(GetType(cEmploymentDetail)) Dim ns As New

f:viewParam doesn't pass required parameter when new xmlns.jcp.org namespace is used

时光怂恿深爱的人放手 提交于 2019-11-26 17:17:34
问题 I am trying to use Glassfish 4.0 with Java EE 7 XML namespaces to test the sample below. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> <h:head> <title>Title</title> </h:head> <h:body> <h:form> <ul> <ui:repeat value="#{appLoad.movieList}" var="movie"> <li> <h:link value="#{movie.title}" outcome="movie" includeViewParams="true"> <f:param name="id" value="#{movie.id}"/> </h

PHP DOMDocument getting Attribute of Tag

╄→гoц情女王★ 提交于 2019-11-26 16:55:17
问题 Hello I have an api response in xml format with a series of items such as this: <item> <title>blah balh</title> <pubDate>Tue, 20 Oct 2009 </pubDate> <media:file date="today" data="example text string"/> </item> I want to use DOMDocument to get the attribute "data" from the tag "media:file". My attempt below doesn't work: $xmldoc = new DOMDocument(); $xmldoc->load('api response address'); foreach ($xmldoc->getElementsByTagName('item') as $feeditem) { $nodes = $feeditem->getElementsByTagName(