You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "winter.pi" <wi...@roboo.com> on 2008/05/29 03:03:05 UTC

答复: how to user WMLDocumentImpl

Hello Michael:

       Thank you for your explanation.

       But most of the times, my documents do have the DTD, like this:

<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD
WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

How should I do to parse it ?

Thank you!

 

  _____  

发件人: Michael Glavassevich [mailto:mrglavas@ca.ibm.com] 
发送时间: 2008年5月28日 19:21
收件人: j-users@xerces.apache.org
抄送: winter.pi@roboo.com
主题: Re: how to user WMLDocumentImpl

 

Hi,

If your document doesn't have a DTD you should be able to set it to null.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"winter.pi" <wi...@roboo.com> wrote on 05/25/2008 09:17:41 PM:

> Hello:
>        I’m a new user of xerces. I want to user WMLDocumentImpl to 
> parse wml document , just like HTMLDocumentImpl.
>        But there is a parameter of DocumentType which I didn’t know 
> how to set. 
>        Does anybody show me an example of it ? 
>        Thank you .
>  
>  
> Winter.pi
> [image removed] 
> R&D Dept, Roboo Inc.
> MSN: winter.pi@roboo.com 
> TEL: 0512-62959785
> www.roboo.com , wap.roboo.com


Re: 答复: how to user WMLDocumentImpl

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi,

If you need to create a DocumentType node I'd suggest that you use the
DOMImplementation. For example:

  ...
  org.w3c.dom.DOMImplementation domImpl = org.apache.wml.dom.
WMLDOMImplementationImpl.getDOMImplementation();
  org.w3c.dom.DocumentType type = domImpl.createDocumentType("wml",
      "-//WAPFORUM//DTD WML 1.1//EN",
"http://www.wapforum.org/DTD/wml_1.1.xml");
  org.apache.wml.WMLDocument doc = (org.apache.wml.WMLDocument)
domImpl.createDocument(null, null, type);
  doc.appendChild(doc.createElement("wml"));
  ...

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"winter.pi" <wi...@roboo.com> wrote on 05/28/2008 09:03:05 PM:

> Hello Michael:
>        Thank you for your explanation.
>        But most of the times, my documents do have the DTD, like this:
> <?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-
> //WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
> How should I do to parse it ?
> Thank you!
>
>
> 发件人: Michael Glavassevich [mailto:mrglavas@ca.ibm.com]
> 发送时间: 2008年5月28日 19:21
> 收件人: j-users@xerces.apache.org
> 抄送: winter.pi@roboo.com
> 主题: Re: how to user WMLDocumentImpl
>
> Hi,
>
> If your document doesn't have a DTD you should be able to set it to null.
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> "winter.pi" <wi...@roboo.com> wrote on 05/25/2008 09:17:41 PM:
>
> > Hello:
> >        I’m a new user of xerces. I want to user WMLDocumentImpl to
> > parse wml document , just like HTMLDocumentImpl.
> >        But there is a parameter of DocumentType which I didn’t know
> > how to set.
> >        Does anybody show me an example of it ?
> >        Thank you .
> >
> >
> > Winter.pi
> > [image removed]
> > R&D Dept, Roboo Inc.
> > MSN: winter.pi@roboo.com
> > TEL: 0512-62959785
> > www.roboo.com , wap.roboo.com