xml-namespaces

XSL - How to remove unused namespaces from source xml?

梦想与她 提交于 2019-11-29 03:22:02
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" encoding="UTF-8"?> <ns1:Envelope xmlns:ns1="http://www.a.com" xmlns:ns2="http://www.b.com"> <ns1:Body> <ns2:a

xaml what is “local:”?

对着背影说爱祢 提交于 2019-11-29 03:04:18
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? 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. Filip 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, converters etc from the AskLocal namespace directly in your xaml by using <local:nameofyourcontrol></local

Using XSDs with includes

痴心易碎 提交于 2019-11-29 02:52:10
问题 Here is an XSD: <?xml version="1.0"?> <xsd:schema elementFormDefault='unqualified' attributeFormDefault='unqualified' xmlns:xsd='http://www.w3.org/2001/XMLSchema' > <xsd:simpleType name='TheSimpleType'> <xsd:restriction base='xsd:string' /> </xsd:simpleType> </xsd:schema> Here is a second XSD that includes the one above: <?xml version="1.0" encoding="UTF-8" ?> <xsd:schema elementFormDefault='unqualified' attributeFormDefault='unqualified' xmlns:xsd='http://www.w3.org/2001/XMLSchema'

Adding namespace using Nokogiri's XML Builder

放肆的年华 提交于 2019-11-29 00:28:46
I have been wrecking my head for a few hours but I can't seem to determine how to add XMLNS namespace whilst using the Nokogiri XML Builder class to construct a XML structure. For instance, consider the XML sample below: I can create everything between the GetQuote tags but creating the "p:ACMRequest" remains a mystery. I came across this reference, https://gist.github.com/428455/7a15f84cc08c05b73fcec2af49947d458ae3b96a , that still doesn't make sense to me. Even referring to the XML documentation,http://www.w3.org/TR/xml-names/, didn't make much sense either. <?xml version="1.0" encoding="UTF

Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function

允我心安 提交于 2019-11-28 22:19:27
I am trying to call SelectNode from XmlDocument class and trouble due to this error: Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function. My code: public void Add(ref XmlDocument xmlFormat, String strName) { XmlDocument dom; XSLTemplate xsl = null; String strPath = ""; XmlNodeList nl; XmlAttribute na; int n; nl = (XmlNodeList)xmlFormat.SelectNodes("//xsl:import/@href",nsm); } and xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="stylesheets/r_adresetiket.xsl" /> <xsl:template match="/"> <xsl

XPath doesn't work as desired in C#

无人久伴 提交于 2019-11-28 21:37:48
My code doesn't return the node XmlDocument xml = new XmlDocument(); xml.InnerXml = text; XmlNode node_ = xml.SelectSingleNode(node); return node_.InnerText; // node_ = null ! I'm pretty sure my XML and Xpath are correct. My Xpath : /ItemLookupResponse/OperationRequest/RequestId My XML : <?xml version="1.0"?> <ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05"> <OperationRequest> <RequestId>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx</RequestId> <!-- the rest of the xml is irrelevant --> </OperationRequest> </ItemLookupResponse> The node my XPath returns is

Why doesn't Nokogiri xpath like xmlns declarations

徘徊边缘 提交于 2019-11-28 20:23:56
I'm using Nokogiri::XML to parse responses from Amazon SimpleDB. The response is something like: <SelectResponse xmlns="http://sdb.amazonaws.com/doc/2007-11-07/"> <SelectResult> <Item> <Attribute><Name>Foo</Name><Value>42</Value></Attribute> <Attribute><Name>Bar</Name><Value>XYZ</Value></Attribute> </Item> </SelectResult> </SelectResponse> If I just hand the response straight over to Nokogiri, all XPath queries (e.g. doc/"//Item/Attribute[Name='Foo']/Value" ) return an empty array. But if I remove the xmlns attribute from the SelectResponse tag, it works perfectly. Is there some extra thing I

AngularJS ng-href and svg xlink

纵然是瞬间 提交于 2019-11-28 18:36:20
I'd like some input on using xml namespaced attributes with angular. The problem is angular comes with a couple of directives to handle writing attributes such as href and src when angular has parsed the expresssions (otherwise the browser will try to load {{mymodel.myimage}} as a url) https://github.com/angular/angular.js/blob/master/src/ng/directive/booleanAttrs.js#L329 The problem I'm facing is that I'm using angular to output svg together with D3 and since angular doesn't have a way to output xlink:href I was stuck. I created a custom directive that outputs xlink:href app.directive(

How do I use XPath with a default namespace with no prefix?

风格不统一 提交于 2019-11-28 18:12:58
What is the XPath (in C# API to XDocument.XPathSelectElements(xpath, nsman) if it matters) to query all MyNodes from this document? <?xml version="1.0" encoding="utf-8"?> <configuration> <MyNode xmlns="lcmp" attr="true"> <subnode /> </MyNode> </configuration> I tried /configuration/MyNode which is wrong because it ignores the namespace. I tried /configuration/lcmp:MyNode which is wrong because lcmp is the URI, not the prefix. I tried /configuration/{lcmp}MyNode which failed because Additional information: '/configuration/{lcmp}MyNode' has an invalid token. EDIT: I can't use mgr.AddNamespace(

JSTL xmlns namespace differences between JSF 1.2 and JSF 2.x?

一世执手 提交于 2019-11-28 16:53:59
I have a JSF 1.2 based webapp from which I copied the JSTL import xmlns:c="http://java.sun.com/jstl/core" You can also find this import in many places on the Internet. I can't remember whether the above worked in my former web project or not, in any case, it does not work in my current JSF 2.0 based webapp. I got a warning from the container saying: Warning: This page calls for XML namespace http://java.sun.com/jstl/core declared with prefix c but no taglibrary exists for that namespace. I then changed the import to xmlns:c="http://java.sun.com/jsp/jstl/core" ... which removed all headaches