Meta
Tag Cloud
Category Archives: XML
Writing Xml without the XmlDeclaration
Consider the following xml file: <?xml version="1.0" encoding="utf-8" ?> <!– some comment –> <root> </root> <!– another comment –> If you look at the Well-Formed XML Documents section in the XML specification you see that a well-formed document is defined … Continue reading
Posted in C#, XML
Leave a comment
Generating UTF-8 with System.Xml.XmlWriter
Today i decided to experiment with XmlWriter. The first i wanted to do was set the Encoding to UTF-8.: StringBuilder stringBuilder = new StringBuilder(); XmlWriter xmlWriter = XmlWriter.Create(stringBuilder); xmlWriter.Settings.Encoding = Encoding.UTF8; When i ran this code i recieved the following … Continue reading
Posted in C#, XML
13 Comments
Accept posted XML data
I remember that i’ve spent a lot of time finding something that allowed me to accept the posted XML data. The solution was very simple: $data = file_get_contents(‘php://input’);
Posted in PHP, XML
Leave a comment
value-of in an attribute
There were days that i didn’t like XSL because it seemed to be impossible to insert a value inside an attribute. For example: <form action="<xsl:value-of select="/page/action"/>" method="post"> Today i’ve seen that other people also struggle with this issue. So here … Continue reading
Posted in XML
Leave a comment
Playing with XML and XSL
// add stuff to an xml document in php4 $doc = domxml_open_mem($xml); $root = $doc->document_element(); $inner = $doc->create_element(‘inner’); $root = $root->append_child($inner); // add stuff to an xml document in php5 $doc = new DomDocument(’1.0′, ‘UTF-8′); $doc->loadXML($xml); $root = $doc->getelementsByTagName(‘resultset’)->item(0); $inner … Continue reading
Posted in PHP, XML
Leave a comment
XSLT annoyances
Today i’ve finally made the switch. My code generates XML and then i translate it to XHTML with XSLT. However, if i write <textarea name="foo"></textarea> it will be translated to: <textarea name="foo"/>. A not so good workaround is to write: … Continue reading
Posted in XML
Leave a comment
Parsing XML
Today i wrote a little program, VolumeMeter which is usefull for Scarlet customers. It queries mijn.scarlet.be and returns how many megabytes they have used this month.
Posted in C#, XML
Leave a comment