forked from andreww/fox
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We don't check for error condition (e.g. in previous commit) yet as it's not obvious how to trigger it without first raising an error elsewhere when we build our dom.
- Loading branch information
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh -e | ||
|
||
for t in ${0%.sh}_*.f90 | ||
do | ||
TEST=${t%.f90} | ||
./test.sh $TEST | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
program test_serialize_1 | ||
|
||
use FoX_dom | ||
|
||
implicit none | ||
|
||
type(Node), pointer :: myDoc, root, np, dummy | ||
|
||
! Create a new document and get a pointer to the root element, this gives you the minimum empty dom | ||
myDoc => createDocument(getImplementation(), "http://www.example.com", "root-element", null()) | ||
root => getDocumentElement(myDoc) | ||
|
||
! You can now do DOMish things like create new elements and append them to the document root element | ||
! dummy ends up pointing at the child-element | ||
np => createElementNS(myDoc, "http://www.example.com", "child-element") | ||
dummy => appendChild(root, np) | ||
|
||
! Call serialize to produce the document | ||
call serialize(myDoc, "test.xml") | ||
|
||
! And don't forget to clean up the memory | ||
call destroy(myDoc) | ||
|
||
end program test_serialize_1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0"?> | ||
<root-element xmlns="http://www.example.com"><child-element/></root-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
program test_serialize_2 | ||
|
||
use FoX_dom | ||
|
||
implicit none | ||
|
||
type(Node), pointer :: myDoc, root, np, dummy | ||
type(DOMException) :: ex | ||
|
||
! Create a new document and get a pointer to the root element, this gives you the minimum empty dom | ||
myDoc => createDocument(getImplementation(), "http://www.example.com", "root-element", null()) | ||
root => getDocumentElement(myDoc) | ||
|
||
! You can now do DOMish things like create new elements and append them to the document root element | ||
! dummy ends up pointing at the child-element | ||
np => createElementNS(myDoc, "http://www.example.com", "child-element") | ||
dummy => appendChild(root, np) | ||
|
||
! Call serialize to produce the document | ||
call serialize(myDoc, "test.xml", ex) | ||
|
||
! And don't forget to clean up the memory | ||
call destroy(myDoc) | ||
|
||
end program test_serialize_2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0"?> | ||
<root-element xmlns="http://www.example.com"><child-element/></root-element> |