How-to articles, tricks, and solutions about XML

"Content is not allowed in prolog" when parsing perfectly valid XML on GAE

The "Content is not allowed in prolog" error typically occurs when you try to parse an XML document that contains characters before the XML prolog (the <?xml ...?> declaration).

How check if a String is a Valid XML with-out Displaying a Warning in PHP

In PHP, you can use the simplexml_load_string function to check if a string is a valid XML without displaying a warning.

How do I capture PHP output into a variable?

In PHP, you can use the output control functions to capture the output of a PHP script into a variable.

How do I see the actual XML generated by PHP SOAP Client Class?

To see the actual XML generated by the PHP SOAP Client class, you can use the __getLastRequest() method.

How to parse XML and get instances of a particular node attribute?

You can use the xml library in Python to parse XML and get instances of a particular node attribute.

How to Parse XML with PHP

XML (Extensible Markup Language) is used to store and transport data. Learn how to accurately parse XML with PHP simpleXML library in this simple snippet.

How to pretty print XML from Java?

To pretty print XML from Java, you can use the javax.xml.transform.Transformer class from the Java XML Transformer API.

How to read XML using XPath in Java

To read XML using XPath in Java, you can use the javax.xml.xpath package.

How to Strip HTML from a String in JavaScript

In this tutorial, you will find several approaches to strippingan HTML from a sting in JavaScript easily. Get the codes and explanations right away.

java.util.Date to XMLGregorianCalendar

To convert a java.util.Date object to an XMLGregorianCalendar in Java, you can use the toGregorianCalendar method of the DatatypeFactory class.

org.xml.sax.SAXParseException: Content is not allowed in prolog

The error org.xml.sax.SAXParseException: Content is not allowed in prolog usually indicates that there is some content before the XML prolog in the file you are trying to parse.

PHP: How to handle <![CDATA[ with SimpleXMLElement?

You can use the addCData() method of the SimpleXMLElement class to add a CDATA section to an XML element.

Remove a child with a specific attribute, in SimpleXML for PHP

You can remove a child element with a specific attribute in SimpleXML for PHP using the xpath() function.

SimpleXml to string

To convert a SimpleXml object to a string in PHP, you can use the asXML() function.

XML Parse Error - Extra content at the end of the document

This error message typically occurs when there is additional content or characters after the closing root element in an XML document.