xml-namespaces

Python xpath not working?

家住魔仙堡 提交于 2019-12-20 05:39:06
问题 Okay, this is starting to drive me a little bit nuts. I've tried several xml/xpath libraries for Python, and can't figure out a simple way to get a stinkin' "title" element. The latest attempt looks like this (using Amara): def view(req, url): req.content_type = 'text/plain' doc = amara.parse(urlopen(url)) for node in doc.xml_xpath('//title'): req.write(str(node)+'\n') But that prints out nothing. My XML looks like this: http://programanddesign.com/feed/atom/ If I try //* instead of //title

Python xpath not working?

天大地大妈咪最大 提交于 2019-12-20 05:39:02
问题 Okay, this is starting to drive me a little bit nuts. I've tried several xml/xpath libraries for Python, and can't figure out a simple way to get a stinkin' "title" element. The latest attempt looks like this (using Amara): def view(req, url): req.content_type = 'text/plain' doc = amara.parse(urlopen(url)) for node in doc.xml_xpath('//title'): req.write(str(node)+'\n') But that prints out nothing. My XML looks like this: http://programanddesign.com/feed/atom/ If I try //* instead of //title

How to declare element

一笑奈何 提交于 2019-12-20 05:26:36
问题 I'm looking for validate an XML document with xrm prefix as you can read here : I wrote the following XML Schema : </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> However, when I check my XML document, I get the following error: 'xrm:plugin' is not a valid value for 'NCName' I understand I can't put xrm: in my name, but how can I validate my xrm:plugin and xrm:header ? Because, if I try to validate my XML document, I get this error: Cannot find the declaration of

How to reuse elements from another Schema / Namespace (i.e. XHTML) with XML Schema?

可紊 提交于 2019-12-20 05:10:30
问题 I'm trying to define a Schema which allows the use of specific (X)HTML elements in certain places. The problem that I'm facing is that the Schema fails compiling. Here's the Schema: <?xml version="1.0"?> <xs:schema xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/MarkUp/Schema/xhtml11.xsd" /> <xs:element name="foo"> <xs:complexType> <xs:sequence> <xs:element ref="html

trouble getting declared namespaces to work

♀尐吖头ヾ 提交于 2019-12-20 04:48:18
问题 I am trying to get namespaces written in an external css (two separate files actually). When I run the file on my browser it will not use the declared namespaces. I think that the file is calling the css file but its not applying the namespaced style HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?xml version="1.0" encoding="utf-8"?> <html xmlns:act="http://www.superstarmovies.com/actors" xmlns:mov="http://www

why would an inline XMLNS change the entire tag structure? JSF

不打扰是莪最后的温柔 提交于 2019-12-20 04:11:21
问题 My apologies in advance, i don't do a lot of front end development. But in short xmlns attributes are removing tags and moving them around in the rendered document. This is probably a JSF issue as it even happens in view source. This svg tag works and does not alter the structure: <svg id="Layer_1" x="0px" y="0px" width="150px" height="150px" viewBox="0 0 150 150" enable-background="new 0 0 150 150"> But as soon as an xml namespace is declared, all the code on the page is altered. It moves my

Parsing XML with Namespaces C#

荒凉一梦 提交于 2019-12-20 03:36:10
问题 I have been working on parsing this XML data all day. It seems like my problem is namespaces. I thought a had a glimmer of hope with my last website http://www.codeproject.com/Articles/30965/Read-XML-with-Namespace-resolution-using-XLinq-XEl but it failed as well. Each time I run the code below I get "Object reference not set to an instance of an object." There seems to be many ways of parsing XML with C# but these namespaces are killing me. What am I doing wrong? Do keep in mind I am new to

How to add namespace to xml using linq xml

陌路散爱 提交于 2019-12-20 02:42:42
问题 Question update: im very sorry if my question is not clear here is the code im using right now XDocument doc = XDocument.Parse(framedoc.ToString()); foreach (var node in doc.Descendants("document").ToList()) { XNamespace ns = "xsi"; node.SetAttributeValue(ns + "schema", ""); node.Name = "alto"; } and here is the output <alto p1:schema="" xmlns:p1="xsi"> my goal is like this xsi:schemaLocation="" where does the p1 and xmlns:p1="xsi" came from? 回答1: When you write XNamespace ns = "xsi"; That's

python lxml findall with multiple namespaces

偶尔善良 提交于 2019-12-20 02:37:08
问题 I'm trying to parse an XML document with multiple namespaces with lxml, and I'm stuck on getting the findall() method to return something. My XML: <MeasurementRecords xmlns="http://www.company.com/common/rsp/2012/07" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.company.com/common/rsp/2012/07 RSP_EWS_V1.6.xsd"> <HistoryRecords> <ValueItemId>100_0000100004_3788_Resource-0.customId_WSx Data Precip Type</ValueItemId> <List> <HistoryRecord> <Value>60</Value>

Remove xsi:type, xmlns:xs, and xmlns:xsi from JAXB Generics

末鹿安然 提交于 2019-12-19 19:52:36
问题 When using JAXB, I'd like to remove the excess namespaces/types from my XML elements when using Generics. How can I do this or what am I doing wrong? I'd like to use Generics so that I only have to write a block of code once. Example code: public static void main(String[] args) { try { TestRoot root = new TestRoot(); root.name.value = "bobby"; root.age.value = 102; root.color.value = "blue"; JAXBContext context = JAXBContext.newInstance(root.getClass()); Marshaller marsh = context