xmllint & dom.Writer

Discussion in 'XML' started by Geoff, Oct 16, 2006.

  1. Geoff

    Geoff Guest

    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
     
    Geoff, Oct 16, 2006
    #1
    1. Advertising

  2. Geoff

    Geoff Guest

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

    -g
     
    Geoff, Oct 16, 2006
    #2
    1. Advertising

  3. Joe Kesselman, Oct 16, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil McNaughton

    Using xmllint and xpath without --shell

    Neil McNaughton, Jan 7, 2005, in forum: XML
    Replies:
    1
    Views:
    4,677
    grouch
    Jan 8, 2005
  2. Stan R.
    Replies:
    4
    Views:
    17,367
    Stan R.
    Jun 8, 2006
  3. DaVinci
    Replies:
    1
    Views:
    568
    Piotr Kobzda
    Oct 5, 2006
  4. Replies:
    2
    Views:
    1,379
  5. Henri
    Replies:
    1
    Views:
    382
    Henri
    Jul 13, 2004
Loading...

Share This Page