What is the best way to format XML within a PHP class.
$xml = "<element attribute=\"something\">...</element>";
$xml = '<element attribute="something">...</element>';
$xml = '<element attribute=\'something\'>...</element>';
$xml = <<<EOF
<element attribute="something">
</element>
EOF;
I'm pretty sure it is the last one!
...
The ActiveForums module we're using as part of our DotNetNuke system has a bug in the XML for it's RSS feed. It doesn't correctly encode ampersands, it leaves them as & rather than encoding them as &
I've reported the bug to the company, but in the mean time I need a fix. So what I've done is create an intermediary page that makes a...
Hello,
I'm trying to find the first attribute in an xml file that contains the string "name" (case insensitve) in it and then change its value.
Here is an example of my xmls
//XML 1
<CtApproachTypes
DataclassId="1992A9CE-B048-4676-BFD4-FD81F1A65401"
EntityId="1992A9CE-B048-4676-BFD4-FD81F1A65401"
Name="PAR"
Remark="No Rema...
These is my xml:
<root>
<node>
<element id='1'>
<subelement>val</subelement>
</element>
<element id='2'>
<subelement>val</subelement>
</element>
</node>
i don't know the parent name and 'node' name
The solution
descendant::*[ @id= '1' ]/subelement
...
I thought BeautifulSoup could do that, but it does not seem to do the trick.
What method have you already used, and is long term reliable ?
...
Hi,
I'm dealing with large XML files (several megabytes) for which I have to make various kind of checks. However I have problem with memory and time usage which grows very quickly. I've tested it like this:
$xml = new SimpleXMLElement($string);
$sum_of_elements = (double)0.0;
foreach ( $xml->xpath('//Amt') as $amt ) {
$sum_of_eleme...
Hi, I want to set id of an element. I'm using php dom. I could not understand how following will work.
DOMElement::setIdAttribute ( string $name , bool $isId )
The only description I found for this in manual is -
Declares the attribute name to be of type ID.
How can I do this ?
...
The idea seems to be very similar by keeping actual content separate from the final output rendering so that changing the template or styling is trivial.
...
I'm trying to create a simple XML parser where each different XML schema has it's own parser class but I can't figure out what the best way is. What I in effect would like to do is something like this:
in = sys.stdin
xmldoc = minidom.parse(in).documentElement
xmlParser = xmldoc.nodeName
parser = xmlParser()
out = parser.parse(xmldoc)
...
I am developing a schema using RELAX NG. I'm pretty new to this, so it is quite possible that I am overlooking something obvious, but there doesn't seem to be a convenient way to specify the number of occurrences of an element like you can in the XML Schema language.
For example, suppose I wanted to specify that an A element may contain...
Hi,
I am running a client using some of the axis2 jars. I used the wsdl2java tool to generate the client java clases to comunicate with the service and so on and this worked perfectly.
I specified all the required jars in the classpath. However everytime the application is run... it seems to be copying the jars into a temp directory......
Hi
I'm trying to figure out serialization of .net arrays to XML. Here's a piece of code that I've come up with:
public class Program
{
public class Person
{
public string Firstname { get; set; }
public string Lastname { get; set; }
public uint Age { get; set; }
}
...
I am not a programmer, so this may or may not make sense, but I would like to be able to link an external data file to an XSD file to specify whether a user belongs to a certain group.
Without linking, the code currently stands as:
<xs:element name="user">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumer...
Hello, we have a client who wants us to store xml table dumps from their database in an xml file (the xml file will contain potentially any combination of text or binary files (binary being base64 encoded) and xml database dumps).
To achieve this, we obviously need to encode the xml special characters inside the database dumps. The clie...
All,
I'm working on a Flash AS2 project in which I have a choice of receiving a dataset in either XML or JSON.
The dataset is probably about 100-1,000 rows of data; each row has roughly 50 fields; most values are numeric.
If I use XML, I'll be able to define the XML myself, to make sure it's as compact as possible.
So, I could use so...
I'm using XSLT templates to generate word documents in XML format.
The problem I'm having is with whitespaces (specifically - tabs).
This is an example of a tab inside a paragraph in xml doc:
<w:p>
<w:r xml:space="preserve">
<w:tab />
<w:t>This is some text after tab</w:t>
</w:r>
</w:p>
I added xml:space="preserve" to save the white...
<links>
<osname name="windows xp" links="xyz" />
<osname name="windows 2k" links="xyz" />
</links>
<owners name="microsoft">
<os name="windows xp" />
<os name="windows 2k" />
<os name="windows 2003" />
<os name="windows 7" />
</owners>
<owners name="microsoft">
<os name="windows xp" />
<os name="windows 95...
Is there a way to use the value from the form into XML nodes? Once they submit this form I want the values from the form fields to overwrite the existing nodes.
<html>
<head></head>
<body>
<form id="myForm" method="POST">
<input type="text" value="new XML node value here" />
<input type="submit" onClick="function();"/>
</form>
<...
I am trying to use the BCP command to execute the following statement, but I keep getting the following error:
Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in
BCP data-file
0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1
...
Hello all
I have the following xml:
<listaGiros>
<giro>
<idGiro type="int">89</idGiro>
<nombreGiro type="varchar">foo</nombreGiro>
</giro>
<giro>
<idGiro type="int">78</idGiro>
<nombreGiro type="varchar">apple</nombreGiro>
</giro>
<giro>
<idGiro type="int">10</idGiro>
...