xml-namespaces

Create xmlns attribute in the XML using XSLT Transformation

流过昼夜 提交于 2019-12-04 12:24:29
I am trying to add the xmlns attribute to the resulting XML with a value passed by parameter during XSLT transformation using JDK Transformer (Oracle XML v2 Parser or JAXP) but it always defaults to http://www.w3.org/2000/xmlns/ My source XML <test/> My XSLT <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://example.com"> <xsl:param name="myNameSpace" select="'http://neilghosh.com'"/> <xsl:template match="/"> <process> <xsl:attribute name="xmlns:neil"> <xsl:value-of select="$myNameSpace"/> </xsl:attribute> <

JAX-WS: why nested elements are in “” namespace?

点点圈 提交于 2019-12-04 12:19:14
问题 Having a toy service as below @WebService(targetNamespace="http://www.example.org/stock") @SOAPBinding(style=Style.RPC,parameterStyle=ParameterStyle.WRAPPED) public class GetStockPrice { @WebMethod(operationName="GetStockPrice",action="urn:GetStockPrice") @WebResult(partName="Price") public Double getPrice( @WebParam(name="StockName") String stock ) { return null; } } JAX-WS-generated client creates a SOAP message where StockName parameter has no namespace: <?xml version='1.0' encoding='UTF-8

JAXB appending unneeded namespace declarations to tags

天涯浪子 提交于 2019-12-04 10:47:34
问题 I'm implementing a homebrew subprotocol of XMPP, and i'm using combination of StAX and JAXB for parsing/marshalling mesages. And when I marshall a message I end up with loads of unneded namespace declarations: <ns2:auth xmlns:ns2="urn:ietf:params:xml:ns:ilf-auth" xmlns:ns4="ilf:iq:experiment:power" xmlns:ns3="ilf:iq:experiment:init" xmlns:ns5="ilf:iq:experiment:values" xmlns:ns6="ilf:iq:experiment:result" xmlns:ns7="ilf:iq:experiment:stop" xmlns:ns8="ilf:iq:experiment:end"> compton@ilf</ns2

Dom4j selectNodes(arg) don't give list of nodes

て烟熏妆下的殇ゞ 提交于 2019-12-04 06:13:49
I am using DOM4j for XML work in java, my xml is like this: <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <abcd name="ab.catalog" xmlns="http://www.xyz.com/pqr" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.com/pqr ./abc.xyz.xsd"> <efg> ...... </efg> <efg> ..... </efg> </abcd> then, List<Node>list = document.selectNodes("/abcd/efg"); gets the size of list zero. I feel it's due to namespace specified in the xml. I tried a lot but cn't get success. Unprefixed element names in XPath expressions refer to elements that are not in a namespace -

In C#, is there a way to generate an XDocument using the short prefix instead of the full namespace for each node?

橙三吉。 提交于 2019-12-04 05:00:01
I'm simply trying to make my XML a bit tidier and less bulky. I know in C# one can do something like this: XNamespace ds = "http://schemas.microsoft.com/ado/2007/08/dataservices"; new XElement(ds + "MyDumbElementName", "SomethingStupid"); And get an XML simliar to this: <root> <MyDumbElementName xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices"> SomethingStupid </MyDumbElementName> </root> Instead of something like this: <root xmlns:ds="http://schemas.microsoft.com/ado/2007/08/dataservices"> <ds:MyDumbElementName> SomethingStupid </ds:MyDumbElementName> </root> Obviously the second

XSLT does not work when I include xmlns=“http://www.sitemaps.org/schemas/sitemap/0.9”

不想你离开。 提交于 2019-12-04 00:45:56
My Google sitemap renders well through XSLT fine without the xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" in the < urlset > element, however when included, my foreach statement doesn't work and nothing renders in the template. My code's below. Thanks for your help. XML <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>{site_url}</loc> <lastmod>{current_time format="%Y-%m-%d"}</lastmod> <changefreq>monthly</changefreq> <priority>0.5</priority> </url> </urlset> XSL <xsl:template match="/"> <html> <body> <h2>Sitemap</h2> <table border="1"> <tr bgcolor="#9acd32"> <th

unable to locate Spring NamespaceHandler error

≯℡__Kan透↙ 提交于 2019-12-04 00:25:56
I have been having this error for nearly a week now and im just about ready to give in. I have used Maven2 to make the BIG jar file. When I run the jar file using: java -jar someJar.jar I get this error: ERROR: [27/55/13 10:55] Launcher: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context] Offending resource: class path resource [JavaProjectApplicationContext.xml] JavaProjectApplicationContext.xml is as follows: <?xml version="1.0"

How do I get an IXmlNamespaceResolver

爷,独闯天下 提交于 2019-12-04 00:06:29
问题 I'm trying to call the XElement.XPathSelectElements() overload that requires an IXmlNamespaceResolver object. Can anyone show me how to get (or make) an IXmlNamespaceResolver? I have a list of the namespaces I want to use in my query 回答1: You can use an XmlNamespaceManager that implements that interface Use the constructor which takes an XmlNameTable , passing into it an instance of System.Xml.NameTable via new NameTable() . You can then call AddNamespace function to add namespaces: var nsMgr

Python: Ignore xmlns in elementtree.ElementTree

怎甘沉沦 提交于 2019-12-03 23:21:34
Is there a way to ignore the XML namespace in tage names in elementtree.ElementTree ? I try to print all technicalContact tags: for item in root.getiterator(tag='{http://www.example.com}technicalContact'): print item.tag, item.text And I get something like: {http://www.example.com}technicalContact blah@example.com But what I really want is: technicalContact blah@example.com Is there a way to display only the suffix (sans xmlns), or better - iterate over the elements without explicitly stating xmlns? You can define a generator to recursively search through your element tree in order to find

XHTML namespace issues with cssselect in lxml

落爺英雄遲暮 提交于 2019-12-03 22:17:03
I have problems using cssselect with a XHTML (or XML with namespace). Although the documentation says how to use namespace in csselect I do not understand it: cssselect namespaces My Input XHTML string: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Teststylesheet</title> <style type="text/css"> /*<![CDATA[*/ ol{margin:0;padding:0} /*]]>*/ </style> </head> <body> </body> </html> My Python Script: parser = etree.XMLParser() tree = etree.fromstring(xhtmlstring, parser)