xml-namespaces

Default namespace & complex package/data structure

你说的曾经没有我的故事 提交于 2019-12-10 19:54:23
问题 I need create/read xml file using default namespace: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xmlBoo xmlns="http://www.example2.org/boo"> <customer> <address> <street>Wall Street</street> </address> <id>1</id> <name>John</name> </customer> <someSpecificField>Specific data in Boo</ns2:someSpecificField> </xmlBoo> but I'm getting: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:xmlBoo xmlns:ns2="http://www.example2.org/boo"> <ns2:customer> <address> <street>Wall

changing element namespace in lxml

浪子不回头ぞ 提交于 2019-12-10 19:48:59
问题 With lxml , I am not sure how to properly remove the namespace of an existing element and set a new one. For instance, I'm parsing this minimal xml file: <myroot xmlns="http://myxml.com/somevalue"> <child1>blabla</child1> <child2>blablabla</child2> </myroot> ... and I'd like it to become: <myroot xmlns="http://myxml.com/newvalue"> <child1>blabla/child1> <child2>blablabla</child2> </myroot> With lxml : from lxml import etree as ET tree = ET.parse('myfile.xml') root= tree.getroot() If I inspect

How to use svg namespace in xhtml documents

人盡茶涼 提交于 2019-12-10 19:42:35
问题 Can someone tell me why this document does not draw a circle on Chrome? <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head></head> <body> <svg:svg width="100" height="100"> <svg:circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /> </svg:svg> </body> </html> 回答1: HTML prior to HTML5 does not support <svg> element. Like all HTML, HTML5 is not namespace aware and therefore it does not understand namespace prefixes. For a HTML parser

XSLT: How get rid of default namespace's prefixes in XPath? (xmlns=“…”)

此生再无相见时 提交于 2019-12-10 19:04:36
问题 I have a template: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:jboss:domain:1.1" xmlns:d="urn:jboss:domain:1.1" > ... <xsl:template match="//d:interfaces/d:interface[@name='management']/d:inet-address"> ... </xsl:template> This works. <xsl:template match="//interfaces/interface[@name='management']/inet-address"> ... </xsl:template> Why this doesn't work despite I have a default namespace set? 回答1: <xsl:template match="//interfaces/interface[@name=

XML XSD namespace issues

南笙酒味 提交于 2019-12-10 19:00:12
问题 I am trying to define a simple XML and XSD file using the example of bank accounts. Here is my XSD defining my XML file: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:bank="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.auto-owners.com/accounts" > <xs:element name="accounts" > <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" ref="account"/> </xs:sequence> </xs:complexType> </xs

namespace error : Namespace prefix bd on keyword is not defined

岁酱吖の 提交于 2019-12-10 17:49:37
问题 I have a huge xml file that I would like to split up into individual xml documents; each individual xml file is supposed to have an explicit namespace declaration where applicable as show in the "Desired Output" portion below. However, I keep getting the error "namespace error : Namespace prefix bd on keyword is not defined" My question is, how can I explicitly tell my XSLT processor where to put namespace declaration in resulting output? I have gone through a couple of tutorials online, but

Are CSS3 namespaces used for anything except XML?

主宰稳场 提交于 2019-12-10 17:18:27
问题 We have a client that would like us to use CSS3 namespaces. However, everything I'm finding indicates that it is specifically used for styling XML and not HTML. Can anyone validate using it for CSS/HTML or clarify how you would do this? What are the negatives of following this method? @namespace toto "http://toto.example.org"; toto|Product { display:block; } toto|Code { color: black } http://www.w3.org/TR/css3-namespace/ http://onwebdev.blogspot.com/2010/04/css3-namespace-selectors.html 回答1:

Setting Namespace Attributes on an Element

ぃ、小莉子 提交于 2019-12-10 16:59:18
问题 I'm trying to create an XML document in Java that contains the following Element: <project xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:acme="http://www.acme.com/schemas" color="blue"> I know how to create the project Node. I also know how to set the color attribute using element.setAttribute("color", "blue") Do I set the xmlns and xmlns:acme attributes the same way using setAttribute() or do I do it in some special way since they are namespace attributes? 回答1: I believe that you

Java DOM XML is skipping xmlns properties

随声附和 提交于 2019-12-10 16:36:47
问题 I need to generate an xml file in Java, so I chose to use DOM (until there everything is ok), here is the root tag of what i need to create <?xml version="1.0" encoding="utf-8"?> <KeyContainer Version="1.0" xmlns="urn:ietf:params:xml:ns:keyprov:pskc:1.0" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:xml="http://www.w3.org/XML/1998/namespace"> Here is my source code PrintWriter out = new PrintWriter(path); Document xmldoc = null;

Applying xpath on xml with default namespace with XOM

元气小坏坏 提交于 2019-12-10 15:27:27
问题 I have below XML which contains a default namespace <?xml version="1.0"?> <catalog xmlns="http://www.edankert.com/examples/"> <cd> <artist>Stoat</artist> <title>Future come and get me</title> </cd> <cd> <artist>Sufjan Stevens</artist> <title>Illinois</title> </cd> <cd> <artist>The White Stripes</artist> <title>Get behind me satan</title> </cd> </catalog> And Im running following code expecting some result in return Element rootElem = new Builder().build(xml).getRootElement(); xc =