You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by "Lars Preben S. Arnesen" <l....@usit.uio.no> on 2001/06/26 09:44:01 UTC

Some newbie questions

First of all: From what I gathered from
<URL:http://xml.apache.org/mail.html> this is a list for those who
implements the perl wrappers for Xerces. I didn't find any user list,
so I'll try this list.

1) Is there a separate mailinglist for Xerces (Perl) users?

2) Where can I find documentation? I'm quite new to XML and Perl and
   need some documentation to manage to write my scripts. There are a
   few examples at <URL:http://xml.apache.org/xerces-p/samples.html>,
   but they don't contain everything I want to do. I'm also trying to
   get help from
   <URL:http://xml.apache.org/xerces-c/apiDocs/hierarchy.html>, but
   it's not always very intuitive to use the class refrences whithout
   mastering Xerces yet. What I need is some more examples. :)

Anyway: The problem I have encountered now is, I guess, a really easy
one. I need to create "<!DOCTYPE adaptor SYSTEM "woadaptor.dtd">" for
the XML document I'm generating. I belive that I have to use
"createDocumentType", but I didn't get it to work. Could someone
please send me the code just to do this?

Thanks in advance.

-- 
Lars Preben

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Re: Some newbie questions [long]

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org

Re: Some newbie questions

Posted by "Lars Preben S. Arnesen" <l....@usit.uio.no>.
[ Jason E. Stewart ]

> I have my own examples, but they are rather complex, and I don't know
> that they would help more than hurt, but I am willing to post them if
> need be.

If they are documented then I'd really like to see them.

> You don't have to use DOM to create documents. You can just use perl's
> 'print' and write them out a line at a time. Or try using the heredoc
> method of printing for printing out big blobs:

Hmmmm. I think I'll go for that solution. It's almost too easy. :)
 
-- 
Lars Preben

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Re: Some newbie questions

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Tim Harsch" <ha...@llnl.gov> writes:

> This list seems quite I just joined and posted yesterday, no
> response.  Anyway, I was hoping that once I get it installed it
> would come with an adequate set of docs used via the "perldoc"
> system.  Have you looked there yet?

Ok. I would love if I could move all the Xerces-c docomentation (which
is written using the doxygen system) over to perldoc. That would take
a lot of time. If someone is volunteering to do that, I would be very
grateful, and happy to coordinate the effort.

In the meantime, I'm working on moving xerces-1.5 functionality into
Xerces.pm ...


> > First of all: From what I gathered from
> > <URL:http://xml.apache.org/mail.html> this is a list for those who
> > implements the perl wrappers for Xerces. I didn't find any user list,
> > so I'll try this list.
> >
> > 1) Is there a separate mailinglist for Xerces (Perl) users?

This is the correct list. The name is a bit confusing, but since
traffic is relatively low, it is fine for both developers and users to
monitor.

> > 2) Where can I find documentation? I'm quite new to XML and Perl and
> >    need some documentation to manage to write my scripts. There are a
> >    few examples at <URL:http://xml.apache.org/xerces-p/samples.html>,
> >    but they don't contain everything I want to do. I'm also trying to
> >    get help from
> >    <URL:http://xml.apache.org/xerces-c/apiDocs/hierarchy.html>, but
> >    it's not always very intuitive to use the class refrences whithout
> >    mastering Xerces yet. What I need is some more examples. :)

I'm sorry to say that Xerces.pm is not very friendly towards beginning
XML users. There isn't any perl specific documentation. The examples
that exist are in the t/ and samples/ sub-directories of the
distribution. 

I have my own examples, but they are rather complex, and I don't know
that they would help more than hurt, but I am willing to post them if
need be.
        
> > Anyway: The problem I have encountered now is, I guess, a really easy
> > one. I need to create "<!DOCTYPE adaptor SYSTEM "woadaptor.dtd">" for
> > the XML document I'm generating. I belive that I have to use
> > "createDocumentType", but I didn't get it to work. Could someone
> > please send me the code just to do this?

You don't have to use DOM to create documents. You can just use perl's
'print' and write them out a line at a time. Or try using the heredoc
method of printing for printing out big blobs:

print STDOUT <<"XML";
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>

<!DOCTYPE personnel SYSTEM "personal.dtd">
<!-- @version: -->
<personnel>
</personnel>
XML

That is the simplest method of creating documents. 

Now if you really want to create the document in memory using the DOM
API, you can use the following methods:

DOM_DocumentType 
DOM_Implementation::createDocumentType (const DOMString &qualifiedName, 
                                     const DOMString &publicId, 
                                     const DOMString &systemId)  

DOM_Implementation::DOM_Document createDocument (const DOMString &namespaceURI, 
                             const DOMString &qualifiedName, 
                             const DOM_DocumentType &doctype)

Here's some output from my thunking around in the debugger:

  DB<1> use XML::Xerces

  DB<2> $impl = XML::Xerces::DOM_DOMImplementation::getImplementation

  DB<3> x $dt= $impl->createDocumentType('adaptor', '', 'woadaptor.dtd')
0  XML::Xerces::DOM_DocumentType=HASH(0x103ec93c)
     empty hash
  DB<4> x $doc = $impl->createDocument('adaptor', 'foo',$dt)
0  XML::Xerces::DOM_Document=HASH(0x103ecad4)
     empty hash
  DB<5> x $doc->serialize
0  '<!DOCTYPE adaptor SYSTEM "woadaptor.dtd">
<foo/>
'

Watch out using createDocument(), you will get an Abort (an untrapped
C++ exception) if you don't specify the qualified name, 'foo' in my
example). 

Sorry for the delay in answering, I have been ill this week. Let me
know if you need more help.

jas.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


RE: Some newbie questions

Posted by Tim Harsch <ha...@llnl.gov>.
This list seems quite I just joined and posted yesterday, no response.
Anyway, I was hoping that once I get it installed it would come with an
adequate set of docs used via the "perldoc" system.  Have you looked there
yet?

> -----Original Message-----
> From: Lars Preben S|rsdahl Arnesen [mailto:l.p.arnesen@usit.uio.no]
> Sent: Tuesday, June 26, 2001 12:44 AM
> To: xerces-p-dev@xml.apache.org
> Subject: Some newbie questions
>
>
> First of all: From what I gathered from
> <URL:http://xml.apache.org/mail.html> this is a list for those who
> implements the perl wrappers for Xerces. I didn't find any user list,
> so I'll try this list.
>
> 1) Is there a separate mailinglist for Xerces (Perl) users?
>
> 2) Where can I find documentation? I'm quite new to XML and Perl and
>    need some documentation to manage to write my scripts. There are a
>    few examples at <URL:http://xml.apache.org/xerces-p/samples.html>,
>    but they don't contain everything I want to do. I'm also trying to
>    get help from
>    <URL:http://xml.apache.org/xerces-c/apiDocs/hierarchy.html>, but
>    it's not always very intuitive to use the class refrences whithout
>    mastering Xerces yet. What I need is some more examples. :)
>
> Anyway: The problem I have encountered now is, I guess, a really easy
> one. I need to create "<!DOCTYPE adaptor SYSTEM "woadaptor.dtd">" for
> the XML document I'm generating. I belive that I have to use
> "createDocumentType", but I didn't get it to work. Could someone
> please send me the code just to do this?
>
> Thanks in advance.
>
> --
> Lars Preben
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-p-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org