xml-namespaces

Java: Marshalling Object — Removing extra ns2 annotation in xml

风格不统一 提交于 2019-11-27 22:53:37
I am trying to marshall data within an object into an xml file based on a defined schema. However when I print out the xml file, I recieve extra annotations on the xml tags. Is there any way to get rid of the extra namespace annotation (i.e. ns2) This is an example of the xml I receive from marshalling. <?xml version="1.0" encoding="UTF-8" standalone="yes"> <root xmlns:ns2="http://www.something.com/something"> <ns2:food>steak</ns2:food> <ns2:beverage>water</ns2:beverage> </root> What I want is something like this: <?xml version="1.0" encoding="UTF-8" standalone="yes"> <root xmlns="http://www

How do XML namespaces work

戏子无情 提交于 2019-11-27 20:40:20
<?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 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring

XML Default namespaces for unqualified attribute names?

社会主义新天地 提交于 2019-11-27 19:21:57
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 children), do I also have to declare a prefix-namespace mapping for any attributes which reside within that

XSD with elements from other namespace

半城伤御伤魂 提交于 2019-11-27 19:06:40
I have two XSDs that are definining different documents. Say A.xsd defines an element ElementA as the root, with some complex rules. Now B.xsd defines an element ElementB that is supposed to use ElementA somewhere in between. For example I want the XML file for ElementB look like this: <?xml version="1.0" encoding="utf-8"?> <ElementB xmlns="http://example.com/namespace/for/ElementB"> <foo>Bla</foo> <bar>Blub</bar> <ElementA xmlns="http://example.com/namespace/for/ElementA"> <!-- ... --> </ElementA> </ElementB> Then B.xsd could look like this: <?xml version="1.0" encoding="utf-8"?> <xs:schema

XSL - How to remove unused namespaces from source xml?

岁酱吖の 提交于 2019-11-27 17:32:31
问题 I have an xml with a lot of unused namespaces, like this: <?xml version="1.0" encoding="UTF-8"?> <ns1:Envelope xmlns:ns1="http://www.a.com" xmlns:ns2="http://www.b.com" xmlns:ns3="http://www.c.com" xmlns:ns4="http://www.d.com"> <ns1:Body> <ns2:a> <ns2:b>data1</ns2:b> <ns2:c>data2</ns2:c> </ns2:a> </ns1:Body> </ns1:Envelope> I would like to remove the unused namespaces without having to specify in the xslt which ones to remove/maintain. The result xml should be this: <?xml version="1.0"

xaml what is “local:”?

爷,独闯天下 提交于 2019-11-27 17:16:35
问题 What is local: in XAML, and what parameters in a C# class can be called local: ? In some code I am looking at, I see xmlns:local="clr-namespace:AskLocal" . What does this mean? 回答1: In XAML the local alias is commonly used when referring to the namespace in which the current class is declared. It is not mandatory, it is just commonly done. 回答2: local is an xml namespace. In this case "local" will be the alias for the namespace AskLocal. It will allow you to declare resources, controls,

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

萝らか妹 提交于 2019-11-27 15:47:58
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:link> </li> </ui:repeat> </ul> </h:form> </h:body> </html> It links to the following page movie.xhtml :

PHP DOMDocument getting Attribute of Tag

回眸只為那壹抹淺笑 提交于 2019-11-27 14:49:37
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('media:file'); $linkthumb = $nodes->item(0)->getAttribute('data'); } What am I doing wrong? Please help.

Using new xmlns.jcp.org namespace on composites causes java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent

送分小仙女□ 提交于 2019-11-27 14:31:29
I am reading The Java EE 7 Tutorial from http://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets005.htm#GIQZR After I typed the example code in the chapter 8.5 Composite Components in my IDE and run the example on GlassFish4.0, I got an error java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1078) at com.sun.faces.util.Cache.get(Cache.java:116) at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata(FaceletViewHandlingStrategy.java:237) at com.sun.faces.application.ApplicationImpl.createComponent

Controlling namespace prefixes in JAXB

倖福魔咒の 提交于 2019-11-27 14:29:07
How does jaxb determine the list of namespace prefix declarations whem marshalling an object? I used xjc to compile java classes for ebics ( ebics schema ). When I create an instance for an ebicsRequest it looks like this: <?xml version="1.0" encoding="UTF-16"?> <ns2:ebicsRequest xmlns:ns2="http://www.ebics.org/H003" Revision="1" Version="H003" xmlns="http://www.ebics.org/H003" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ns4="http://www.ebics.org/S001" xmlns:ns5="http://www.ebics.org/H000"> <ns2:header authenticate="true"> <ns2:static> <ns2:HostID>SIZBN001</ns2:HostID> <ns2:Nonce