xml-namespaces

How do I select nodes that use a default namespace?

谁说我不能喝 提交于 2019-11-26 23:44:16
问题 The structure of the XML file is more or less as follows: <?xml version="1.0" encoding="UTF-8"?> <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="url1" xsi:schemaLocation="url2 url3"> <b> <c></c> <c></c> <c></c> </b> </a> My goal is to select all the "c" elements, but the following xpath expression won't work: "//a/b/c". ie: XmlDocument doc= new XmlDocument(); doc.Load(filepath); XmlNodeList l = doc.SelectNodes("//a/b/c"); // 0 nodes The only xpath expressions I tested that

XSLT works in IE, not in Chrome or Firefox

前提是你 提交于 2019-11-26 23:37:31
问题 Given a normal nhibernate config file: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="http://localhost/xmlStylesheets/nhibernate.xsl"?> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property> <property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>

XML Namespace URI with HTTPS?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 23:19:12
问题 Is it better to have a xmlns URI with https protocol? For example this is the recommended way by the manual: <http xmlns="http://www.springframework.org/schema/security"/> Is it legal and better to use this way? <http xmlns="https://www.springframework.org/schema/security"/> Are there XML parsers that try to connect to an address defined by xmlns URI? Parsers always download schemas by xsi:schemaLocation attribute? 回答1: The URI is the namespace name , which identifies the namespace. While, in

Why are URLs in XML namespaces?

别来无恙 提交于 2019-11-26 22:47:39
Take this line as just one example: <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> </configuration> Some brief research has taught me that nothing necessarily has to be hosted at that URL. Therefore, if it's just a reference to a namespace contained in a local assembly, why use URLs instead of regular namespaces like the ones typically used by .NET (System.Data, for example)? It's just a convention. URIs (which is what they are, not really URLs) are a convenient and globally-familiar way of identifying resources. On the other hand, .NET-style identifiers are

XSD with elements from other namespace

雨燕双飞 提交于 2019-11-26 22:46:02
问题 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"> <!-- ... --> <

Facebook Connect Won't Validate

折月煮酒 提交于 2019-11-26 22:07:09
问题 I'm trying to get my Facebook Connect code to validate, but it won't. I think the problem is that their xmlns page isn't loading. I have the code: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en"> But http://www.facebook.com/2008/fbml isn't found. Does anyone have a copy of what it should be? Is there a different URL i should use? 回答1: The XML namespace doesn't need to actually exist, they are just a way to qualify elements and

xpath expression from xml with namespace prefix

[亡魂溺海] 提交于 2019-11-26 22:00:50
问题 I could not get the following xpath expression to work when the xml path namespace prefix set. /bk:BookStore/bk:Books/bk:Book[text()='Time Machine'] XML is: <BookStore xmlns:bk="http://www.bookstore.com/book#"> <bk:Books> <bk:Book id="1">Time Machine></bk:Book> </bk:Books> </bk:BookStore> 回答1: Without more information about the host language (in which you attempt to evaluate XPath expressions) it is not possible to provide an useful recommendation . Generally, one needs to "register" a

unable to scrape content from a website

会有一股神秘感。 提交于 2019-11-26 21:39:30
问题 I am trying to scrap some content from a website but the code below is not working(not showing any output). here is the code $url="some url"; $otherHeaders=""; //here i am using some other headers like content-type,userAgent,etc some curl to get the webpage ... .. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $content=curl_exec($ch);curl_close($ch); $page=new DOMDocument(); $xpath=new DOMXPath($page); $content=getXHTML($content); //this is a tidy function to convert bad html to xhtml $page-

Java: Marshalling Object — Removing extra ns2 annotation in xml

三世轮回 提交于 2019-11-26 21:13:38
问题 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

Remove namespace from XML using PHP

旧时模样 提交于 2019-11-26 20:53:37
问题 I have an XML document that looks like this: <Data xmlns="http://www.domain.com/schema/data" xmlns:dmd="http://www.domain.com/schema/data-metadata" > <Something>...</Something> </Data> I am parsing the information using SimpleXML in PHP. I am dealing with arrays and I seem to be having a problem with the namespace. My question is: How do I remove those namespaces? I read the data from an XML file. Thank you! 回答1: If you're using XPath then it's a limitation with XPath and not PHP look at this