xml-namespaces

XPath doesn't work as desired in C#

孤街浪徒 提交于 2019-11-27 14:01:09
问题 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

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

荒凉一梦 提交于 2019-11-27 12:21:22
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"></restriction> </simpleType> <element name="MyElement" type="tns:MyType"></element> </schema> Your schema is for

What is an xs:NCName type and when should it be used?

自作多情 提交于 2019-11-27 11:44:26
I ran one of my xml files through a schema generator and everything generated was what was expected, with the exception of one node: <xs:element name="office" type="xs:NCName"/> What exactly is xs:NCName ? And why would one use it, rather xs:string ? NCName is non-colonized name e.g. "name". Compared to QName which is qualified name e.g. "ns:name". If your names are not supposed to be qualified by different namespaces, then they are NCNames. xs:string puts no restrictions on your names at all, but xs:NCName basically disallows ":" to appear in the string. @skyl practically provoked me to write

AngularJS ng-href and svg xlink

假装没事ソ 提交于 2019-11-27 11:29:42
问题 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

Open Graph namespace declaration: HTML with XMLNS or head prefix?

余生长醉 提交于 2019-11-27 10:03:27
I have seen conflicting information on how to best implement Open Graph namespaces. Specifically, the Open Graph website uses a few different methods, and the Facebook Open Graph examples use other methods. Open Graph website example (using HTML prefix attribute): <html prefix="og: http://ogp.me/ns#"> Open Graph website source code (using HTML XMLNS attribute): <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#"> Facebook Open Graph documentation (using HEAD prefix attribute): <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"> Facebook Open Graph documentation

Why is my WCF web service presenting this object in a different namespace with different field names?

ⅰ亾dé卋堺 提交于 2019-11-27 09:21:12
The Context: I'm trying to integrate with DocuSign's Connect notification service. I've set up a WCF service with a method called DocuSignConnectUpdate which takes a DocuSignEnvelopeInformation as its only parameter, as specified by DocuSign. This DocuSignEnvelopeInformation object comes from a reference to their API , so that they can pass this object to my web service, and I know exactly what to expect. DocuSign asks for my service address and the namespace, which I have configured on their site. The Problem: The XML that DocuSign sends is what I would expect. The DocuSignEnvelopeInformation

Writing XML attributes and namespace declarations in a specific order

老子叫甜甜 提交于 2019-11-27 08:39:10
问题 I am trying to make an XML file with a root element: <urn:Command complete="true" xmlns:urn="namespaceURI"> So I have an element Command a namespace namespaceURI a prefix urn and finally an attribute string with name complete a value true and no namespace. The code I have made to do this returns: <urn:Command xmlns:urn="namespaceURI" complete="true"> So the problem is I would like the attribute string to be before the namespace definition in the XML file and I can't find a similar problem on

How do I specify XML serialization attributes to support namespace prefixes during deserialization in .NET?

≡放荡痞女 提交于 2019-11-27 08:01:42
I have a following XML: <person xmlns:a="http://example.com" xmlns:b="http://sample.net"> <a:fName>John</a:fName> <a:lName>Wayne</a:lName> <b:age>37</b:age> </person> How do I define XML serialization attributes on a class to support described scenario? You'll need to indicate which namespaces each field requires by using Namespace of XmlElement attribute. This will allow you to associate a field with a particular namespace, but you'll also need to expose a property on your class that returns type XmlNamespaceDeclarations in order to get the prefix association. See documentation and sample

What are the “$ns” and “$is_prefix” parameters about?

主宰稳场 提交于 2019-11-27 07:56:10
问题 The SimpleXMLElement::__construct() method and the related functions simplexml_load_string() and simplexml_load_file() all have an optional pair of parameters related to XML Namepspaces: $ns and $is_prefix . Despite I can see that those are related to XML namespaces I wonder what they are for and how they work. 回答1: According to PHP manual, those two parameters have been added in PHP version 5.2. The official PHP 5 changelog does not note these changes explicitly but the PHP 5.2 update readme

targetNamespace and xmlns without prefix, what is the difference?

无人久伴 提交于 2019-11-27 06:00:42
In an xml schema document, if I have both the targetNamespace and the xmlns without a prefix . <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com/" xmlns="http://example.com/"> What is the exact difference between them? My comprehension is that if you have an xmlns without a prefix, all elements without prefix gets that namespace and...confusingly the same goes for targetNamespace. targetNamespace is an XML Schema "artifact"; its purpose: to indicate what particular XML namespace the schema file describes. xmlns - because the XML Schema is an XML