xml

How to display XML RSS feed by PHP

佐手、 提交于 2021-02-17 05:52:29
问题 I have an assignment to display my XML RSS via PHP on a website, so far I have tried multiple things and all have failed. And I was unable to find the answer since most people do RSS feed by PHP from MySQL database to get a live feed of posts. XML RSS <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <title>Treehouse front page</title> <link>https://teamtreehouse.com/</link> <description>Programming Tutorials</description> <item> <title>Code Academy</title> <link>https:/

XSLT 1.0 Kludge cleanup

℡╲_俬逩灬. 提交于 2021-02-17 05:46:33
问题 I am printing a line in reverse font (black background, white text), spread over the width of my receipt tape (41 characters). I have functional code, but I am wondering if there is a better way to do this: Here's my existing code: <text lang="en" align="center" smooth="true" reverse="1"><xsl:value-of select="substring($spaces21, 1, (string-length($spaces21) - ((string-length(SavingsSegment) div 2) + string-length(SavingsSegment) mod 2)))"/> <xsl:value-of select="SavingsSegment"/><xsl:value

XSLT 1.0 Kludge cleanup

一个人想着一个人 提交于 2021-02-17 05:46:31
问题 I am printing a line in reverse font (black background, white text), spread over the width of my receipt tape (41 characters). I have functional code, but I am wondering if there is a better way to do this: Here's my existing code: <text lang="en" align="center" smooth="true" reverse="1"><xsl:value-of select="substring($spaces21, 1, (string-length($spaces21) - ((string-length(SavingsSegment) div 2) + string-length(SavingsSegment) mod 2)))"/> <xsl:value-of select="SavingsSegment"/><xsl:value

XSLT remove elements that do not match regex

南楼画角 提交于 2021-02-17 04:44:41
问题 I want a simple XSLT which will only keep the elements which contain a certain regex: <example> <abc>text</abc> <bc>text</bc> <ab>text</ab> </example> I want the same XML output but only with the elements which contain an "a": <example> <abc>text</abc> <ab>text</ab> </example> 回答1: Start with the identity transform and add a template that suppresses elements whose name does not match your regex: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org

LibXML doesn't find any nodes for my xpath expression

你离开我真会死。 提交于 2021-02-17 04:41:51
问题 I'm using xpath and LibXML in an iPhone app to find some nodes in an xml document. I'm a noob in xpath so probably i am doing something wrong. Here is the xml: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetUserByEmailResponse xmlns="http://tempuri.org/"> <GetUserByEmailResult> <id>4006</id> <name>Kudor Gyozo</name>

LibXML doesn't find any nodes for my xpath expression

寵の児 提交于 2021-02-17 04:40:22
问题 I'm using xpath and LibXML in an iPhone app to find some nodes in an xml document. I'm a noob in xpath so probably i am doing something wrong. Here is the xml: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetUserByEmailResponse xmlns="http://tempuri.org/"> <GetUserByEmailResult> <id>4006</id> <name>Kudor Gyozo</name>

lxml include relative path

[亡魂溺海] 提交于 2021-02-17 02:07:32
问题 Using Python's lxml library, I'm trying to load a .xsd as schema. The Python script is in one directory and the schemas are in another: /root my_script.py /data /xsd schema_1.xsd schema_2.xsd The problem is that schema_1.xsd includes schema_2.xsd like this: <xsd:include schemaLocation="schema_2.xsd"/> Being schema_2.xsd a relative path (the two schemas are in the same directory), lxml doesn't find it and it rises and error: schema_root = etree.fromstring(open('data/xsd/schema_1.xsd').read()

lxml include relative path

我的未来我决定 提交于 2021-02-17 02:04:44
问题 Using Python's lxml library, I'm trying to load a .xsd as schema. The Python script is in one directory and the schemas are in another: /root my_script.py /data /xsd schema_1.xsd schema_2.xsd The problem is that schema_1.xsd includes schema_2.xsd like this: <xsd:include schemaLocation="schema_2.xsd"/> Being schema_2.xsd a relative path (the two schemas are in the same directory), lxml doesn't find it and it rises and error: schema_root = etree.fromstring(open('data/xsd/schema_1.xsd').read()

lxml include relative path

妖精的绣舞 提交于 2021-02-17 02:04:28
问题 Using Python's lxml library, I'm trying to load a .xsd as schema. The Python script is in one directory and the schemas are in another: /root my_script.py /data /xsd schema_1.xsd schema_2.xsd The problem is that schema_1.xsd includes schema_2.xsd like this: <xsd:include schemaLocation="schema_2.xsd"/> Being schema_2.xsd a relative path (the two schemas are in the same directory), lxml doesn't find it and it rises and error: schema_root = etree.fromstring(open('data/xsd/schema_1.xsd').read()

Why XPath.evaluate is returning NULL?

孤街浪徒 提交于 2021-02-16 19:26:54
问题 When I use below code to modify an xml file I receive this error : Exception in thread "main" java.lang.NullPointerException at ModifyXMLFile.updateFile(ModifyXMLFile.java:44) at ModifyXMLFile.main(ModifyXMLFile.java:56) The error occurs at line : node.setTextContent(newValue); Am I not using xpath correctly ? Here is the code and the xml file I'm attempting to update import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import