Re: XML parsing and NULL children

Derrick Oswald <[email protected]>
Newsgroups gmane.comp.parsers.htmlparser.user
Message-ID <[email protected]>
Try upper case tag names.
        NodeFilter singleFieldFilter=new TagNameFilter("FIELD");
        NodeFilter multipleFieldFilter=new TagNameFilter("FIELD_LIST");


On Tue, Dec 14, 2010 at 11:18 AM, Francesco Fontana <
[email protected]> wrote:

> Hi,
> I'm trying to parse an xml file, but I receive the message "WARNING: URL
> [filename] does not contain text"...
> When I put a watch on a filter, every node found has id and attributes, but
> the children still null...
>
> The code is really simple, the xml is well formed and have a dtd. Someone
> knows what I'm doing wrong?
> Thank you very much,
> Francesco
>
> ------------------------- java code --------------------------
>      public FilterSet setBaseValues(String siteXMLName) throws
> ParserException {
>         NodeFilter singleFieldFilter=new TagNameFilter("field");
>         NodeFilter multipleFieldFilter=new TagNameFilter("field_list");
>         NodeList singleFieldList=new NodeList();
>         NodeList multipleFieldList=new NodeList();
>
>         Parser parser=new Parser("./"+siteXMLName);
>         for (NodeIterator e = parser.elements(); e.hasMoreNodes();) {
>             Node node = e.nextNode();
>             node.collectInto(singleFieldList, singleFieldFilter);
>             node.collectInto(multipleFieldList, multipleFieldFilter);
>         }
> }
> ------------------------------------------------------------------
>
> ------------------------- try.xml content ----------------------
> <?xml version="1.0"?>
> <!DOCTYPE site SYSTEM "hsh.dtd">
> <site>
>     <field id="image" type="attribute">
>         <caption>a caption</caption>
>         <attribute>src</attribute>
>     </field>
>     <field id="description" type="text">
>         <caption>text text</caption>
>     </field>
>     <field_list list="parent_name" type="text">
>         <caption>another caption</caption>
>         <names>
>             <name id="field1">Field 1</name>
>             <name id="field2">Field 2</name>
>         </names>
>     </field_list>
> </site>
> ----------------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> Lotusphere 2011
> Register now for Lotusphere 2011 and learn how
> to connect the dots, take your collaborative environment
> to the next level, and enter the era of Social Business.
> http://p.sf.net/sfu/lotusphere-d2d
> _______________________________________________
> Htmlparser-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/htmlparser-user
>
>

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d

_______________________________________________
Htmlparser-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlparser-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.