Skip to content

Instantly share code, notes, and snippets.

@nico
Last active February 12, 2018 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nico/0ca75f5e0afd898ef78ef8d078ead7bb to your computer and use it in GitHub Desktop.
Save nico/0ca75f5e0afd898ef78ef8d078ead7bb to your computer and use it in GitHub Desktop.
C:\src\hack>type xmltest_in.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="common.css"?>
<hi>
<hi xmlns="http://example.com/foo-ns" xmlns:x="urn:example-com:bar-ns">
<?foobar version="1.0"?>
<ho
/>text&amp;more@<x:ho x:attr="adsf"/>
<!-- adsf -->
</hi>
<![CDATA[my cdata]]>
<ho/>
</hi>
C:\src\hack>xmltest xmltest_in.xml
9/document #document (null) (null)
7/processinginstruction xml version="1.0" encoding="utf-8" (null)
2/attribute version 1.0 (null)
3/text #text 1.0 (null)
2/attribute encoding utf-8 (null)
3/text #text utf-8 (null)
7/processinginstruction xml-stylesheet href="common.css" (null)
1/element hi (null) (null)
1/element hi (null) http://example.com/foo-ns
2/attribute xmlns http://example.com/foo-ns http://www.w3.org/2000/xmlns/
3/text #text http://example.com/foo-ns (null)
2/attribute xmlns:x urn:example-com:bar-ns http://www.w3.org/2000/xmlns/
3/text #text urn:example-com:bar-ns (null)
7/processinginstruction foobar version="1.0" (null)
1/element ho (null) http://example.com/foo-ns
3/text #text text&more@ (null)
1/element x:ho (null) urn:example-com:bar-ns
2/attribute x:attr adsf urn:example-com:bar-ns
3/text #text adsf (null)
8/comment #comment adsf (null)
4/cdatasection #cdata-section my cdata (null)
1/element ho (null) (null)
thakis@thakis:~/src/hack$ ./xmltest xmltest_in.xml
9/XML_DOCUMENT_NODE (null) (null)
7/XML_PI_NODE xml-stylesheet href="common.css"
1/XML_ELEMENT_NODE hi (null)
3/XML_TEXT_NODE text
1/XML_ELEMENT_NODE hi (null) ((null):http://example.com/foo-ns XML_NAMESPACE_DECL) (x:urn:example-com:bar-ns XML_NAMESPACE_DECL)
def ns: ((null):http://example.com/foo-ns XML_NAMESPACE_DECL) (x:urn:example-com:bar-ns XML_NAMESPACE_DECL)
3/XML_TEXT_NODE text
7/XML_PI_NODE foobar version="1.0"
3/XML_TEXT_NODE text
1/XML_ELEMENT_NODE ho (null) ((null):http://example.com/foo-ns XML_NAMESPACE_DECL) (x:urn:example-com:bar-ns XML_NAMESPACE_DECL)
3/XML_TEXT_NODE text text&more@
1/XML_ELEMENT_NODE ho (null) (x:urn:example-com:bar-ns XML_NAMESPACE_DECL)
2/XML_ATTRIBUTE_NODE attr (null) (x:urn:example-com:bar-ns XML_NAMESPACE_DECL)
3/XML_TEXT_NODE text adsf
3/XML_TEXT_NODE text
8/XML_COMMENT_NODE comment adsf
3/XML_TEXT_NODE text
3/XML_TEXT_NODE text
4/XML_CDATA_SECTION_NODE (null) my cdata
3/XML_TEXT_NODE text
1/XML_ELEMENT_NODE ho (null)
3/XML_TEXT_NODE text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment