By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,864 Members | 1,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,864 IT Pros & Developers. It's quick & easy.

xmllint & dom.Writer

P: n/a
Hello,

I have three files:

~~~~~~~~~
people.xml
~~~~~~~~~
<?xml version="1.0"?>
<people xmlns:xi="http://www.w3.org/2001/XInclude" >
<xi:include href="AlanTuring.xml"/>
<xi:include href="RichardPFeynman.xml"/>
</people>
~~~~~~~~~~~~~
AlanTuring.xml
~~~~~~~~~~~~~
<person born="1912" died="1954">
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>

~~~~~~~~~~~~~~~~~~
RichardPFeynman.xml
~~~~~~~~~~~~~~~~~~
<person born="1918" died="1988">
<name>
<first_name>Richard</first_name>
<middle_initial>P</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
.. . . when I run xmllint on people.xml, I get (as expected):

C:\>xmllint --xinclude people.xml

<?xml version="1.0"?>
<people xmlns:xi="http://www.w3.org/2001/XInclude">
<person born="1912" died="1954">
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>
<person born="1918" died="1988">
<name>
<first_name>Richard</first_name>
<middle_initial>P</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
</people>

.. . . when I run dom.Writer on people.xml, I get:

C:\>dom.Writer -xi -v -s people.xml

[Error] 12-1.xml:2:53: cvc-elt.1: Cannot find the declaration of element
'people'.
<?xml version="1.0" encoding="UTF-8"?>
<people xmlns:xi="http://www.w3.org/2001/XInclude">
<person born="1912" died="1954" xml:base="AlanTuring.xml">
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>
<person born="1918" died="1988" xml:base="RichardPFeynman.xml">
<name>
<first_name>Richard</first_name>
<middle_initial>P</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
</people>
.. . . is there a reason why the dom writer would generate an error and
xmllint would not? The xml is well formed, what does the dom writer error
mean? It seems xmllint is checking for start and end tags, syntax, etc.
Dom writer is actually constructing the tree where people is the root
element(?) but it says it can not find that declaration.

Thanks.

-g
Oct 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I think I answered my own question, since there is no schema document to go
with it, it generates the error.

-g
Oct 15 '06 #2

P: n/a
Geoff wrote:
C:\>dom.Writer -xi -v -s people.xml
http://xerces.apache.org/xerces2-j/s...om.html#Writer

-v means you want to validate.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Oct 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.